Skip to content

Commit

Permalink
Merge pull request #154 from CGArtPython/master
Browse files Browse the repository at this point in the history
Fixing "Run Script" support for Blender 4.0 #153
  • Loading branch information
JacquesLucke authored Nov 21, 2023
2 parents 312671b + 55fe6bb commit ac87ff1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Fixed
- Fixed "Run Script" support for Blender 4.0.

## [0.0.18] - 2023-04-02


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ def execute(self, context):
def run_script_action(data):
path = data["path"]
context = prepare_script_context(path)
bpy.ops.dev.run_script(context, filepath=path)

if bpy.app.version < (4, 0, 0):
bpy.ops.dev.run_script(context, filepath=path)
return

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


def prepare_script_context(filepath):
with open(filepath) as fs:
Expand Down

0 comments on commit ac87ff1

Please sign in to comment.