Cinema 4D Python Binaries

Original entry at old.niklasrosenstein.com.


You can find a bunch of binary distributions of popular Python modules on my public folder. These are compiled to be working with Cinema 4D. Keep in mind that Cinema 4D R17+ embeds CPython 2.7 so you’ll need py2.7 named binaries instead of py2.6. The packages can be installed to your Cinema 4D preferences under library/python/packages/{os}.

https://public.niklasrosenstein.com/cinema4d/python/modules/

Disclaimer

The binary packages are provided as-is. There might be missing distributions for specific versions or platforms. Topics on the PluginCafe that might interest you regarding third party modules:

Example

import c4d
import numpy

def vector2numpy(v):
    return numpy.array([v.x, v.y, v.z])

def numpy2vector(a):
    if a.shape != (3,):
        raise ValueError('not a 3x1 array')
    return c4d.Vector(a[0], a[1], a[2])

def matrix2numpy(m):
    v0, v1, v2, v3 = m.off, m.v1, m.v2, m.v3
    return numpy.array([
        [1, 0, 0, 0],
        [v0.x, v1.x, v2.x, v3.x],
        [v0.z, v1.y, v2.y, v3.y],
        [v0.y, v1.z, v2.z, v3.z],
    ])

def numpy2matrix(a):
    if a.shape != (4, 4):
        raise ValueError('not a 4x4 array')
    return c4d.Matrix(
        c4d.Vector(a[1][0], a[2][0], a[3][0]),
        c4d.Vector(a[1][1], a[2][1], a[3][1]),
        c4d.Vector(a[1][2], a[2][2], a[3][2]),
        c4d.Vector(a[1][3], a[2][3], a[3][3]),
    )

Updates

comments powered by Disqus