diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 5fcaa92d4a..0e60e5089d 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -2220,7 +2220,6 @@ class ActivateModel(bpy.types.Operator): representation=model, should_reload=False, is_global=True, - should_sync_changes_first=True, ) tool.Blender.reset_object_visibility() diff --git a/src/bonsai/bonsai/bim/module/drawing/workspace.py b/src/bonsai/bonsai/bim/module/drawing/workspace.py index 5e36451841..ae5ece2310 100644 --- a/src/bonsai/bonsai/bim/module/drawing/workspace.py +++ b/src/bonsai/bonsai/bim/module/drawing/workspace.py @@ -182,7 +182,6 @@ def create_annotation_occurrence(context): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) if obj.data and not relating_type_rep: diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 862a028e01..0fbe75ce8e 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -467,7 +467,6 @@ class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=self.should_reload, is_global=self.should_switch_all_meshes, - should_sync_changes_first=True, ) @@ -723,7 +722,6 @@ class UpdateParametricRepresentation(bpy.types.Operator): representation=tool.Ifc.get().by_id(props.ifc_definition_id), should_reload=True, is_global=True, - should_sync_changes_first=False, ) if show_representation_parameters: core.get_representation_ifc_parameters(tool.Geometry, obj=obj) @@ -1906,7 +1904,6 @@ class OverrideJoin(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, apply_openings=True, ) diff --git a/src/bonsai/bonsai/bim/module/misc/operator.py b/src/bonsai/bonsai/bim/module/misc/operator.py index 6f9aa60a7b..e30895f10a 100644 --- a/src/bonsai/bonsai/bim/module/misc/operator.py +++ b/src/bonsai/bonsai/bim/module/misc/operator.py @@ -195,7 +195,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, apply_openings=False, ) @@ -226,7 +225,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, apply_openings=True, ) diff --git a/src/bonsai/bonsai/bim/module/model/door.py b/src/bonsai/bonsai/bim/module/model/door.py index 4396c435c6..74f8771cd9 100644 --- a/src/bonsai/bonsai/bim/module/model/door.py +++ b/src/bonsai/bonsai/bim/module/model/door.py @@ -147,7 +147,6 @@ def update_door_modifier_representation(obj: bpy.types.Object) -> None: representation=ifcopenshell.util.representation.get_representation(element, active_context), should_reload=True, is_global=True, - should_sync_changes_first=False, ) # type attributes @@ -583,7 +582,6 @@ class CancelEditingDoor(bpy.types.Operator, tool.Ifc.Operator): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) props.is_editing = False diff --git a/src/bonsai/bonsai/bim/module/model/opening.py b/src/bonsai/bonsai/bim/module/model/opening.py index 32acaae5a5..3ffd0f4562 100644 --- a/src/bonsai/bonsai/bim/module/model/opening.py +++ b/src/bonsai/bonsai/bim/module/model/opening.py @@ -188,7 +188,6 @@ class FilledOpeningGenerator: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) def regenerate_from_type(self, usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str, Any]) -> None: @@ -251,7 +250,6 @@ class FilledOpeningGenerator: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) def generate_opening_from_filling( @@ -422,7 +420,6 @@ class RecalculateFill(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} @@ -800,7 +797,6 @@ class CloneOpening(Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index ea412f7dd4..48155b35f3 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -582,7 +582,6 @@ def get_generic_product_preview_data(context, relating_type): representation, should_reload=True, is_global=False, - should_sync_changes_first=False, ) context.view_layer.update() break diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index 09322d1802..4b4142c97f 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -408,7 +408,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) elif self.representation_template == "EXTRUSION": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -424,7 +423,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return @@ -455,7 +453,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) # Update required as core.type.assign_type may change obj.data @@ -740,5 +737,4 @@ def regenerate_profile_usage(usecase_path, ifc_file, settings): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) diff --git a/src/bonsai/bonsai/bim/module/model/profile.py b/src/bonsai/bonsai/bim/module/model/profile.py index 29732e3a48..d89b0caa05 100644 --- a/src/bonsai/bonsai/bim/module/model/profile.py +++ b/src/bonsai/bonsai/bim/module/model/profile.py @@ -169,7 +169,6 @@ class DumbProfileGenerator: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric") @@ -570,7 +569,6 @@ class DumbProfileJoiner: representation=new_body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) tool.Geometry.record_object_materials(obj) if element.is_a("IfcFlowSegment") or element.is_a("IfcFlowFitting"): @@ -1039,7 +1037,6 @@ def disable_editing_extrusion_axis(context): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} @@ -1103,7 +1100,6 @@ class EditExtrusionAxis(bpy.types.Operator, tool.Ifc.Operator): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) bpy.context.view_layer.update() diff --git a/src/bonsai/bonsai/bim/module/model/railing.py b/src/bonsai/bonsai/bim/module/model/railing.py index 28ac149325..fde8b05551 100644 --- a/src/bonsai/bonsai/bim/module/model/railing.py +++ b/src/bonsai/bonsai/bim/module/model/railing.py @@ -540,7 +540,6 @@ def cancel_editing_railing_path(context: bpy.types.Context) -> set[str]: representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/model/slab.py b/src/bonsai/bonsai/bim/module/model/slab.py index fdb8540e98..bb528b9d03 100644 --- a/src/bonsai/bonsai/bim/module/model/slab.py +++ b/src/bonsai/bonsai/bim/module/model/slab.py @@ -169,7 +169,6 @@ class DumbSlabGenerator: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) obj.matrix_world = obj.matrix_world @ Matrix.Rotation(self.x_angle, 4, "X") @@ -362,7 +361,6 @@ class DumbSlabPlaner: representation=new_rep, should_reload=True, is_global=True, - should_sync_changes_first=False, ) bonsai.core.geometry.remove_representation( tool.Ifc, tool.Geometry, obj=obj, representation=representation @@ -388,7 +386,6 @@ class DumbSlabPlaner: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @@ -590,7 +587,6 @@ class EditSketchExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} @@ -634,7 +630,6 @@ def disable_editing_extrusion_profile(context): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) return {"FINISHED"} @@ -769,7 +764,6 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) # Only certain classes should have a footprint diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index e2826fbada..2625eb543c 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -519,7 +519,6 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) # Object rotation @@ -1026,7 +1025,6 @@ class DumbWallGenerator: representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric") ifcopenshell.api.pset.edit_pset(self.file, pset=pset, properties={"Engine": "Bonsai.DumbLayer2"}) diff --git a/src/bonsai/bonsai/bim/module/model/window.py b/src/bonsai/bonsai/bim/module/model/window.py index 16063d82ab..231983d02d 100644 --- a/src/bonsai/bonsai/bim/module/model/window.py +++ b/src/bonsai/bonsai/bim/module/model/window.py @@ -125,7 +125,6 @@ def update_window_modifier_representation(context: bpy.types.Context) -> None: representation=ifcopenshell.util.representation.get_representation(element, active_context), should_reload=True, is_global=True, - should_sync_changes_first=True, ) # type attributes @@ -497,7 +496,6 @@ class CancelEditingWindow(bpy.types.Operator, tool.Ifc.Operator): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) props.is_editing = False diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 8eb2119993..5a9b8dc0b8 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -335,7 +335,6 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) else: @@ -581,7 +580,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) if not tool.Ifc.get_entity(props.representation_obj): bpy.data.objects.remove(props.representation_obj) @@ -603,7 +601,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) elif representation_template == "EXTRUSION": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -652,7 +649,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) elif representation_template in ("LAYERSET_AXIS2", "LAYERSET_AXIS3"): unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) @@ -765,7 +761,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) elif representation_template == "EDGE": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -780,7 +775,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) elif representation_template == "FACE": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -795,7 +789,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) bpy.context.view_layer.update() # Ensures obj.matrix_world is correct diff --git a/src/bonsai/bonsai/bim/module/type/operator.py b/src/bonsai/bonsai/bim/module/type/operator.py index b34d2e3078..196491358b 100644 --- a/src/bonsai/bonsai/bim/module/type/operator.py +++ b/src/bonsai/bonsai/bim/module/type/operator.py @@ -123,7 +123,6 @@ class UnassignType(bpy.types.Operator, tool.Ifc.Operator): representation=new_active_representation, should_reload=False, is_global=False, - should_sync_changes_first=False, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/void/operator.py b/src/bonsai/bonsai/bim/module/void/operator.py index 737de84eeb..e1d7aae2e8 100644 --- a/src/bonsai/bonsai/bim/module/void/operator.py +++ b/src/bonsai/bonsai/bim/module/void/operator.py @@ -152,7 +152,6 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator): is_global=True, # Don't sync changes because object has an opening, # therefore bim.update_representaiton wouldn't work either way. - should_sync_changes_first=False, ) tool.Geometry.lock_scale(voided_obj) @@ -198,7 +197,6 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) tool.Geometry.unlock_scale_object_with_openings(obj) tool.Geometry.clear_cache(element) diff --git a/src/bonsai/bonsai/core/geometry.py b/src/bonsai/bonsai/core/geometry.py index f258e1b842..c31b117a49 100644 --- a/src/bonsai/bonsai/core/geometry.py +++ b/src/bonsai/bonsai/core/geometry.py @@ -117,22 +117,14 @@ def switch_representation( representation: ifcopenshell.entity_instance, should_reload: bool = True, is_global: bool = True, - should_sync_changes_first: bool = False, apply_openings: bool = True, ) -> None: """Function can switch to representation that wasn't yet assigned to that object. See #2766. - :param should_sync_changes_first: sync ifc representation with current state of `obj.data` :param should_reload: reload `obj.data` from ifc representation :param is_global: replace mesh data for all users of `obj.data`, not just `obj` """ - if should_sync_changes_first and ifc.is_edited(obj) and not geometry.is_box_representation(representation): - representation_id = geometry.get_representation_id(representation) - geometry.run_geometry_update_representation(obj=obj) - if not geometry.does_representation_id_exist(representation_id): - return - if not geometry.get_object_data(obj) and geometry.is_text_literal(representation): return @@ -142,9 +134,7 @@ def switch_representation( geometry.reimport_element_representations(obj, representation, apply_openings=apply_openings) -def get_representation_ifc_parameters( - geometry: type[tool.Geometry], obj: bpy.types.Object, should_sync_changes_first: bool = False -) -> None: +def get_representation_ifc_parameters(geometry: type[tool.Geometry], obj: bpy.types.Object) -> None: geometry.import_representation_parameters(geometry.get_object_data(obj)) diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index 281872eccd..9ea75d4e0b 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -1180,7 +1180,6 @@ class Drawing(bonsai.core.tool.Drawing): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @classmethod @@ -2225,7 +2224,6 @@ class Drawing(bonsai.core.tool.Drawing): representation=priority_representation, should_reload=False, is_global=True, - should_sync_changes_first=True, ) has_context = True break diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 92814b4c03..5b569c3e96 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -1352,7 +1352,6 @@ class Geometry(bonsai.core.tool.Geometry): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, apply_openings=True, ) @@ -1389,7 +1388,6 @@ class Geometry(bonsai.core.tool.Geometry): obj=obj, representation=new_representation, should_reload=False, - should_sync_changes_first=False, is_global=True, ) diff --git a/src/bonsai/bonsai/tool/ifc.py b/src/bonsai/bonsai/tool/ifc.py index 39039d73f6..a85a8bd3e8 100644 --- a/src/bonsai/bonsai/tool/ifc.py +++ b/src/bonsai/bonsai/tool/ifc.py @@ -248,7 +248,7 @@ class Ifc(bonsai.core.tool.Ifc): Marking object as edited is an optimization mechanism - instead of saving changed geometry to IFC, we mark it as changed and then it's saved later - (typically during project save or switch_representation(should_sync_changes_first=True)). + (typically during project save). Other caveat of using edited objects is that it won't have an effect for objects with openings, since we can't deduce non-openings representation from edited representation with openings. diff --git a/src/bonsai/bonsai/tool/model.py b/src/bonsai/bonsai/tool/model.py index 9322e23f0d..4fdadaa9d5 100644 --- a/src/bonsai/bonsai/tool/model.py +++ b/src/bonsai/bonsai/tool/model.py @@ -1093,7 +1093,6 @@ class Model(bonsai.core.tool.Model): representation=new_representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @classmethod @@ -1308,7 +1307,6 @@ class Model(bonsai.core.tool.Model): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @classmethod @@ -1654,7 +1652,6 @@ class Model(bonsai.core.tool.Model): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, apply_openings=True, ) @@ -2470,7 +2467,6 @@ class Model(bonsai.core.tool.Model): representation=rep, should_reload=True, is_global=True, - should_sync_changes_first=False, ) tool.Geometry.record_object_materials(obj) diff --git a/src/bonsai/bonsai/tool/root.py b/src/bonsai/bonsai/tool/root.py index 36c4631307..d6d2cd157f 100644 --- a/src/bonsai/bonsai/tool/root.py +++ b/src/bonsai/bonsai/tool/root.py @@ -328,7 +328,6 @@ class Root(bonsai.core.tool.Root): representation=representation, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @classmethod diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index f92f08f281..1d8261ded9 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -1200,7 +1200,6 @@ class Spatial(bonsai.core.tool.Spatial): representation=body, should_reload=True, is_global=True, - should_sync_changes_first=False, ) @classmethod diff --git a/src/bonsai/bonsai/tool/type.py b/src/bonsai/bonsai/tool/type.py index bda2ed4502..6aff74c569 100644 --- a/src/bonsai/bonsai/tool/type.py +++ b/src/bonsai/bonsai/tool/type.py @@ -141,5 +141,4 @@ class Type(bonsai.core.tool.Type): representation=representation, should_reload=should_reload, is_global=is_global, - should_sync_changes_first=False, ) diff --git a/src/bonsai/test/core/test_geometry.py b/src/bonsai/test/core/test_geometry.py index 1b6f42904a..97c3a92102 100644 --- a/src/bonsai/test/core/test_geometry.py +++ b/src/bonsai/test/core/test_geometry.py @@ -205,7 +205,6 @@ class TestSwitchRepresentation: representation="mapped_rep", should_reload=True, is_global=True, - should_sync_changes_first=True, apply_openings=True, ) @@ -224,7 +223,6 @@ class TestSwitchRepresentation: representation="mapped_rep", should_reload=False, is_global=False, - should_sync_changes_first=True, ) def test_not_switching_if_an_updated_representation_is_the_same_one_we_were_going_to_switch_to(self, ifc, geometry): @@ -240,7 +238,6 @@ class TestSwitchRepresentation: representation="mapped_rep", should_reload=False, is_global=False, - should_sync_changes_first=True, ) @@ -248,7 +245,7 @@ class TestGetRepresentationIfcParameters: def test_run(self, geometry): geometry.get_object_data("obj").should_be_called().will_return("data") geometry.import_representation_parameters("data").should_be_called() - subject.get_representation_ifc_parameters(geometry, obj="obj", should_sync_changes_first=False) + subject.get_representation_ifc_parameters(geometry, obj="obj") class TestRemoveRepresentation: