mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 22:50:56 +00:00
Preserving original name on unlinking
Unlinking was using copied object name for the unlinked object instead of the original one. So it worked like Cube -> IfcWall/Cube -> Cube.001 and bim test was failing: FAILED test/bim/test_feature.py::test_unlink_object - AssertionError: The object "Cube" does not exist
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:
|
||||||
|
object_name = obj.name
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element:
|
||||||
if self.should_delete:
|
if self.should_delete:
|
||||||
@@ -186,8 +187,8 @@ class UnlinkObject(bpy.types.Operator):
|
|||||||
material_slot.material = material_slot.material.copy()
|
material_slot.material = material_slot.material.copy()
|
||||||
blenderbim.core.style.unlink_style(tool.Ifc, tool.Style, obj=material_slot.material)
|
blenderbim.core.style.unlink_style(tool.Ifc, tool.Style, obj=material_slot.material)
|
||||||
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 obj.name and "/" in obj.name:
|
if "Ifc" in object_name and "/" in object_name:
|
||||||
obj.name = "/".join(obj.name.split("/")[1:])
|
obj.name = object_name.split("/", 1)[1]
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user