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:
Ryan Schultz
2026-03-20 12:30:11 -05:00
parent f327a999d0
commit 1ce62c948c
@@ -1456,10 +1456,11 @@ class SelectSimilar(Operator):
)
calculated_sum: bpy.props.FloatProperty(name="Calculated Sum", default=0.0)
remove_from_selection: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
should_unhide: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
@classmethod
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)
active = context.active_object
@@ -1486,6 +1487,7 @@ class SelectSimilar(Operator):
def invoke(self, context, event):
self.calculate_sum = event.ctrl and event.type == "LEFTMOUSE"
self.remove_from_selection = event.shift and event.type == "LEFTMOUSE"
self.should_unhide = event.alt
return self.execute(context)
def execute(self, context):
@@ -1543,11 +1545,15 @@ class SelectSimilar(Operator):
def _select_objects(self, context, key, reference_values, tolerance):
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)
if obj_value is None:
continue
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)
count += 1
return count