Skip to content

Commit 5a8209e

Browse files
committed
Fix IfcOpenShell#4549. Drawing decorators are now refreshed like the rest of the UI after operations.
1 parent 50b41f5 commit 5a8209e

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/blenderbim/blenderbim/bim/handler.py

+2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def refresh_ui_data():
192192
if isinstance(tool.Ifc.get(), ifcopenshell.sqlite):
193193
tool.Ifc.get().clear_cache()
194194

195+
bpy.context.scene.DocProperties.should_draw_decorations = bpy.context.scene.DocProperties.should_draw_decorations
196+
195197

196198
@persistent
197199
def loadIfcStore(scene):

src/blenderbim/blenderbim/bim/module/drawing/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def register():
127127
bpy.types.Object.BIMAssignedProductProperties = bpy.props.PointerProperty(type=prop.BIMAssignedProductProperties)
128128
bpy.types.Object.BIMTextProperties = bpy.props.PointerProperty(type=prop.BIMTextProperties)
129129
bpy.types.TextCurve.BIMTextProperties = bpy.props.PointerProperty(type=prop.BIMTextProperties)
130-
bpy.app.handlers.load_post.append(handler.toggleDecorationsOnLoad)
130+
bpy.app.handlers.load_post.append(handler.load_post)
131131
bpy.app.handlers.depsgraph_update_pre.append(handler.depsgraph_update_pre_handler)
132132
bpy.types.VIEW3D_MT_image_add.append(ui.add_object_button)
133133

@@ -141,6 +141,6 @@ def unregister():
141141
del bpy.types.Object.BIMAssignedProductProperties
142142
del bpy.types.Object.BIMTextProperties
143143
del bpy.types.TextCurve.BIMTextProperties
144-
bpy.app.handlers.load_post.remove(handler.toggleDecorationsOnLoad)
144+
bpy.app.handlers.load_post.remove(handler.load_post)
145145
bpy.app.handlers.depsgraph_update_pre.remove(handler.depsgraph_update_pre_handler)
146146
bpy.types.VIEW3D_MT_image_add.remove(ui.add_object_button)

src/blenderbim/blenderbim/bim/module/drawing/handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
@persistent
26-
def toggleDecorationsOnLoad(*args):
26+
def load_post(*args):
2727
if bpy.context.scene.DocProperties.should_draw_decorations:
2828
decoration.DecorationsHandler.install(bpy.context)
2929
else:

src/blenderbim/blenderbim/bim/module/drawing/prop.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ def update_titleblocks(self, context):
231231
SheetsData.data["titleblocks"] = SheetsData.titleblocks()
232232

233233

234-
def toggleDecorations(self, context):
235-
toggle = self.should_draw_decorations
236-
if toggle:
234+
def update_should_draw_decorations(self, context):
235+
if self.should_draw_decorations:
237236
# TODO: design a proper text variable templating renderer
238237
collection = context.scene.camera.BIMObjectProperties.collection
239238
for obj in collection.objects:
@@ -345,7 +344,7 @@ class DocProperties(PropertyGroup):
345344
active_sheet_index: IntProperty(name="Active Sheet Index")
346345
ifc_files: CollectionProperty(name="IFCs", type=StrProperty)
347346
drawing_styles: CollectionProperty(name="Drawing Styles", type=DrawingStyle)
348-
should_draw_decorations: BoolProperty(name="Should Draw Decorations", update=toggleDecorations)
347+
should_draw_decorations: BoolProperty(name="Should Draw Decorations", update=update_should_draw_decorations)
349348
sheets_dir: StringProperty(default=os.path.join("sheets") + os.path.sep, name="Default Sheets Directory")
350349
layouts_dir: StringProperty(default=os.path.join("layouts") + os.path.sep, name="Default Layouts Directory")
351350
titleblocks_dir: StringProperty(

0 commit comments

Comments
 (0)