mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 19:49:58 +00:00
Keep active object when unlinking an IFC element
Unlinking an element recreates a new blender object so the active object would be lost, jumping the properties to the scene panel which was slightly annoying
This commit is contained in:
@@ -168,6 +168,7 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
else:
|
else:
|
||||||
objects = context.selected_objects
|
objects = context.selected_objects
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
|
was_active_object = obj == context.active_object
|
||||||
object_name = obj.name
|
object_name = obj.name
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element:
|
||||||
@@ -189,6 +190,8 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
blenderbim.core.material.unlink_material(tool.Ifc, obj=material_slot.material)
|
blenderbim.core.material.unlink_material(tool.Ifc, obj=material_slot.material)
|
||||||
if "Ifc" in object_name and "/" in object_name:
|
if "Ifc" in object_name and "/" in object_name:
|
||||||
obj.name = object_name.split("/", 1)[1]
|
obj.name = object_name.split("/", 1)[1]
|
||||||
|
if was_active_object:
|
||||||
|
tool.Blender.set_active_object(obj)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user