Skip to content

Instantly share code, notes, and snippets.

baku89 /
Created November 1, 2015 14:48
Extract quaternion in right-hand rule from affine matrix in left-hand rules
import eulerangles
import c4d
threeMat = c4d.Matrix().Scale(c4d.Vector(1, 1, -1))
def mat2quat(mat):
mt = threeMat * m
v1, v2, v3 = mat.v1, mat.v2, mat.v3
rotMat = [
Squid3d /
Created March 5, 2015 03:46
using yield to iterate c4d object/tag and materials
import c4d
def walk_objects(obj):
if obj:
yield obj
for x in walk_objects(obj.GetDown()): # happily fail on tags and materials
yield x
for x in walk_objects(obj.GetNext()):
yield x