blurstudio / TwistSpline

A smoothly reparameterizing Bezier spline that also interpolates orientations
MIT License
96 stars 43 forks source link

Wrapping with Pybind11 #21

Open munkybutt opened 3 years ago

munkybutt commented 3 years ago

Hey - I saw this project on tech artists and thought it was super nifty. I am a big fan of the agnostic backend, really nice to see thoughts of DCCs other than Maya - so I figured I would try and integrate this into Blender.

As blender doesn't expose a c++ sdk, I have to expose it via python. I thought this was annoying at first but then realised that it could make integration to any other DCC that uses python easier, potentially avoiding the need for c++ integration all together.

I am using Pybind11 to do the bindings and my current thought is to use numpy arrays as the object types for the point, vector, quat and array template classes, this should be beneficial in a couple of ways:

I have had one issue so far, with the template size function in TwistSpline.h which attempts to override a size function in the Pybind11 API. This raises a compile error so I have had to change the name to getSize to avoid the conflict.

This has let me get as far as wrapping TwistSpline and it's constructor and creating a python instance in blender ( which is pretty exciting ), but I am having issues when attempting to expose any of the methods which might require some tweaks - if you agree that using numpy is a sensible idea.

I could potentially extend TwistSpline and wrap said extended class if you would prefer not to accept any of the changes, but my c++ knowledge is relatively novice and extra abstraction is best avoided in most scenarios.

Let me know your thoughts!

Cheers,

Shea.