Compare commits

...

2 Commits

Author SHA1 Message Date
Ryan Schultz 2f5d107ff1 Fix #7681: Fix isolate_objects ignoring hide_select/hide_viewport (#7710)
Objects with hide_select=True could not be selected during
isolation, causing hide_view_set to incorrectly hide them.
Objects with hide_viewport=True had their H-key hide state
modified as a side effect of hide_view_clear/hide_view_set.
Both are now left unaffected by bim.activate_drawing.

Generated with the assistance of an AI coding tool.
2026-05-25 10:06:27 -05:00
Ryan Schultz d72c400756 Fix #7999: Fix isolate_objects context for select_all op
bpy.ops.object.select_all requires a VIEW_3D context to pass
its poll() check. The two calls were outside the existing
temp_override blocks, causing a RuntimeError when the operator
was invoked from a non-3D-view area (e.g. a properties panel).
Moved both calls inside the adjacent temp_override blocks.

Generated with the assistance of an AI coding tool.
2026-04-24 07:58:56 -05:00
+18 -2
View File
@@ -1962,16 +1962,32 @@ class Blender(bonsai.core.tool.Blender):
previously_active = bpy.context.view_layer.objects.active
override = cls.get_viewport_context()
# Save H-key hide state for globally-restricted objects so we don't change it.
# hide_viewport=True means the object is globally hidden via the outliner restriction;
# hide_view_clear/hide_view_set should not add or remove an additional H-key hide on them.
viewport_restricted = {obj: obj.hide_get() for obj in bpy.context.view_layer.objects if obj.hide_viewport}
with bpy.context.temp_override(**override):
bpy.ops.object.hide_view_clear(select=False)
bpy.ops.object.select_all(action="DESELECT")
bpy.ops.object.select_all(action="DESELECT")
hide_select_objs = []
for obj in objs:
if obj.hide_select:
hide_select_objs.append(obj)
obj.hide_select = False
obj.select_set(True)
with bpy.context.temp_override(**override):
bpy.ops.object.hide_view_set(unselected=True)
bpy.ops.object.select_all(action="DESELECT")
for obj in hide_select_objs:
obj.hide_select = True
for obj, was_hidden in viewport_restricted.items():
obj.hide_set(was_hidden)
bpy.ops.object.select_all(action="DESELECT")
for name in previously_selected:
obj = bpy.data.objects.get(name)
if obj: