Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing "Run Script" support for Blender 4.0 #153 #154

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

CGArtPython
Copy link
Collaborator

Issue summary:
When using the "Run Script" command, the user hits 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

Issue cause:
This issue is connected to a breaking change that was introduced in Blender's 4.0 Python API update

https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API

Blender Operators (bpy.ops)
Remove the context override argument to bpy.ops in favor of context.temp_override(..) (ac263a9bce)

For Blender 4.0 in .\pythonFiles\include\blender_vscode\operators\script_runner.py instead of this bpy.ops.dev.run_script(context, filepath=path)

We need to use this

    with bpy.context.temp_override(**context):
        bpy.ops.dev.run_script(filepath=path)

Tested "Run Script" and Add-on Debugging under Blender 2.9 and Blender 4.0

Issue summary:
When using the "Run Script" command, the user hits
`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`

Issue cause:
This issue is connected to a breaking change that was introduced in Blender's 4.0 Python API update

https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API
> Blender Operators (bpy.ops)
> Remove the context override argument to bpy.ops in favor of context.temp_override(..) ([ac263a9bce](https://projects.blender.org/blender/blender/commit/ac263a9bce53e190d07d679a058a230e91e722be))

For Blender 4.0 in `.\pythonFiles\include\blender_vscode\operators\script_runner.py` instead of this
`bpy.ops.dev.run_script(context, filepath=path)`

We need to use this
```
    with bpy.context.temp_override(**context):
        bpy.ops.dev.run_script(filepath=path)
```

Tested "Run Script" and Add-on Debugging under Blender 2.9 and Blender 4.0
Copy link
Owner

@JacquesLucke JacquesLucke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@JacquesLucke JacquesLucke merged commit ac87ff1 into JacquesLucke:master Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants