mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Fix #6097. Be more defensive against selection state when moving objects into new containers.
This commit is contained in:
@@ -92,12 +92,18 @@ class AssignContainer(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.active_object.BIMObjectSpatialProperties
|
|
||||||
if self.container:
|
if self.container:
|
||||||
container = tool.Ifc.get().by_id(self.container)
|
container = tool.Ifc.get().by_id(self.container)
|
||||||
elif (container_obj := props.container_obj) and (container := tool.Ifc.get_entity(container_obj)):
|
elif (
|
||||||
|
(obj := tool.Blender.get_active_object())
|
||||||
|
and (props := obj.BIMObjectSpatialProperties)
|
||||||
|
and (container_obj := props.container_obj)
|
||||||
|
and (container := tool.Ifc.get_entity(container_obj))
|
||||||
|
):
|
||||||
pass
|
pass
|
||||||
for element_obj in context.selected_objects:
|
else:
|
||||||
|
return
|
||||||
|
for element_obj in tool.Blender.get_selected_objects():
|
||||||
if self.remove_from_other_containers:
|
if self.remove_from_other_containers:
|
||||||
for col in element_obj.users_collection[:]:
|
for col in element_obj.users_collection[:]:
|
||||||
col.objects.unlink(element_obj)
|
col.objects.unlink(element_obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user