Search code examples
c#c++blendergame-maker-studio-2

Blender - commands in C# C++


I got a task to establish GMS2 -> Blender one way communication. Dll extending GMS2 needs to be written either in C# or C++. Problem with Blender is that it has no ports like Maya has. So I tought about a solution via sockets but not sure if that is the right way.

I don't request any code, just herebly asking for a pointer (pun).


Solution

  • Blender uses python to create addons, a python addon can be created that opens a socket and alters the internal data. One example would be the network render addon that is included with blender. You can also use the subprocess module to pipe data from an external program, see this question.

    If you need to use C/C++ within the addon, you have several options. An addon for blender is a standard python module - with some required methods and properties. A python module can be a dynamic library compiled from C/C++. You can also use ctypes to access standard libraries from python code. Another option is to create a basic addon and use cython to turn it into C code which you can then add your code to, cube surfer and animation nodes are example addons that use cython to compile a shared library.