Commit: 8c0a4324100efdc255317d4cd9bcf965bab1c457
Author: Kévin Dietrich
Date:   Sat Jun 11 12:01:32 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB8c0a4324100efdc255317d4cd9bcf965bab1c457

Fix for accumulated camera specific transformations in a camera
hierarchy.

Only apply the transform to the root camera.

===================================================================

M       source/blender/alembic/intern/abc_transform.cc

===================================================================

diff --git a/source/blender/alembic/intern/abc_transform.cc 
b/source/blender/alembic/intern/abc_transform.cc
index 0a1a531..b7c9993 100644
--- a/source/blender/alembic/intern/abc_transform.cc
+++ b/source/blender/alembic/intern/abc_transform.cc
@@ -39,6 +39,23 @@ using Alembic::AbcGeom::OXform;
 
 /* ************************************************************************** 
*/
 
+static bool has_parent_camera(Object *ob)
+{
+       if (!ob->parent) {
+               return false;
+       }
+
+       Object *parent = ob->parent;
+
+       if (parent->type == OB_CAMERA) {
+               return true;
+       }
+
+       return has_parent_camera(parent);
+}
+
+/* ************************************************************************** 
*/
+
 AbcTransformWriter::AbcTransformWriter(Object *ob,
                                        const OObject &abc_parent,
                                        AbcTransformWriter *parent,
@@ -81,7 +98,8 @@ void AbcTransformWriter::do_write()
        float mat[4][4];
        create_transform_matrix(m_object, mat);
 
-       if (m_object->type == OB_CAMERA) {
+       /* Only apply rotation to root camera, parenting will propagate it. */
+       if (m_object->type == OB_CAMERA && !has_parent_camera(m_object)) {
                float rot_mat[4][4];
                unit_m4(rot_mat);
                rotate_m4(rot_mat, 'X', -M_PI_2);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to