|
@@ -39,38 +39,6 @@ bl_info = {
|
|
|
}
|
|
|
|
|
|
|
|
|
-# -------------------------------------------------------------------
|
|
|
-# Convert Data Functions
|
|
|
-# -------------------------------------------------------------------
|
|
|
-def convert_loc(x):
|
|
|
- return u * Vector([x[0], -x[2], x[1]])
|
|
|
-
|
|
|
-
|
|
|
-def convert_quat(q):
|
|
|
- return Quaternion([q[3], q[0], -q[2], q[1]])
|
|
|
-
|
|
|
-
|
|
|
-def convert_scale(s):
|
|
|
- return Vector([s[0], s[2], s[1]])
|
|
|
-
|
|
|
-
|
|
|
-def local_rotation(obj, rotation_before, rot):
|
|
|
- """Appends a local rotation to vnode's world transform:
|
|
|
- (new world transform) = (old world transform) @ (rot)
|
|
|
- without changing the world transform of vnode's children.
|
|
|
-
|
|
|
- For correctness, rot must be a signed permutation of the axes
|
|
|
- (eg. (X Y Z)->(X -Z Y)) OR vnode's scale must always be uniform.
|
|
|
- """
|
|
|
- rotation_before = Quaternion((1, 0, 0, 0))
|
|
|
- obj.rotation_before @= rot
|
|
|
-
|
|
|
- # # Append the inverse rotation after children's TRS to cancel it out.
|
|
|
- # rot_inv = rot.conjugated()
|
|
|
- # for child in gltf.vnodes[vnode_id].children:
|
|
|
- # gltf.vnodes[child].rotation_after = rot_inv @ gltf.vnodes[child].rotation_after
|
|
|
-
|
|
|
-
|
|
|
# -------------------------------------------------------------------
|
|
|
# Functions
|
|
|
# -------------------------------------------------------------------
|