-
Notifications
You must be signed in to change notification settings - Fork 75
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
Crash when adding mesh #63
Comments
Unfortunately, there is an annoying limitation with running these scripts in Blender currently. They must not access any context (and operators access context). I've thought about solutions for the fundamental problem of triggering operators in Blender from the outside multiple times. I did not find the time to implement any of that yet though.... That's still on my todo list. |
Oh, so I guess it is the same thing at play here: #68 ? |
same issue with Blender v2.83.2 |
@JacquesLucke Did you find a solution for this yet? I have problems with all bpy.ops.mesh.xx functions it seems and maybe this is related. |
…e when run from VS Code Extension JacquesLucke#135 # Summary of issue Calling a script via operator results in an empty context. # Related devtalk.blender from @JacquesLucke https://devtalk.blender.org/t/how-to-run-a-script-from-outside-blender-script-live-link-addon/9792/3?u=jacqueslucke # Solution Use bpy.app.timers to register a function to run the target script. # Changes pythonFiles\include\blender_vscode\operators\script_runner.py * remove the RunScriptOperator and move the contents of the execute method into a the `run_script()` function * register a timer callback to the `run_script()` function that will execute the target script # Potentially related issues * When adding objects to collections the objects only show after the script ends. JacquesLucke#101 * accessing bpy.context.object crashes Blender JacquesLucke#86 * Crash when adding mesh JacquesLucke#63 * Delete is skipped JacquesLucke#68 # Testing * execute a simple script that uses `bpy.context.active_object` * set the #context.area: SEQUENCE_EDITOR and run this script https://github.com/CGArtPython/blender_plus_python/blob/main/sequence_editor_frame_import/sequence_editor_frame_import_done.py * execute the script from issue JacquesLucke#101 JacquesLucke#101 * execute the script from issue JacquesLucke#86 JacquesLucke#86 * execute the script from issue JacquesLucke#63 JacquesLucke#63 * execute the script from issue JacquesLucke#68 JacquesLucke#68 * execute the script from issue JacquesLucke#41 JacquesLucke#41
…e when run from VS Code Extension JacquesLucke#135 # Summary of issue Calling a script via operator results in an empty context. # Related devtalk.blender from @JacquesLucke https://devtalk.blender.org/t/how-to-run-a-script-from-outside-blender-script-live-link-addon/9792/3?u=jacqueslucke # Solution Use bpy.app.timers to register a function to run the target script. # Changes pythonFiles\include\blender_vscode\operators\script_runner.py * remove the RunScriptOperator and move the contents of the execute method into a the `run_script()` function * register a timer callback to the `run_script()` function that will execute the target script # Potentially related issues * When adding objects to collections the objects only show after the script ends. JacquesLucke#101 * accessing bpy.context.object crashes Blender JacquesLucke#86 * Crash when adding mesh JacquesLucke#63 * Delete is skipped JacquesLucke#68 # Testing * execute a simple script that uses `bpy.context.active_object` * set the #context.area: SEQUENCE_EDITOR and run this script https://github.com/CGArtPython/blender_plus_python/blob/main/sequence_editor_frame_import/sequence_editor_frame_import_done.py * execute the script from issue JacquesLucke#101 JacquesLucke#101 * execute the script from issue JacquesLucke#86 JacquesLucke#86 * execute the script from issue JacquesLucke#63 JacquesLucke#63 * execute the script from issue JacquesLucke#68 JacquesLucke#68 * execute the script from issue JacquesLucke#41 JacquesLucke#41
…e when run from VS Code Extension JacquesLucke#135 # Summary of issue Calling a script via operator results in an empty context. # Related devtalk.blender from @JacquesLucke https://devtalk.blender.org/t/how-to-run-a-script-from-outside-blender-script-live-link-addon/9792/3?u=jacqueslucke # Solution Use bpy.app.timers to register a function to run the target script. # Changes pythonFiles\include\blender_vscode\operators\script_runner.py * remove the RunScriptOperator and move the contents of the execute method into a the `run_script()` function * register a timer callback to the `run_script()` function that will execute the target script # Potentially related issues * When adding objects to collections the objects only show after the script ends. JacquesLucke#101 * accessing bpy.context.object crashes Blender JacquesLucke#86 * Crash when adding mesh JacquesLucke#63 * Delete is skipped JacquesLucke#68 # Testing * execute a simple script that uses `bpy.context.active_object` * set the #context.area: SEQUENCE_EDITOR and run this script https://github.com/CGArtPython/blender_plus_python/blob/main/sequence_editor_frame_import/sequence_editor_frame_import_done.py * execute the script from issue JacquesLucke#101 JacquesLucke#101 * execute the script from issue JacquesLucke#86 JacquesLucke#86 * execute the script from issue JacquesLucke#63 JacquesLucke#63 * execute the script from issue JacquesLucke#68 JacquesLucke#68 * execute the script from issue JacquesLucke#41 JacquesLucke#41
I am closing this issue. |
OS: macOS Mojave 10.14.5
Blender version: Version 2.81 (2.81 2019-11-20)
VS Code: Version: 1.42.1 Commit: c47d83b293181d9be64f27ff093689e8e7aed054
>Python: Select interpreter
/usr/local/bin/python3 -> /Applications/Blender.app/Contents/Resources/2.81/python/bin/python3.7m
>Blender: Start --> pick /Applications/Blender.app/Contents/MacOS/blender
Read prefs: /Users/me/Library/Application Support/Blender/2.81/config/userpref.blend
found bundled python: /Applications/Blender.app/Contents/Resources/2.81/python
[]
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
Sending: {'type': 'setup', 'blenderPort': 7419, 'ptvsdPort': 2897, 'blenderPath': '/Applications/Blender.app/Contents/MacOS/blender', 'scriptsFolder': '/Applications/Blender.app/Contents/MacOS/2.81/scripts', 'addonPathMappings': []}
Waiting for debug client.
Debug client attached.
Got GET: {'type': 'ping'}
127.0.0.1 - - [18/Feb/2020 06:38:45] "GET / HTTP/1.1" 200 -
Got POST: {'type': 'script', 'path': '/Users/me/Workspace/blender/script d9e1873a82.py'}
127.0.0.1 - - [18/Feb/2020 06:38:45] "POST / HTTP/1.1" 200 -
Writing: /var/folders/1k/jt297hcd28dc3rkbv3kkz6k80000gn/T/blender.crash.txt
Terminal will be reused by tasks, press any key to close it.
Read prefs: /Users/me/Library/Application Support/Blender/2.81/config/userpref.blend
found bundled python: /Applications/Blender.app/Contents/Resources/2.81/python
[]
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
Sending: {'type': 'setup', 'blenderPort': 6874, 'ptvsdPort': 8568, 'blenderPath': '/Applications/Blender.app/Contents/MacOS/blender', 'scriptsFolder': '/Applications/Blender.app/Contents/MacOS/2.81/scripts', 'addonPathMappings': []}
Waiting for debug client.
Debug client attached.
With this simple script:
>Blender: Run Script
Debug console
Terminal
Blender crash report
backtrace
0 blender 0x000000010344cea7 BLI_system_backtrace + 55
1 blender 0x000000010316bbea sig_handle_crash + 362
2 libsystem_platform.dylib 0x00007fff5bed6b5d _sigtramp + 29
3 ??? 0x0000000000000000 0x0 + 0
4 blender 0x0000000107503418 extract_run + 632
5 blender 0x00000001074fbd18 extract_task_create + 632
6 blender 0x00000001074fb830 mesh_buffer_cache_create_requested + 4224
7 blender 0x000000010750e0c9 DRW_mesh_batch_cache_create_requested + 13145
8 blender 0x000000010751b10f drw_engines_cache_populate + 191
9 blender 0x000000010751a361 DRW_draw_render_loop_ex + 1025
10 blender 0x0000000107802a8d view3d_main_region_draw + 125
11 blender 0x000000010787394e ED_region_do_draw + 366
12 blender 0x000000010367564b wm_draw_update + 1899
13 blender 0x00000001036732a0 WM_main + 48
14 blender 0x000000010316840f main + 927
15 libdyld.dylib 0x00007fff5bceb3d5 start + 1
The text was updated successfully, but these errors were encountered: