Cortex-vfx blender python module
Needs RevisionPublic

Authored by Dan Eicher (dna) on Mar 23 2014, 3:10 AM.

Details

Reviewers
None
Summary

This patch adds WITH_CORTEX to CMake to build an _IECoreBlender.so module that can be imported into the embedded python interpreter to interface with cortex's IECore python module (after patching cortex for py3k support). Other than one call to BPy_GetContext (which would be nice to get rid of since it breaks being able to use it with bpy.so) it uses the C++ api exclusively for blender data access.

So far I've implemented exporters for meshes, point meshes and cameras but adding other types is fairly trivial at this point. Will add importers eventually too.

Still a bit of a WIP but functional enough to share so here we go.

Diff Detail

Cortex py3k patch.

Campbell Barton (campbellbarton) requested changes to this revision.Feb 4 2015, 8:53 PM

This looks to be something limited to being useful to Python scripters, and not more generally so useful for blender in its current state.

Its unlikely we'd accept the patch unless it gives really significant advantages.

Was any effort made to use cortex-python as a standalone module? - could you explain why Blender integration is needed?

This revision now requires changes to proceed.Feb 4 2015, 8:53 PM

This looks to be something limited to being useful to Python scripters, and not more generally so useful for blender in its current state.

Its unlikely we'd accept the patch unless it gives really significant advantages.

Was any effort made to use cortex-python as a standalone module? - could you explain why Blender integration is needed?

This just hooks into CMake to build a C python module that uses the makesrna C++ api to convert blender to cortex data types. Doesn't really need to be in Blender at all tbh, most of the testing building was done with a python build script (and crazy long hardcoded include paths). Once the module is built it's the same as any other py-module with the exception that it only works in blender due to needing to link to the compiled in symbols.

Cortex comes with _IECoreMaya.so, _IECoreHoudini.so, etc, etc, py-modules and this adds a basic _IECoreBlender.so to the set.

This was mostly just a proof of concept and/or an easy way to build the module -- if anyone wants an example of how to use the C++ api for renderer exporters and whatnot then here's one...