mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Check and correct for object mode in operator, not in poll, as operator may be called headlessly (e.g. in export function).
Note that after the operator has been refactored to use the core / tool design pattern, the poll code may return if necessary.
This commit is contained in:
@@ -130,10 +130,6 @@ class UpdateRepresentation(bpy.types.Operator):
|
||||
obj: bpy.props.StringProperty()
|
||||
ifc_representation_class: bpy.props.StringProperty()
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object and context.active_object.mode == "OBJECT"
|
||||
|
||||
def execute(self, context):
|
||||
return IfcStore.execute_ifc_operator(self, context)
|
||||
|
||||
@@ -141,6 +137,10 @@ class UpdateRepresentation(bpy.types.Operator):
|
||||
if not ContextData.is_loaded:
|
||||
ContextData.load(IfcStore.get_file())
|
||||
|
||||
if context.active_object and context.active_object.mode != "OBJECT":
|
||||
# Ensure mode is object to prevent invalid mesh data causing CTD
|
||||
bpy.ops.object.mode_set(mode="OBJECT", toggle=False)
|
||||
|
||||
objs = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
||||
self.file = IfcStore.get_file()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user