diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 0e60e5089d..7a04e9f9ad 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -2218,8 +2218,6 @@ class ActivateModel(bpy.types.Operator): tool.Geometry, obj=obj, representation=model, - should_reload=False, - is_global=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 ae5ece2310..bf2f026358 100644 --- a/src/bonsai/bonsai/bim/module/drawing/workspace.py +++ b/src/bonsai/bonsai/bim/module/drawing/workspace.py @@ -180,8 +180,6 @@ def create_annotation_occurrence(context): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) 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 0fbe75ce8e..401428cddb 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -427,9 +427,7 @@ class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator): bl_options = {"REGISTER", "UNDO"} obj: bpy.props.StringProperty() ifc_definition_id: bpy.props.IntProperty() - should_reload: bpy.props.BoolProperty() disable_opening_subtractions: bpy.props.BoolProperty() - should_switch_all_meshes: bpy.props.BoolProperty() @classmethod def poll(cls, context): @@ -465,8 +463,6 @@ class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=self.should_reload, - is_global=self.should_switch_all_meshes, ) @@ -720,8 +716,6 @@ class UpdateParametricRepresentation(bpy.types.Operator): tool.Geometry, obj=obj, representation=tool.Ifc.get().by_id(props.ifc_definition_id), - should_reload=True, - is_global=True, ) if show_representation_parameters: core.get_representation_ifc_parameters(tool.Geometry, obj=obj) @@ -1902,8 +1896,6 @@ class OverrideJoin(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=self.target, representation=representation, - should_reload=True, - is_global=True, apply_openings=True, ) diff --git a/src/bonsai/bonsai/bim/module/geometry/ui.py b/src/bonsai/bonsai/bim/module/geometry/ui.py index 22bd9c5259..c4ae6e5491 100644 --- a/src/bonsai/bonsai/bim/module/geometry/ui.py +++ b/src/bonsai/bonsai/bim/module/geometry/ui.py @@ -157,8 +157,6 @@ class BIM_PT_representations(Panel): icon="FILE_REFRESH" if representation["is_active"] else "OUTLINER_DATA_MESH", text="", ) - op.should_switch_all_meshes = True - op.should_reload = True op.ifc_definition_id = representation["id"] op.disable_opening_subtractions = False row.operator("bim.remove_representation", icon="X", text="").representation_id = representation["id"] diff --git a/src/bonsai/bonsai/bim/module/misc/operator.py b/src/bonsai/bonsai/bim/module/misc/operator.py index e30895f10a..15fca6b547 100644 --- a/src/bonsai/bonsai/bim/module/misc/operator.py +++ b/src/bonsai/bonsai/bim/module/misc/operator.py @@ -193,8 +193,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, apply_openings=False, ) @@ -223,8 +221,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, apply_openings=True, ) diff --git a/src/bonsai/bonsai/bim/module/model/door.py b/src/bonsai/bonsai/bim/module/model/door.py index 74f8771cd9..f04fcd81b7 100644 --- a/src/bonsai/bonsai/bim/module/model/door.py +++ b/src/bonsai/bonsai/bim/module/model/door.py @@ -145,8 +145,6 @@ def update_door_modifier_representation(obj: bpy.types.Object) -> None: tool.Geometry, obj=obj, representation=ifcopenshell.util.representation.get_representation(element, active_context), - should_reload=True, - is_global=True, ) # type attributes @@ -580,8 +578,6 @@ class CancelEditingDoor(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) 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 3ffd0f4562..2d9ca711d9 100644 --- a/src/bonsai/bonsai/bim/module/model/opening.py +++ b/src/bonsai/bonsai/bim/module/model/opening.py @@ -186,8 +186,6 @@ class FilledOpeningGenerator: tool.Geometry, obj=voided_obj, representation=representation, - should_reload=True, - is_global=True, ) def regenerate_from_type(self, usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str, Any]) -> None: @@ -248,8 +246,6 @@ class FilledOpeningGenerator: tool.Geometry, obj=voided_obj, representation=representation, - should_reload=True, - is_global=True, ) def generate_opening_from_filling( @@ -418,8 +414,6 @@ class RecalculateFill(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=building_obj, representation=representation, - should_reload=True, - is_global=True, ) return {"FINISHED"} @@ -795,8 +789,6 @@ class CloneOpening(Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index 48155b35f3..edd0b8981a 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -580,8 +580,6 @@ def get_generic_product_preview_data(context, relating_type): tool.Geometry, obj_type, representation, - should_reload=True, - is_global=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 4b4142c97f..c08ff9131b 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -406,8 +406,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) elif self.representation_template == "EXTRUSION": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -421,8 +419,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) return @@ -451,8 +447,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) # Update required as core.type.assign_type may change obj.data @@ -735,6 +729,4 @@ def regenerate_profile_usage(usecase_path, ifc_file, settings): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) diff --git a/src/bonsai/bonsai/bim/module/model/profile.py b/src/bonsai/bonsai/bim/module/model/profile.py index d89b0caa05..ecc1b86163 100644 --- a/src/bonsai/bonsai/bim/module/model/profile.py +++ b/src/bonsai/bonsai/bim/module/model/profile.py @@ -167,8 +167,6 @@ class DumbProfileGenerator: tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric") @@ -567,8 +565,6 @@ class DumbProfileJoiner: tool.Geometry, obj=obj, representation=new_body, - should_reload=True, - is_global=True, ) tool.Geometry.record_object_materials(obj) if element.is_a("IfcFlowSegment") or element.is_a("IfcFlowFitting"): @@ -1035,8 +1031,6 @@ def disable_editing_extrusion_axis(context): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) return {"FINISHED"} @@ -1098,8 +1092,6 @@ class EditExtrusionAxis(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) 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 fde8b05551..5e8d7a70dc 100644 --- a/src/bonsai/bonsai/bim/module/model/railing.py +++ b/src/bonsai/bonsai/bim/module/model/railing.py @@ -538,8 +538,6 @@ def cancel_editing_railing_path(context: bpy.types.Context) -> set[str]: tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/model/slab.py b/src/bonsai/bonsai/bim/module/model/slab.py index bb528b9d03..ddc7c1d9a8 100644 --- a/src/bonsai/bonsai/bim/module/model/slab.py +++ b/src/bonsai/bonsai/bim/module/model/slab.py @@ -167,8 +167,6 @@ class DumbSlabGenerator: tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) obj.matrix_world = obj.matrix_world @ Matrix.Rotation(self.x_angle, 4, "X") @@ -359,8 +357,6 @@ class DumbSlabPlaner: tool.Geometry, obj=obj, representation=new_rep, - should_reload=True, - is_global=True, ) bonsai.core.geometry.remove_representation( tool.Ifc, tool.Geometry, obj=obj, representation=representation @@ -384,8 +380,6 @@ class DumbSlabPlaner: tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) @@ -585,8 +579,6 @@ class EditSketchExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) return {"FINISHED"} @@ -628,8 +620,6 @@ def disable_editing_extrusion_profile(context): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) return {"FINISHED"} @@ -762,8 +752,6 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) # 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 2625eb543c..5b858dec83 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -517,8 +517,6 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) # Object rotation @@ -1023,8 +1021,6 @@ class DumbWallGenerator: tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) 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 231983d02d..76471c5ffe 100644 --- a/src/bonsai/bonsai/bim/module/model/window.py +++ b/src/bonsai/bonsai/bim/module/model/window.py @@ -123,8 +123,6 @@ def update_window_modifier_representation(context: bpy.types.Context) -> None: tool.Geometry, obj=obj, representation=ifcopenshell.util.representation.get_representation(element, active_context), - should_reload=True, - is_global=True, ) # type attributes @@ -494,8 +492,6 @@ class CancelEditingWindow(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) 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 5a9b8dc0b8..55ffa56a79 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -333,8 +333,6 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) else: @@ -578,8 +576,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) if not tool.Ifc.get_entity(props.representation_obj): bpy.data.objects.remove(props.representation_obj) @@ -599,8 +595,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) elif representation_template == "EXTRUSION": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -647,8 +641,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) elif representation_template in ("LAYERSET_AXIS2", "LAYERSET_AXIS3"): unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) @@ -759,8 +751,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) elif representation_template == "EDGE": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -773,8 +763,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) elif representation_template == "FACE": builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get()) @@ -787,8 +775,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) 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 196491358b..13cf08be2c 100644 --- a/src/bonsai/bonsai/bim/module/type/operator.py +++ b/src/bonsai/bonsai/bim/module/type/operator.py @@ -121,8 +121,6 @@ class UnassignType(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=obj, representation=new_active_representation, - should_reload=False, - is_global=False, ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/void/operator.py b/src/bonsai/bonsai/bim/module/void/operator.py index e1d7aae2e8..b7281a1ea7 100644 --- a/src/bonsai/bonsai/bim/module/void/operator.py +++ b/src/bonsai/bonsai/bim/module/void/operator.py @@ -148,10 +148,6 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=voided_obj, representation=representation, - should_reload=True, - is_global=True, - # Don't sync changes because object has an opening, - # therefore bim.update_representaiton wouldn't work either way. ) tool.Geometry.lock_scale(voided_obj) @@ -195,8 +191,6 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator): tool.Geometry, obj=building_obj, representation=representation, - should_reload=True, - is_global=True, ) 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 c31b117a49..b70dbc69e5 100644 --- a/src/bonsai/bonsai/core/geometry.py +++ b/src/bonsai/bonsai/core/geometry.py @@ -115,15 +115,9 @@ def switch_representation( geometry: type[tool.Geometry], obj: bpy.types.Object, representation: ifcopenshell.entity_instance, - should_reload: bool = True, - is_global: bool = True, apply_openings: bool = True, ) -> None: - """Function can switch to representation that wasn't yet assigned to that object. See #2766. - - :param should_reload: reload `obj.data` from ifc representation - :param is_global: replace mesh data for all users of `obj.data`, not just `obj` - + """Switch obj representation (even if not yet assigned to that object. See #2766.) """ if not geometry.get_object_data(obj) and geometry.is_text_literal(representation): return diff --git a/src/bonsai/bonsai/core/tool.py b/src/bonsai/bonsai/core/tool.py index 0124ec1430..cab08135d9 100644 --- a/src/bonsai/bonsai/core/tool.py +++ b/src/bonsai/bonsai/core/tool.py @@ -1092,7 +1092,7 @@ class Type: def get_type_occurrences(cls, element_type): pass def has_material_usage(cls, element): pass def run_geometry_add_representation(cls, obj=None, context=None, ifc_representation_class=None, profile_set_usage=None): pass - def run_geometry_switch_representation(cls, obj=None, representation=None, should_reload=None, is_global=None): pass + def run_geometry_switch_representation(cls, obj=None, representation=None): pass @interface diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index 9ea75d4e0b..40c29ab5d3 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -1178,8 +1178,6 @@ class Drawing(bonsai.core.tool.Drawing): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, ) @classmethod @@ -2222,8 +2220,6 @@ class Drawing(bonsai.core.tool.Drawing): tool.Geometry, obj=obj, representation=priority_representation, - should_reload=False, - is_global=True, ) has_context = True break diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 5b569c3e96..8db4264783 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -1350,8 +1350,6 @@ class Geometry(bonsai.core.tool.Geometry): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, apply_openings=True, ) @@ -1387,8 +1385,6 @@ class Geometry(bonsai.core.tool.Geometry): tool.Geometry, obj=obj, representation=new_representation, - should_reload=False, - is_global=True, ) @classmethod diff --git a/src/bonsai/bonsai/tool/model.py b/src/bonsai/bonsai/tool/model.py index 4fdadaa9d5..10181c5d93 100644 --- a/src/bonsai/bonsai/tool/model.py +++ b/src/bonsai/bonsai/tool/model.py @@ -1091,8 +1091,6 @@ class Model(bonsai.core.tool.Model): tool.Geometry, obj=obj, representation=new_representation, - should_reload=True, - is_global=True, ) @classmethod @@ -1305,8 +1303,6 @@ class Model(bonsai.core.tool.Model): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) @classmethod @@ -1650,8 +1646,6 @@ class Model(bonsai.core.tool.Model): tool.Geometry, obj=obj, representation=representation, - should_reload=True, - is_global=True, apply_openings=True, ) @@ -2465,8 +2459,6 @@ class Model(bonsai.core.tool.Model): tool.Geometry, obj=obj, representation=rep, - should_reload=True, - is_global=True, ) tool.Geometry.record_object_materials(obj) diff --git a/src/bonsai/bonsai/tool/root.py b/src/bonsai/bonsai/tool/root.py index d6d2cd157f..22e8b42d81 100644 --- a/src/bonsai/bonsai/tool/root.py +++ b/src/bonsai/bonsai/tool/root.py @@ -326,8 +326,6 @@ class Root(bonsai.core.tool.Root): tool.Geometry, obj=voided_obj, representation=representation, - should_reload=True, - is_global=True, ) @classmethod diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index 1d8261ded9..a9d7c170ef 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -1198,8 +1198,6 @@ class Spatial(bonsai.core.tool.Spatial): tool.Geometry, obj=obj, representation=body, - should_reload=True, - is_global=True, ) @classmethod diff --git a/src/bonsai/bonsai/tool/type.py b/src/bonsai/bonsai/tool/type.py index 6aff74c569..dab53ee14f 100644 --- a/src/bonsai/bonsai/tool/type.py +++ b/src/bonsai/bonsai/tool/type.py @@ -131,14 +131,10 @@ class Type(bonsai.core.tool.Type): cls, obj: bpy.types.Object, representation: ifcopenshell.entity_instance, - should_reload: bool = False, - is_global: bool = False, ) -> None: return bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, representation=representation, - should_reload=should_reload, - is_global=is_global, ) diff --git a/src/bonsai/test/core/test_geometry.py b/src/bonsai/test/core/test_geometry.py index 97c3a92102..76e3dc9777 100644 --- a/src/bonsai/test/core/test_geometry.py +++ b/src/bonsai/test/core/test_geometry.py @@ -203,8 +203,6 @@ class TestSwitchRepresentation: geometry, obj="obj", representation="mapped_rep", - should_reload=True, - is_global=True, apply_openings=True, ) @@ -221,8 +219,6 @@ class TestSwitchRepresentation: geometry, obj="obj", representation="mapped_rep", - should_reload=False, - is_global=False, ) def test_not_switching_if_an_updated_representation_is_the_same_one_we_were_going_to_switch_to(self, ifc, geometry): @@ -236,8 +232,6 @@ class TestSwitchRepresentation: geometry, obj="obj", representation="mapped_rep", - should_reload=False, - is_global=False, )