Skip to content

Commit

Permalink
fixed context override
Browse files Browse the repository at this point in the history
solved overriding context. If it can be optimized, feel free.
  • Loading branch information
JoshQuake committed Jun 14, 2024
1 parent b21ef9b commit c9c2ecf
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions ue2rigify/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,19 +698,15 @@ def toggle_expand_in_outliner(state=2):
:param int state: 1 will expand all collections, 2 will collapse them.
"""
try:
for area in bpy.context.screen.areas:
if area.type == 'OUTLINER':
override = {'area': area}
bpy.ops.outliner.show_hierarchy(
override_context=override,
execution_context='INVOKE_DEFAULT'
)
area = next(a for a in bpy.context.screen.areas if a.type == 'OUTLINER')

for area in bpy.context.screen.areas:
if area.type == 'OUTLINER':
with bpy.context.temp_override(area=area):
bpy.ops.outliner.show_hierarchy('INVOKE_DEFAULT')
for i in range(state):
bpy.ops.outliner.expanded_toggle(override_context=override)
area.tag_redraw()
except RuntimeError as error:
print(error)
bpy.ops.outliner.expanded_toggle()
area.tag_redraw()


def focus_on_selected():
Expand Down

0 comments on commit c9c2ecf

Please sign in to comment.