mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 16:29:57 +00:00
fix issue in 93fe2e9
forgot that bim.assign_class is used without context arguments too, moved poll to pie menu operator
This commit is contained in:
@@ -28,6 +28,13 @@ class OpenPieClass(bpy.types.Operator):
|
|||||||
bl_label = "Open Pie Class"
|
bl_label = "Open Pie Class"
|
||||||
bl_description = "Assign the IFC Class to the selected objects"
|
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):
|
def execute(self, context):
|
||||||
bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_bim_class")
|
bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_bim_class")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -175,16 +175,14 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
should_add_representation: bpy.props.BoolProperty(default=True)
|
should_add_representation: bpy.props.BoolProperty(default=True)
|
||||||
ifc_representation_class: bpy.props.StringProperty()
|
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):
|
def _execute(self, context):
|
||||||
props = context.scene.BIMRootProperties
|
props = context.scene.BIMRootProperties
|
||||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects or [context.active_object]
|
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
|
ifc_class = self.ifc_class or props.ifc_class
|
||||||
predefined_type = self.userdefined_type if self.predefined_type == "USERDEFINED" else self.predefined_type
|
predefined_type = self.userdefined_type if self.predefined_type == "USERDEFINED" else self.predefined_type
|
||||||
ifc_context = self.context_id
|
ifc_context = self.context_id
|
||||||
|
|||||||
Reference in New Issue
Block a user