mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Fix #5941. Context override when adding objects should only have one object. This is a temporary fix.
The proper fix is to refactor add_door and friends into core. That way it can be properly reused instead of this hacky context override.
This commit is contained in:
@@ -532,19 +532,19 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
||||
"material.assign_profile", tool.Ifc.get(), material_profile=material_profile, profile=profile
|
||||
)
|
||||
elif representation_template == "WINDOW":
|
||||
with context.temp_override(active_object=obj):
|
||||
with context.temp_override(active_object=obj, selected_objects=[]):
|
||||
bpy.ops.bim.add_window()
|
||||
elif representation_template == "DOOR":
|
||||
with context.temp_override(active_object=obj):
|
||||
with context.temp_override(active_object=obj, selected_objects=[]):
|
||||
bpy.ops.bim.add_door()
|
||||
elif representation_template == "STAIR":
|
||||
with context.temp_override(active_object=obj):
|
||||
with context.temp_override(active_object=obj, selected_objects=[]):
|
||||
bpy.ops.bim.add_stair()
|
||||
elif representation_template == "RAILING":
|
||||
with context.temp_override(active_object=obj):
|
||||
with context.temp_override(active_object=obj, selected_objects=[]):
|
||||
bpy.ops.bim.add_railing()
|
||||
elif representation_template == "ROOF":
|
||||
with context.temp_override(active_object=obj):
|
||||
with context.temp_override(active_object=obj, selected_objects=[]):
|
||||
bpy.ops.bim.add_roof()
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -144,7 +144,7 @@ class Blender(bonsai.core.tool.Blender):
|
||||
|
||||
@classmethod
|
||||
def get_active_object(cls) -> bpy.types.Object:
|
||||
return bpy.context.view_layer.objects.active or getattr(bpy.context, "active_object", None)
|
||||
return getattr(bpy.context, "active_object", None) or bpy.context.view_layer.objects.active
|
||||
|
||||
@classmethod
|
||||
def get_selected_objects(cls) -> set[bpy.types.Object]:
|
||||
|
||||
Reference in New Issue
Block a user