mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Better convention: Using poll() method for b452348748
Thank you @Andrej730. per https://github.com/IfcOpenShell/IfcOpenShell/commit/b452348748629a6e6dad6df24e21bfad2c203043#r157689504
This commit is contained in:
@@ -724,6 +724,13 @@ class SelectSimilar(Operator, tool.Ifc.Operator):
|
||||
)
|
||||
calculated_sum: bpy.props.FloatProperty(name="Calculated Sum", default=0.0)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.selected_objects or context.active_object:
|
||||
return True
|
||||
cls.poll_message_set("No selected or active object found.")
|
||||
return False
|
||||
|
||||
def invoke(self, context, event):
|
||||
if event.type == "LEFTMOUSE" and event.shift:
|
||||
self.calculate_sum = True
|
||||
@@ -731,9 +738,6 @@ class SelectSimilar(Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
objects = context.selected_objects or [context.active_object]
|
||||
if not objects:
|
||||
self.report({"WARNING"}, "No selected or active object found.")
|
||||
return {"CANCELLED"}
|
||||
for obj in objects:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
key = self.key
|
||||
|
||||
Reference in New Issue
Block a user