[Bf-blender-cvs] [8c0a432] alembic_basic_io: Fix for accumulated camera specific transformations in a camera hierarchy.

Kévin Dietrich noreply at git.blender.org
Sat Jun 11 14:59:32 CEST 2016


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);




More information about the Bf-blender-cvs mailing list