mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Revert "Replace currently selected objects with occurences of type"
This reverts commit 58199ef7c9.
This commit is contained in:
@@ -63,7 +63,6 @@ classes = (
|
||||
product.EnableAddType,
|
||||
product.LoadTypeThumbnails,
|
||||
product.MirrorElements,
|
||||
product.ReplaceSelectedWithTypeOccurences,
|
||||
workspace.Hotkey,
|
||||
wall.AlignWall,
|
||||
wall.ChangeExtrusionDepth,
|
||||
|
||||
@@ -283,49 +283,6 @@ class AddConstrTypeInstance(bpy.types.Operator):
|
||||
return True
|
||||
|
||||
|
||||
class ReplaceSelectedWithTypeOccurences(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.replace_selected_with_type_occurences"
|
||||
bl_label = "Replace Selected With Type Occurences"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
bl_description = (
|
||||
"\nReplace selected objects with type either chosen in BIM tools or provided in the argument.\n\n"
|
||||
"NOTE: Currently it's just replacing original object by occurence with the same transform, \n"
|
||||
"no other data from original object is preserved."
|
||||
)
|
||||
relating_type_id: bpy.props.IntProperty(default=0)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if not context.selected_objects:
|
||||
cls.poll_message_set("No objects selected")
|
||||
return False
|
||||
return True
|
||||
|
||||
def _execute(self, context):
|
||||
props = context.scene.BIMModelProperties
|
||||
relating_type_id = self.relating_type_id or int(props.relating_type_id)
|
||||
|
||||
if not relating_type_id:
|
||||
self.report({"ERROR"}, "No type provided.")
|
||||
return {"FINISHED"}
|
||||
|
||||
originally_active_object = context.active_object
|
||||
new_active_object = None
|
||||
objs = bpy.context.selected_objects[:]
|
||||
new_objects = []
|
||||
for replaced_obj in objs:
|
||||
bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id)
|
||||
new_objects.append(obj := bpy.context.active_object)
|
||||
|
||||
obj.matrix_world = replaced_obj.matrix_world
|
||||
if replaced_obj == originally_active_object:
|
||||
new_active_object = obj
|
||||
|
||||
bpy.data.objects.remove(replaced_obj)
|
||||
tool.Blender.set_objects_selection(context, new_active_object, new_objects)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ChangeTypePage(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.change_type_page"
|
||||
bl_label = "Change Type Page"
|
||||
|
||||
@@ -461,7 +461,6 @@ class BimToolUI:
|
||||
else:
|
||||
row.label(text="No Construction Type", icon="FILE_3D")
|
||||
row.operator("bim.launch_type_manager", icon="LIGHTPROBE_GRID", text="")
|
||||
row.operator("bim.replace_selected_with_type_occurences", icon="ARROW_LEFTRIGHT", text="")
|
||||
else:
|
||||
if AuthoringData.data["ifc_element_type"]:
|
||||
row.label(text=f"No {AuthoringData.data['ifc_element_type']} Found", icon="ERROR")
|
||||
@@ -475,7 +474,6 @@ class BimToolUI:
|
||||
else:
|
||||
row.label(text="No Element Types Found", icon="ERROR")
|
||||
row.operator("bim.launch_type_manager", icon="LIGHTPROBE_GRID", text="Launch Type Manager")
|
||||
row.operator("bim.replace_selected_with_type_occurences", icon="ARROW_LEFTRIGHT", text="")
|
||||
|
||||
@classmethod
|
||||
def draw_basic_bim_tool_interface(cls):
|
||||
|
||||
Reference in New Issue
Block a user