Skip to main content
Became Hot Network Question
deleted 619 characters in body
Source Link

I have the following code which I use for expanding all collections in the outliner

def toggle_collection_collapse(state):
    area = next(a for a in bpy.context.screen.areas if a.type == 'OUTLINER')
    bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')
    for i in range(state):
        bpy.ops.outliner.expanded_toggle({'area': area})
    area.tag_redraw()

class Expand_All(bpy.types.Operator):
    bl_label = "Expand All"
    bl_idname = "my.expand_all"

    def execute(self, context):
        toggle_collection_collapse(1)
        return {'FINISHED'}

this useThis used to work on Blender 3.6.5 but now in 4.0.1 I get this error

Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported
Error: Python: Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported

Seems like the problem is when calling this line bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')

How I can fix this?

I have the following code which I use for expanding all collections in the outliner

def toggle_collection_collapse(state):
    area = next(a for a in bpy.context.screen.areas if a.type == 'OUTLINER')
    bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')
    for i in range(state):
        bpy.ops.outliner.expanded_toggle({'area': area})
    area.tag_redraw()

class Expand_All(bpy.types.Operator):
    bl_label = "Expand All"
    bl_idname = "my.expand_all"

    def execute(self, context):
        toggle_collection_collapse(1)
        return {'FINISHED'}

this use to work on Blender 3.6.5 but now in 4.0.1 I get this error

Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported
Error: Python: Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported

Seems like the problem is when calling this line bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')

How I can fix this?

I have the following code which I use for expanding all collections in the outliner

def toggle_collection_collapse(state):
    area = next(a for a in bpy.context.screen.areas if a.type == 'OUTLINER')
    bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')
    for i in range(state):
        bpy.ops.outliner.expanded_toggle({'area': area})
    area.tag_redraw()

class Expand_All(bpy.types.Operator):
    bl_label = "Expand All"
    bl_idname = "my.expand_all"

    def execute(self, context):
        toggle_collection_collapse(1)
        return {'FINISHED'}

This used to work on Blender 3.6.5 but now in 4.0.1 I get this error

Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported

Seems like the problem is when calling this line bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')

How I can fix this?

Source Link

`ValueError: 1-2 args execution context is supported` on call to `bpy.ops.outliner.show_hierarchy` in Blender 4.0.1

I have the following code which I use for expanding all collections in the outliner

def toggle_collection_collapse(state):
    area = next(a for a in bpy.context.screen.areas if a.type == 'OUTLINER')
    bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')
    for i in range(state):
        bpy.ops.outliner.expanded_toggle({'area': area})
    area.tag_redraw()

class Expand_All(bpy.types.Operator):
    bl_label = "Expand All"
    bl_idname = "my.expand_all"

    def execute(self, context):
        toggle_collection_collapse(1)
        return {'FINISHED'}

this use to work on Blender 3.6.5 but now in 4.0.1 I get this error

Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported
Error: Python: Traceback (most recent call last):
  File "/Users/user/models.blend/Text", line 218, in execute
  File "/Users/user/models.blend/Text", line 195, in toggle_collection_collapse
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported

Seems like the problem is when calling this line bpy.ops.outliner.show_hierarchy({'area': area}, 'INVOKE_DEFAULT')

How I can fix this?