Fix error updating decorations removing active drawing

should_draw_decorations is updated as part of regular refresh_ui_data.
'removed_drawings' line was a dead code

Traceback (most recent call last):
  File \bonsai\bim\module\drawing\prop.py", line 252, in update_should_draw_decorations
    collection = context.scene.camera.BIMObjectProperties.collection
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'BIMObjectProperties'
File \bonsai\bim\module\drawing\prop.py", line 249, in update_should_draw_decorations
This commit is contained in:
Andrej730
2024-11-19 15:06:44 +05:00
parent 9bbf345fd7
commit d032f75e61
@@ -2128,6 +2128,7 @@ class RemoveDrawing(bpy.types.Operator, tool.Ifc.Operator):
return self.execute(context)
def _execute(self, context):
props = context.scene.DocProperties
if self.remove_all:
drawings = [
tool.Ifc.get().by_id(d.ifc_definition_id)
@@ -2140,14 +2141,16 @@ class RemoveDrawing(bpy.types.Operator, tool.Ifc.Operator):
return {"CANCELLED"}
drawings = [tool.Ifc.get().by_id(self.drawing)]
removed_drawings = [drawing.id() for drawing in drawings]
for drawing in drawings:
sheet_references = tool.Drawing.get_sheet_references(drawing)
for reference in sheet_references:
bpy.ops.bim.remove_drawing_from_sheet(reference=reference.id())
core.remove_drawing(tool.Ifc, tool.Drawing, drawing=drawing)
# In case we removed the active drawing.
if not context.scene.camera and props.should_draw_decorations:
props.should_draw_decorations = False
class ReloadDrawingStyles(bpy.types.Operator):
bl_idname = "bim.reload_drawing_styles"