forgot that bim.assign_class is used without context arguments too, moved poll to pie menu operator
This commit is contained in:
Andrej730
2024-07-24 17:21:42 +05:00
parent d3bcd2f73e
commit b021dbf55e
2 changed files with 12 additions and 7 deletions
@@ -28,6 +28,13 @@ class OpenPieClass(bpy.types.Operator):
bl_label = "Open Pie Class"
bl_description = "Assign the IFC Class to the selected objects"
@classmethod
def poll(cls, context):
if not context.active_object and not context.selected_objects:
cls.poll_message_set("No object selected.")
return False
return True
def execute(self, context):
bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_bim_class")
return {"FINISHED"}
@@ -175,16 +175,14 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
should_add_representation: bpy.props.BoolProperty(default=True)
ifc_representation_class: bpy.props.StringProperty()
@classmethod
def poll(cls, context):
if not context.active_object and not context.selected_objects:
cls.poll_message_set("No object selected.")
return False
return True
def _execute(self, context):
props = context.scene.BIMRootProperties
objects = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects or [context.active_object]
if not objects:
self.report({"INFO"}, "No objects selected.")
return
ifc_class = self.ifc_class or props.ifc_class
predefined_type = self.userdefined_type if self.predefined_type == "USERDEFINED" else self.predefined_type
ifc_context = self.context_id