Do not directly access IfcStore.edited_objs

This commit is contained in:
Andrej730
2024-06-25 15:28:47 +05:00
parent 46d3d3afe1
commit 8172096a5b
5 changed files with 11 additions and 10 deletions
@@ -324,7 +324,7 @@ class UpdateRepresentation(bpy.types.Operator, Operator):
if not obj.data:
continue
self.update_obj_mesh_representation(context, obj)
IfcStore.edited_objs.discard(obj)
tool.Ifc.finish_edit(obj)
return {"FINISHED"}
def update_obj_mesh_representation(self, context, obj):
@@ -108,7 +108,7 @@ def update_railing_modifier_ifc_data(context):
tool.Model.replace_object_ifc_representation(body, obj, model_representation)
# hacky way to ensure tha ifc representation won't get tessellated at project save
IfcStore.edited_objs.discard(obj)
tool.Ifc.finish_edit(obj)
elif props.railing_type == "FRAMELESS_PANEL":
tool.Ifc.edit(obj)
@@ -238,8 +238,7 @@ class UnlinkObject(bpy.types.Operator):
for obj in objects:
was_active_object = obj == context.active_object
if obj in IfcStore.edited_objs:
IfcStore.edited_objs.remove(obj)
tool.Ifc.finish_edit(obj)
element = tool.Ifc.get_entity(obj)
if element and self.should_delete:
+6 -4
View File
@@ -165,14 +165,16 @@ class Ifc(blenderbim.core.tool.Ifc):
@classmethod
def edit(cls, obj: bpy.types.Object) -> None:
"""Mark object as edited."""
IfcStore.edited_objs.add(obj)
@classmethod
def finish_edit(cls, obj: bpy.types.Object) -> None:
try:
IfcStore.edited_objs.remove(obj)
except:
pass
"""Unmark object as edited.
Method is safe to use on an object that wasn't marked as edited before.
"""
IfcStore.edited_objs.discard(obj)
@classmethod
def resolve_uri(cls, uri):
+2 -2
View File
@@ -93,8 +93,8 @@ class Misc(blenderbim.core.tool.Misc):
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
@classmethod
def mark_object_as_edited(cls, obj):
IfcStore.edited_objs.add(obj)
def mark_object_as_edited(cls, obj: bpy.types.Object) -> None:
tool.Ifc.edit(obj)
@classmethod
def split_objects_with_cutter(