JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
572 stars 75 forks source link

Crash when adding mesh #63

Closed CarstenHoyer closed 1 year ago

CarstenHoyer commented 4 years ago

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

> Executing task: /Applications/Blender.app/Contents/MacOS/blender --python /Users/me/.vscode/extensions/jacqueslucke.blender-development-0.0.12/pythonFiles/launch.py < Read prefs: /Users/me/Library/Application Support/Blender/2.81/config/userpref.blend found bundled python: /Applications/Blender.app/Contents/Resources/2.81/python [] * Serving Flask app "Blender Server" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on * Running on http://127.0.0.1:7419/ (Press CTRL+C to quit) 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. > Executing task: /Applications/Blender.app/Contents/MacOS/blender --python /Users/me/.vscode/extensions/jacqueslucke.blender-development-0.0.12/pythonFiles/launch.py < Read prefs: /Users/me/Library/Application Support/Blender/2.81/config/userpref.blend found bundled python: /Applications/Blender.app/Contents/Resources/2.81/python [] * Serving Flask app "Blender Server" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on * Running on http://127.0.0.1:6874/ (Press CTRL+C to quit) 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:

# context.area: VIEW_3D
import bpy
from mathutils import *

D = bpy.data
C = bpy.context

bpy.ops.mesh.primitive_ico_sphere_add(location=Vector((0,0,0)), radius=1.0)

>Blender: Run Script

Debug console

Debug client attached. Got GET: {'type': 'ping'} Got POST: {'type': 'script', 'path': '/Users/me/Workspace/blender/script d9e1873a82.py'}

Terminal

Got GET: {'type': 'ping'} 127.0.0.1 - - [18/Feb/2020 06:42:28] "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:42:28] "POST / HTTP/1.1" 200 - Writing: /var/folders/1k/jt297hcd28dc3rkbv3kkz6k80000gn/T/blender.crash.txt

Blender crash report

# Blender 2.81 (sub 16), Commit date: 2019-11-20 14:27, Hash 26bd5ebd42e3 bpy.ops.mesh.primitive_ico_sphere_add(radius=1, enter_editmode=False, location=(0, 0, 0)) # Operator # 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
JacquesLucke commented 4 years ago

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.

CarstenHoyer commented 4 years ago

Oh, so I guess it is the same thing at play here: https://github.com/JacquesLucke/blender_vscode/issues/68 ?

dorcatty commented 4 years ago

same issue with Blender v2.83.2 but i confirm that it works well with Blender v2.80.rc no ops issues, adding mesh causes no crash.

MatthiasThDs commented 4 years ago

@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.

CGArtPython commented 1 year ago

I am closing this issue. This was resolved with this commit https://github.com/JacquesLucke/blender_vscode/commit/621e275d9000e571f4b4d10cbde7abdd1cf15e0a