Closed ericwomer closed 9 months ago
the old context override method bpy.ops.dev.run_script(context, filepath=path)
is not supported anymore since Blender 4.0, it needs to be
with bpy.context.temp_override(**context):
bpy.ops.dev.run_script(filepath=path)
But be careful since there is an issue with new temp override where you cannot longer use areas from other screens in override or it will produce Area not found in screen (reported it to Blender)
the old context override method
bpy.ops.dev.run_script(context, filepath=path)
is not supported anymore since Blender 4.0, it needs to bewith bpy.context.temp_override(**context): bpy.ops.dev.run_script(filepath=path)
But be careful since there is an issue with new temp override where you cannot longer use areas from other screens in override or it will produce Area not found in screen (reported it to Blender)
After modifying it according to your description, the script is running successfully, thanks!
Hello @ericwomer and @monnerHenster,
It seems this may be fixed in the latest push, could you confirm?
https://github.com/JacquesLucke/blender_vscode/commit/55fe6bb89bcdf14bedf25b89f2176848c386e534
I can confirm that the latest push fixed the problem for me.
Thank you @Ladvien for pointing out the fix! Thank you @BadDogSkyrim for confirming!
version 0.0.19 of the extension from 2023-12-05 should have this fix
Blender 4.0 23e3f8f563960655ae084cbffa7defbe34f29451 Ubuntu 23.04 Python 3.10 (bundled with Blender)
After starting blender and attempting to run the script from vscode I get the following error.
import bpy
bpy.ops.mesh.primitive_cube_add(size=4)
cube_obj = bpy.context.active_object
cube_obj.location.z = 5