Blender hanging when refreshing with F8 hotkey while runing VS code debbugger
JoseConseco opened this issue · 3 comments
HI I wonder if there is way to disable ptvsd, so that I can prevent problems of debugging in background while reloading scripts with F8 hotkey? Right now often blender freezes, or ptvsd attachment is broken, and I cannot reattach from blender again. Often I have to reset both blender and vscode apps, so that attaching blender would work again.
Is there option to make operator for disabling ptvsd, so that I can use F8, and then connect back to ptvsd service?
No, unfortunately ptvsd does not provide a way to stop/close it, as far as I know it's not possible.
But Blender shouldn't be freezing when you reload plugins. Can you list the exact steps to reproduce? I just tested this and I actually did have it freeze, but in Blender's console you could see it was because one of my other addons was misbehaving, it was throwing errors on reload whether or not ptvsd was running, so I disabled it and everything worked as it should. So check that first.
If you want to more quickly enable/disable your own addon btw, you can create a quick separate addon/script to bind a shortcut to bpy.ops.wm.addon_enable/disable
. I actually didn't even know there was a reload all scripts hotkey till now, but it seems an awful waste of time reloading everything (especially when that's error prone or not allowed, e.g. I use a plugin that runs a modal that doesn't allow reloading it like this), but I am tired of clicking the little checkbox manually so when I have some time I will add a helper command for this.
Not sure why my prevous reply got lost. Anway disabling broken addons, and then turning vs code debug in vs code editor, before goint into blender and hitting F8 does the trick. 90% blender won't crash.
F8 is not optimal, but it takes half a second, so not a big problem :)
Glad you got it working. I will close this for now.
For anybody else who stumbles upon this, you can also set a shortcut directly to wm.addon_enable
and wm.addon_disable
but you would need to set 2 shortcuts. Somebody correct me if I'm wrong, but there doesn't seem to be a way to access this setting from bpy.context
(to use wm.context_toggle
).