Attach to Running Blender Process
Hi @JacquesLucke,
first of all, great addon. Love it :) Been wanting something similar for some time now but unfortunately I've lacked the know-how to do it myself so far. I'm only getting started with Blender coding and being able to do so via VS Code is great. (Really looking forward to the code completion feature. =) )
I have a feature request: It would be great to attach the Plugin to an already running Blender process instead of having to start Blender through VS Code all the time.
Cheers Michael
As a developer you can learn how to develop this ;D I also had no idea what I got myself into when I started developing this extension haha
Yes, I will definitely be possible to attach the extension to an already running Blender instance in the future. Just have to find a good way to do it, but should not be too difficult. :)
As a developer you can learn how to develop this ;D
Yes, indeed. And in fact, that's been on my mind for some time now, too. I hope to contribute something in the future for sure. :)
Hi @JacquesLucke, just recently found out about your extension. I wrote blender-debugger-for-vscode, don't know if you've heard about it. I haven't had time to look through your extension yet, I only briefly played around with it, but just want to say the general idea is brilliant! Wish I'd thought of it.
Anyways, although I would not recommend developing an addon on an "unclean" blender instance, could your extension not connect to a running instance of Blender if somebody was using my addon? All it does is run a ptvsd server.
I already made branch that works with 2.8, just haven't pushed it yet because I was planning on changing a few things, e.g. seeing if I coudn't make it auto download ptvsd so the install would be much easier.
Hey, yes I've heard about. I checked the alternatives before I started working on this project.
That is right, there will probably be a bad collision when someone uses your and my addon at the same time. However using both does not make much sense anyway, does it?
I implemented auto download for required packages. For me this is one of the most important things (and one of the main reasons I started this project; but now I see much more potential).
The way I implemented it is fairly straight forward, and works reasonably well. I'm still waiting for more bug reports. :D
I just install pip in Blender using the get-pip.py file, and then use pip to install ptvsd and other required packages.
Ah, I and yep, I can definitely insert a check to see if the ptvsd server is running already and don't do anything in that case. :)
I don't think my addon should interfere since it will just detect the ptvsd version you injected (since it should be first in it's path). The only thing is you don't seem to have a regular "connect" command that just tries to attach.
The upside is this would also probably work with 2.79, the downside is I think you would lose the ability to send commands to blender (to reload addons for example).
I only mention this as a quick workaround. You can probably achieve similar functionality by registering a command under bpy.ops that the user can then use to start ptvsd manually (like my addon does). Since you know where ptvsd is installed, you wouldn't need to implement any auto-detecting of the path like mine.
PS: The reason I didn't go the automatically install pip and ptvsd route was because A) I was kind of winging it when I wrote that addon... B) since it technically also supports Visual Studio (I should really change the name), different users might need different ptvsd versions, even VS Code could not use the latest until recently, and I didn't know how to handle that elegantly. Though I have an idea now for how to go about it now.