Keep active object when removing from containers

This commit is contained in:
Gorgious
2021-08-19 21:27:37 +02:00
parent 17e61afd59
commit a14c3b181d
@@ -134,7 +134,7 @@ class RemoveContainer(bpy.types.Operator):
return IfcStore.execute_ifc_operator(self, context)
def _execute(self, context):
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
obj = bpy.data.objects.get(self.obj, context.active_object)
oprops = obj.BIMObjectProperties
self.file = IfcStore.get_file()
ifcopenshell.api.run(
@@ -152,6 +152,7 @@ class RemoveContainer(bpy.types.Operator):
for collection in obj.users_collection:
collection.objects.unlink(obj)
context.scene.collection.objects.link(obj)
context.view_layer.objects.active = obj
return {"FINISHED"}
def remove_collection(self, parent, child):