Visual Studio CODE, Blender integration

My platform:

Windows 10 64 bit.
Blender 2.78c and Blender 2.79

I use VSC because it is lightweight with my older CPU. I found a video on using a VSC debugger with blender BUT is was focused on Linux and building the core of blender.

Right now I am following a beginners YouTube tutorial on blender python programming and I can write the code in VSC and run it in blender. But this is awkward does anyone have a tutorial on fully integrating VSC for blender on WINDOWS. VSC not Visual Studio. They are similar but different animals.

Visual Studio Code is anything but light. AFAIK its using web technology (Electron) which it gives it a big hit on performance compared to its big brother VS.

Installing Visual Studio is a good idea because you will also get the command line tools you need to build and debug from the command line. From there on its just matter for reading the Visual Studio documentation and using these tools from the command line embed inside Visual Code.

Blender on windows “officially” support Visual Studio. I dont know if Visual Code can open VS project files, most likely it cannot , in any case expect to do a lot of readon on CMAKE, MAKE and of course command line tools. Obviously this is knowledge common for all platforms that blender runs on.

The simplest way is going to VSC’s command line and just running make inside the blender source code folder. VSC also has build configurations that will allow you to execute more complex CLI commands if you aim for a more particular build that then common tarkets offered by Blender’s makefile.

It may be possible to build Blender with CLang or MinGW, CLang will have the same workflow as MacOS where you can use the debugger via CLI with the lldb command.

I am using VSC myself by the way (and I really like it), so I am in no way trying to convince you to switch to VS but it will make your life easier on Windows to use VS instead of VSC. On other hand once you get a good idea how things works it will be probably as easy if not easier to use VSC.

1 Like

I am already using VSC and Visual studio slows my machine to a crawl.

1 Like

Use notepad++ or Geany with this for the code completion (Blender 0,78 or 0,79):

This app are very very very light before VSC or VS!

You can run all your py code in Blender easy with any writer app, even simpletext or blocknote…

1 Like

Probably a bug , VS is blazing fast as is XCode. Of course compilation and building will eat the CPU but that’s the unescapable reality of highly optimized machine code.

What kind of CPU you have ?

I used have viewed the video here.

Remote Debugging of blender with Visual Studio code.

And download the addon that he provided here.

But it is confusing for a windows user. He uses linux and he gears that video toward someone that wants to debug a plugin that they have already written or parts of the blender source that are written in python. I know a bit of python java and C# programming. I was just wondering if anyone had any suggestions on LIVE usage of VSC in blender. NOT programming plugins or python tutorials for blender. I can fine tons of those online. But how to get VSC integrated with blender.

You are try to avoid using VS , currently this is not supported officially.

So yes you can use VS code BUT it will still trigger VS for debugging. IT far easier to short out the bug you experience with VS than having to do all this crazy voodoo magic to get vsc working with Blender C source code.

The only viable solution I can thing is using an alternative compiler, maybe CLang or MinGW but none of those are “officially” supported so I would not be suprised if you run into any problems.

The problem with VSC is that is assumes that it works with a debugger meant to be used from the terminal while the VS debugger is meant to be used from inside VS.

Best solution I can think, install Linux which you will have to do anyway if you want to build and linux executable as well and use vsc from there.

VSC also will require a set of extensions to make your life easier , the ones I use are ( I am mainly developing on MACOS and build on windows and ubuntu)

  1. C/C++ this one will give you automcompletion and many useful features of VS
  2. CodeLLDB this one is for lldb the debugger of Cland, there are similar extenstion for GDB the GNU C debugger which is what the linux uses
  3. Git history helps with views the repos , remotes and locals , file history
  4. GitLens this one is a powerful git client that lets you deal with a lot of messy scenarios involving git conflicts, merges etc, especially useful if you plan to make your own branch and modify Blender source code while keeping it uptodate with latest commits from blender’s official remote repository

Overall if you plan to code in C expect to do A LOT of reading, all the above is the piece of cake part, changing the code is the very hard part because there is literally close to zero documentation. Completely opposite experience compared to developing addons.

VS Code is great. It’s not necessarily lightweight in terms of performance, but full VS is about 20GB of install with all kinds of weird redistributables on top, real mess. Takes ages to start too. VS code is small, compact <100MB install with everything working well out of the box, and no mess on your PC.

VS will definitely be better for full time developers, but for occassional addon scripters, VS Code is much better choice.

1 Like

Definetly not on MacOS where it is 200 MB , including the absolute necessary extension to make it comparable to VS. So I am assuming your <100MB is super bare bone.

Of course VS is going to be in GBs. There is absolutely no reason to go after a full install unless you plan to do web dev, xbox dev, C# dev, Android dev, IOT dev and a ton others VS supports and completely unrelated to Blender. For Blender you need around 6-7GBs which are basically the libraries needed to build those executables.

To give you an idea , the actually executable of XCode is 42kbs , I kid you NOT , the rest is libraries , plugins, secondary tools and much more. It totals a 7GB install.

The blender folder I have with only 2 builds is another 6 GBs. A single debug build for Blender is 3 Gbs alone compared to 1 Gb release build and those do not even come with CUDA kernel included. The lib folder that has all the libraries Blender depends (additional to the dev libraries getting with those IDEs) is another GB. CUDA runtime is a few GBs more.

So no VSC is not small, its just that it does not come with any libraries essential to build even the simplest projects. It does not even come with C/C++ support because it has to be installed as an extension.

If you dont like your IDE being in GBs range, stay away from native executable development.

PS: I only use VSC on MacOS and Linux cause I prefer it to alternatives so far. So this post is by no means me bashing VSC. Quite contrary I recommend it over XCode easily and I am very happy with it on Ubuntu too.

just used VSC today on my windows machine , which has VS already installed, it works fine. The process is exactly the same as the other OSes, I installed C++ extension and made two tasks one for building with “make” and one for debugging , it has ready setup for VS debugger.

I was wrong on fact that the VS debugger cannot be controlled by the debug console it can actually can , and inspecting values , pointers etc works fine.

The only problem was the terminal which is setup to use Powershell instead of the standard command line. I am not a fan because PS requires special syntax for make , so I went into settings and changed the internal terminal back to command line. The path string is already used for the external terminal which is kinda weird that externally it uses the standard command line but not internally.

Other than that , it needs no special setup and the tutorials you were watching are completely unnecessary. However I stress once more I did install VS and Blender requires VS anyway to build on Windows. But other than that you can use VSC 100%.

1 Like

Kilon : You have my question altogether wrong. I AM NOT trying to BUILD Blender from the C source. All I want to do is write BGE code and maybe python addon code in VSC and have it execute from VSC without having to save it in VSC, switch to the Blender text window, update the text window and then run from Blender each time. That is tedious. And maybe debug the code within VSC.

BGE is in C and part of building Blender. So no I did not get your question wrong. Python wise, is the same workflow.

I dont think you understand what I am talking about here. I never mentioned anything about a text editor, anywhere. In any case I did all I could to help you , from there on its up to you.

VS on Mac isn’t the same as VS on windows. Microsoft bought Xamarin and released Xamarin studio under the name of Visual studio for mac.

The OP is asking about python development as far as I can tell, so VS Code is perfect for the task.

Hi, would you tell some more on configuring VS Code with Blender /2.80/ ?
Got proper Debug addon, VS Code insider but cant make it work together…