mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Add ALT+Click unhide to select_similar
ALT+Click now unhides hidden objects (viewport and local hide) before selecting, matching the same behavior added to select_ifc_class. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -1456,10 +1456,11 @@ class SelectSimilar(Operator):
|
|||||||
)
|
)
|
||||||
calculated_sum: bpy.props.FloatProperty(name="Calculated Sum", default=0.0)
|
calculated_sum: bpy.props.FloatProperty(name="Calculated Sum", default=0.0)
|
||||||
remove_from_selection: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
remove_from_selection: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
||||||
|
should_unhide: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def description(cls, context, properties):
|
def description(cls, context, properties):
|
||||||
base = "Select objects with a similar value\n\n" "SHIFT+CLICK remove from selection set."
|
base = "Select objects with a similar value\n\nSHIFT+CLICK remove from selection set.\nALT+CLICK also unhide hidden objects (viewport and local hide)."
|
||||||
|
|
||||||
key = getattr(properties, "key", None)
|
key = getattr(properties, "key", None)
|
||||||
active = context.active_object
|
active = context.active_object
|
||||||
@@ -1486,6 +1487,7 @@ class SelectSimilar(Operator):
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
self.calculate_sum = event.ctrl and event.type == "LEFTMOUSE"
|
self.calculate_sum = event.ctrl and event.type == "LEFTMOUSE"
|
||||||
self.remove_from_selection = event.shift and event.type == "LEFTMOUSE"
|
self.remove_from_selection = event.shift and event.type == "LEFTMOUSE"
|
||||||
|
self.should_unhide = event.alt
|
||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
@@ -1543,11 +1545,15 @@ class SelectSimilar(Operator):
|
|||||||
|
|
||||||
def _select_objects(self, context, key, reference_values, tolerance):
|
def _select_objects(self, context, key, reference_values, tolerance):
|
||||||
count = 0
|
count = 0
|
||||||
for obj in context.visible_objects:
|
objects = context.scene.objects if self.should_unhide else context.visible_objects
|
||||||
|
for obj in objects:
|
||||||
obj_value = self._get_value(obj, key)
|
obj_value = self._get_value(obj, key)
|
||||||
if obj_value is None:
|
if obj_value is None:
|
||||||
continue
|
continue
|
||||||
if any(self._compare_values(obj_value, ref_value, tolerance) for ref_value in reference_values):
|
if any(self._compare_values(obj_value, ref_value, tolerance) for ref_value in reference_values):
|
||||||
|
if self.should_unhide:
|
||||||
|
obj.hide_viewport = False
|
||||||
|
obj.hide_set(False)
|
||||||
obj.select_set(not self.remove_from_selection)
|
obj.select_set(not self.remove_from_selection)
|
||||||
count += 1
|
count += 1
|
||||||
return count
|
return count
|
||||||
|
|||||||
Reference in New Issue
Block a user