Creating a new blender plugin

Hi all,

I’m a totally newbie with Blender, but I have a large experience coding 3d related plugins for other packages, 3d apps, render engines and so.

Is there any guide/introduction to read concerning creating new c++ plugins? (not python addons!)

Regards, Víctor

I think no one ever tried to make a plugin for blender, python API is really complete and has direct acess to most features of the program, you can do pretty much anything with it.

Maybe you can try to make a C++ module to get the needed speed and wrap it though python, but I ain’t a good programmer and can not say how to do it.

There is no C++ api for blender. There use to be but no one was using it (2.4x series) so it was removed in the 2.5x series.

That being said there are a few things to be said:
… Coding a C++ plugin, what is the benefit of this over coding directly with blenders codebase? this will remove any restrictions you may have from an API.
… If you must have it as a addon, as jeandacosta mentioned, wrap it via python.

There’s no C++ api that’ll allow for a binary plugin, however since you have all the blender code there’s nothing stopping you from extending the code in C/C++ and sending a patch for inclusion in mainline blender.

@ideasman42 has some sample templates here

You can also write Python bindings for your C++ code and use them in a Python addon in Blender.
In Blender, you can get the memory address of a struct with the as_pointer() method and pass it to your C++ code. In C++ you can then cast the address back to the correct struct type and operate on it.

Note that this probably only works in some niche cases, not for everything (e.g. Blender images are probably hard or impossible to edit this way).

Anyway, this is how the LuxCore integration in Blender works:
There is the LuxCore Python API which offers a few functions to work with Blender memory.
LuxCore Python API
Blender related functions

Maybe it helps.

Thank you for your replies! My idea was about supporting a third party API made in C++ that is not opensourced neither free.

So the render engines like V-Ray are using the Python->C++ method? that should decrease the performance a lot!

Just remember about GPL licensing if you are integrating a third party program and distributing this plugin. the general method that commercial companies are using for integrating it is to communicate over a network connection between applications.

It’s not possible to write a plugin for Blender because Blender has not a plugin API only a python API. Blender source contributors are so rare that main blender devs have not bothered into creating one.

Generally be prepared to do a lot of head scratching because you will largely to have to read source that is not documented apart from a dozen of pages in blender that are outdated and it has very few comments.

GPL license is all about forcing to open source code so anything that want to keep the source code closed will simply not be allowed. So no closed source software can use Blender in any form or way. The only exception to this is Cycles which operates under a more free license. Note this is applies for both Python and C/C++ when they rely on any function or API of Blender.