Scripting Blender with C#
I'm trying to find a way to use C# to script blender, the reason is that i prefer languages less dynamic where the compiler and IDE can help me to write my code.
I don't think i can get rid of python i made a bit testing and i build a very basic sample, just to test that i can write and debug C# code and this code can be called from Blender (using Python), i share the project in case anyone is interested to tinker and hopefully can find a better way.
There are 3 projects in the Visual Studio Solution:
- BlenderCS - Base classes
- BlenderCSBuildPython - Build some necesary python classes from your C# code
- BlenderCSSample - A sample of how you would build an addon
github.com/jordirosa/BlenderCS
P.S: In case you want to build the sample you will need to change the path in the post build event for the BlenderCSSample project and install pythonnet in blender's python.
Regards :)
2 Comments
Hi @jordirosa, how to use your project ?
Hi, It's more a proof of concept than a project, if you're going to develop a serious addon i don't recommend to use it, in case you want to tinker you need to install pythonnet into the blender's python, then in the BlenderCSSample project change the path in the post build event to point to your path, when you build the project you'll get the C# dll file but also some python code, all of this files are the blender addon, once the addon is installed on blender you can connect to blender from visual studio to remote debug your C# code, if you can't get it working let me know the error you're getting and i will try to help.