[Bf-committers] C++ DLL in blender modifier

Henrique Nunes Jung henriquenj at gmail.com
Sun Jun 12 21:44:01 CEST 2016


Hello Lukas

I have done something related a couple of weeks ago. I didn't implemented a
modifier, instead I implemented a RenderEngine. My engine is written in
C++, so I created a C wrapper around it and called from Blender using
ctypes [1]. I didn't understand how you are calling your C functions, from
what I  recall __declspec is just to make your functions available as entry
points on the DLL. Anyway I suggest you to take a look at ctypes, because I
have successfully use it to call C functions using python from Blender. You
can look at my plugin at github[2].

Hope it helps
Henrique Jung

[1] https://docs.python.org/3.5/library/ctypes.html
[2] https://github.com/henriquenj/rendergirl/tree/master/BlenderPlugin

On 11 June 2016 at 17:08, Lukas Gersthofer <lukasgersthofer at gmail.com>
wrote:

> Dear Blender Dev community,
>
> I encountered a problem while implementing a new modifier. The modifier
> aims at optimizing the physical properties (center of mass, moments of
> inertia, etc.) of a shape. After 3D printing the model is able to stand in
> an upright position, rotate around a given axis, etc. (see
>
> https://www.cg.tuwien.ac.at/research/publications/2015/musialski-2015-souos/musialski-2015-souos-preprint.pdf
> )
> The implementation of the algorithm is in C++ and I created a DLL which has
> a C API as well. Now I wanted to integrate the algorithm into blender as a
> modifier. The modifier is almost done but the API call doesn't work
> properly. There are no errors but the return values are random bullshit.
> The calling convention I use is __declspec.
>
> If you need further insight into the code, I can share my repository with
> you. The algorithm is going to be open source as soon as all features are
> implemented and are working properly.
>
> I would really appreciate a helpful anwer cause I'm really struggling with
> this problem and because it is my bachelor thesis I wanted to try
> everything to finish it!
>
> --
> mit freundlichen Grüßen / with kind regards
>
> Lukas Gersthofer
> Vienna University of Technology
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> https://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list