mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Deprecate should_reload and is_global in switch representation as they don't do anything now.
Superseded by item editing mode, so always reload, and always global.
This commit is contained in:
@@ -2218,8 +2218,6 @@ class ActivateModel(bpy.types.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=model,
|
representation=model,
|
||||||
should_reload=False,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
tool.Blender.reset_object_visibility()
|
tool.Blender.reset_object_visibility()
|
||||||
|
|||||||
@@ -180,8 +180,6 @@ def create_annotation_occurrence(context):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if obj.data and not relating_type_rep:
|
if obj.data and not relating_type_rep:
|
||||||
|
|||||||
@@ -427,9 +427,7 @@ class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
obj: bpy.props.StringProperty()
|
obj: bpy.props.StringProperty()
|
||||||
ifc_definition_id: bpy.props.IntProperty()
|
ifc_definition_id: bpy.props.IntProperty()
|
||||||
should_reload: bpy.props.BoolProperty()
|
|
||||||
disable_opening_subtractions: bpy.props.BoolProperty()
|
disable_opening_subtractions: bpy.props.BoolProperty()
|
||||||
should_switch_all_meshes: bpy.props.BoolProperty()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -465,8 +463,6 @@ class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
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,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=tool.Ifc.get().by_id(props.ifc_definition_id),
|
representation=tool.Ifc.get().by_id(props.ifc_definition_id),
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
if show_representation_parameters:
|
if show_representation_parameters:
|
||||||
core.get_representation_ifc_parameters(tool.Geometry, obj=obj)
|
core.get_representation_ifc_parameters(tool.Geometry, obj=obj)
|
||||||
@@ -1902,8 +1896,6 @@ class OverrideJoin(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=self.target,
|
obj=self.target,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ class BIM_PT_representations(Panel):
|
|||||||
icon="FILE_REFRESH" if representation["is_active"] else "OUTLINER_DATA_MESH",
|
icon="FILE_REFRESH" if representation["is_active"] else "OUTLINER_DATA_MESH",
|
||||||
text="",
|
text="",
|
||||||
)
|
)
|
||||||
op.should_switch_all_meshes = True
|
|
||||||
op.should_reload = True
|
|
||||||
op.ifc_definition_id = representation["id"]
|
op.ifc_definition_id = representation["id"]
|
||||||
op.disable_opening_subtractions = False
|
op.disable_opening_subtractions = False
|
||||||
row.operator("bim.remove_representation", icon="X", text="").representation_id = representation["id"]
|
row.operator("bim.remove_representation", icon="X", text="").representation_id = representation["id"]
|
||||||
|
|||||||
@@ -193,8 +193,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=False,
|
apply_openings=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -223,8 +221,6 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,6 @@ def update_door_modifier_representation(obj: bpy.types.Object) -> None:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=ifcopenshell.util.representation.get_representation(element, active_context),
|
representation=ifcopenshell.util.representation.get_representation(element, active_context),
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# type attributes
|
# type attributes
|
||||||
@@ -580,8 +578,6 @@ class CancelEditingDoor(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
props.is_editing = False
|
props.is_editing = False
|
||||||
|
|||||||
@@ -186,8 +186,6 @@ class FilledOpeningGenerator:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=voided_obj,
|
obj=voided_obj,
|
||||||
representation=representation,
|
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:
|
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,
|
tool.Geometry,
|
||||||
obj=voided_obj,
|
obj=voided_obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_opening_from_filling(
|
def generate_opening_from_filling(
|
||||||
@@ -418,8 +414,6 @@ class RecalculateFill(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=building_obj,
|
obj=building_obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -795,8 +789,6 @@ class CloneOpening(Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -580,8 +580,6 @@ def get_generic_product_preview_data(context, relating_type):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj_type,
|
obj_type,
|
||||||
representation,
|
representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=False,
|
|
||||||
)
|
)
|
||||||
context.view_layer.update()
|
context.view_layer.update()
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -406,8 +406,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
elif self.representation_template == "EXTRUSION":
|
elif self.representation_template == "EXTRUSION":
|
||||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
@@ -421,8 +419,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -451,8 +447,6 @@ class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update required as core.type.assign_type may change obj.data
|
# 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,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -167,8 +167,6 @@ class DumbProfileGenerator:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric")
|
||||||
@@ -567,8 +565,6 @@ class DumbProfileJoiner:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_body,
|
representation=new_body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
tool.Geometry.record_object_materials(obj)
|
tool.Geometry.record_object_materials(obj)
|
||||||
if element.is_a("IfcFlowSegment") or element.is_a("IfcFlowFitting"):
|
if element.is_a("IfcFlowSegment") or element.is_a("IfcFlowFitting"):
|
||||||
@@ -1035,8 +1031,6 @@ def disable_editing_extrusion_axis(context):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -1098,8 +1092,6 @@ class EditExtrusionAxis(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bpy.context.view_layer.update()
|
bpy.context.view_layer.update()
|
||||||
|
|||||||
@@ -538,8 +538,6 @@ def cancel_editing_railing_path(context: bpy.types.Context) -> set[str]:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -167,8 +167,6 @@ class DumbSlabGenerator:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
obj.matrix_world = obj.matrix_world @ Matrix.Rotation(self.x_angle, 4, "X")
|
obj.matrix_world = obj.matrix_world @ Matrix.Rotation(self.x_angle, 4, "X")
|
||||||
|
|
||||||
@@ -359,8 +357,6 @@ class DumbSlabPlaner:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_rep,
|
representation=new_rep,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
bonsai.core.geometry.remove_representation(
|
bonsai.core.geometry.remove_representation(
|
||||||
tool.Ifc, tool.Geometry, obj=obj, representation=representation
|
tool.Ifc, tool.Geometry, obj=obj, representation=representation
|
||||||
@@ -384,8 +380,6 @@ class DumbSlabPlaner:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -585,8 +579,6 @@ class EditSketchExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -628,8 +620,6 @@ def disable_editing_extrusion_profile(context):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -762,8 +752,6 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Only certain classes should have a footprint
|
# Only certain classes should have a footprint
|
||||||
|
|||||||
@@ -517,8 +517,6 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Object rotation
|
# Object rotation
|
||||||
@@ -1023,8 +1021,6 @@ class DumbWallGenerator:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
pset = ifcopenshell.api.pset.add_pset(self.file, product=element, name="EPset_Parametric")
|
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"})
|
ifcopenshell.api.pset.edit_pset(self.file, pset=pset, properties={"Engine": "Bonsai.DumbLayer2"})
|
||||||
|
|||||||
@@ -123,8 +123,6 @@ def update_window_modifier_representation(context: bpy.types.Context) -> None:
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=ifcopenshell.util.representation.get_representation(element, active_context),
|
representation=ifcopenshell.util.representation.get_representation(element, active_context),
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# type attributes
|
# type attributes
|
||||||
@@ -494,8 +492,6 @@ class CancelEditingWindow(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
props.is_editing = False
|
props.is_editing = False
|
||||||
|
|||||||
@@ -333,8 +333,6 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@@ -578,8 +576,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
if not tool.Ifc.get_entity(props.representation_obj):
|
if not tool.Ifc.get_entity(props.representation_obj):
|
||||||
bpy.data.objects.remove(props.representation_obj)
|
bpy.data.objects.remove(props.representation_obj)
|
||||||
@@ -599,8 +595,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
elif representation_template == "EXTRUSION":
|
elif representation_template == "EXTRUSION":
|
||||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
@@ -647,8 +641,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
elif representation_template in ("LAYERSET_AXIS2", "LAYERSET_AXIS3"):
|
elif representation_template in ("LAYERSET_AXIS2", "LAYERSET_AXIS3"):
|
||||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
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,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
elif representation_template == "EDGE":
|
elif representation_template == "EDGE":
|
||||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
@@ -773,8 +763,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
elif representation_template == "FACE":
|
elif representation_template == "FACE":
|
||||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
@@ -787,8 +775,6 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bpy.context.view_layer.update() # Ensures obj.matrix_world is correct
|
bpy.context.view_layer.update() # Ensures obj.matrix_world is correct
|
||||||
|
|||||||
@@ -121,8 +121,6 @@ class UnassignType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_active_representation,
|
representation=new_active_representation,
|
||||||
should_reload=False,
|
|
||||||
is_global=False,
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -148,10 +148,6 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=voided_obj,
|
obj=voided_obj,
|
||||||
representation=representation,
|
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)
|
tool.Geometry.lock_scale(voided_obj)
|
||||||
|
|
||||||
@@ -195,8 +191,6 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=building_obj,
|
obj=building_obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
tool.Geometry.unlock_scale_object_with_openings(obj)
|
tool.Geometry.unlock_scale_object_with_openings(obj)
|
||||||
tool.Geometry.clear_cache(element)
|
tool.Geometry.clear_cache(element)
|
||||||
|
|||||||
@@ -115,15 +115,9 @@ def switch_representation(
|
|||||||
geometry: type[tool.Geometry],
|
geometry: type[tool.Geometry],
|
||||||
obj: bpy.types.Object,
|
obj: bpy.types.Object,
|
||||||
representation: ifcopenshell.entity_instance,
|
representation: ifcopenshell.entity_instance,
|
||||||
should_reload: bool = True,
|
|
||||||
is_global: bool = True,
|
|
||||||
apply_openings: bool = True,
|
apply_openings: bool = True,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Function can switch to representation that wasn't yet assigned to that object. See #2766.
|
"""Switch obj representation (even if not 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`
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not geometry.get_object_data(obj) and geometry.is_text_literal(representation):
|
if not geometry.get_object_data(obj) and geometry.is_text_literal(representation):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1092,7 +1092,7 @@ class Type:
|
|||||||
def get_type_occurrences(cls, element_type): pass
|
def get_type_occurrences(cls, element_type): pass
|
||||||
def has_material_usage(cls, element): 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_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
|
@interface
|
||||||
|
|||||||
@@ -1178,8 +1178,6 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -2222,8 +2220,6 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=priority_representation,
|
representation=priority_representation,
|
||||||
should_reload=False,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
has_context = True
|
has_context = True
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1350,8 +1350,6 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1387,8 +1385,6 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_representation,
|
representation=new_representation,
|
||||||
should_reload=False,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -1091,8 +1091,6 @@ class Model(bonsai.core.tool.Model):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=new_representation,
|
representation=new_representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -1305,8 +1303,6 @@ class Model(bonsai.core.tool.Model):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -1650,8 +1646,6 @@ class Model(bonsai.core.tool.Model):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2465,8 +2459,6 @@ class Model(bonsai.core.tool.Model):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=rep,
|
representation=rep,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
tool.Geometry.record_object_materials(obj)
|
tool.Geometry.record_object_materials(obj)
|
||||||
|
|
||||||
|
|||||||
@@ -326,8 +326,6 @@ class Root(bonsai.core.tool.Root):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=voided_obj,
|
obj=voided_obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -1198,8 +1198,6 @@ class Spatial(bonsai.core.tool.Spatial):
|
|||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=body,
|
representation=body,
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -131,14 +131,10 @@ class Type(bonsai.core.tool.Type):
|
|||||||
cls,
|
cls,
|
||||||
obj: bpy.types.Object,
|
obj: bpy.types.Object,
|
||||||
representation: ifcopenshell.entity_instance,
|
representation: ifcopenshell.entity_instance,
|
||||||
should_reload: bool = False,
|
|
||||||
is_global: bool = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
return bonsai.core.geometry.switch_representation(
|
return bonsai.core.geometry.switch_representation(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
tool.Geometry,
|
tool.Geometry,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
representation=representation,
|
representation=representation,
|
||||||
should_reload=should_reload,
|
|
||||||
is_global=is_global,
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -203,8 +203,6 @@ class TestSwitchRepresentation:
|
|||||||
geometry,
|
geometry,
|
||||||
obj="obj",
|
obj="obj",
|
||||||
representation="mapped_rep",
|
representation="mapped_rep",
|
||||||
should_reload=True,
|
|
||||||
is_global=True,
|
|
||||||
apply_openings=True,
|
apply_openings=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -221,8 +219,6 @@ class TestSwitchRepresentation:
|
|||||||
geometry,
|
geometry,
|
||||||
obj="obj",
|
obj="obj",
|
||||||
representation="mapped_rep",
|
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):
|
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,
|
geometry,
|
||||||
obj="obj",
|
obj="obj",
|
||||||
representation="mapped_rep",
|
representation="mapped_rep",
|
||||||
should_reload=False,
|
|
||||||
is_global=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user