[Bf-blender-cvs] [5e86144cd3a] master: Alembic import: moved import-time scaling to different function

Sybren A. Stüvel noreply at git.blender.org
Thu Apr 6 16:52:22 CEST 2017


Commit: 5e86144cd3a75042a3691ad3c9a920a451df38b6
Author: Sybren A. Stüvel
Date:   Thu Mar 2 10:03:51 2017 +0100
Branches: master
https://developer.blender.org/rB5e86144cd3a75042a3691ad3c9a920a451df38b6

Alembic import: moved import-time scaling to different function

convert_matrix() now only converts from Imath::M44d to float[4][4] (taking
different camera orientations into account). Import-time scaling is now
performed by the caller.

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

M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_util.cc
M	source/blender/alembic/intern/abc_util.h

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

diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 763bc34a410..2c658716c3a 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -289,7 +289,7 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], const float time,
 	}
 
 	const Imath::M44d matrix = get_matrix(schema, time);
-	convert_matrix(matrix, m_object, r_mat, scale, has_alembic_parent);
+	convert_matrix(matrix, m_object, r_mat);
 
 	if (has_alembic_parent) {
 		/* In this case, the matrix in Alembic is in local coordinates, so
@@ -300,6 +300,13 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], const float time,
 		BLI_assert(m_object->parent);
 		mul_m4_m4m4(r_mat, m_object->parent->obmat, r_mat);
 	}
+	else {
+		/* Only apply scaling to root objects, parenting will propagate it. */
+		float scale_mat[4][4];
+		scale_m4_fl(scale_mat, scale);
+		mul_m4_m4m4(r_mat, r_mat, scale_mat);
+		mul_v3_fl(r_mat[3], scale);
+	}
 
 	is_constant = schema.isConstant();
 }
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 859d818e451..1536c475281 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -226,8 +226,7 @@ void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMod
 	mul_m4_m4m4(dst_mat, dst_mat, dst_scale_mat);
 }
 
-void convert_matrix(const Imath::M44d &xform, Object *ob,
-                    float r_mat[4][4], float scale, bool has_alembic_parent)
+void convert_matrix(const Imath::M44d &xform, Object *ob, float r_mat[4][4])
 {
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 4; ++j) {
@@ -242,14 +241,6 @@ void convert_matrix(const Imath::M44d &xform, Object *ob,
 	}
 
 	copy_m44_axis_swap(r_mat, r_mat, ABC_ZUP_FROM_YUP);
-
-	if (!has_alembic_parent) {
-		/* Only apply scaling to root objects, parenting will propagate it. */
-		float scale_mat[4][4];
-		scale_m4_fl(scale_mat, scale);
-		mul_m4_m4m4(r_mat, r_mat, scale_mat);
-		mul_v3_fl(r_mat[3], scale);
-	}
 }
 
 /* Recompute transform matrix of object in new coordinate system
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index 486d9384dee..92d2fcae7a9 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -63,8 +63,7 @@ bool begins_with(const TContainer &input, const TContainer &match)
 	        && std::equal(match.begin(), match.end(), input.begin());
 }
 
-void convert_matrix(const Imath::M44d &xform, Object *ob,
-                    float r_mat[4][4], float scale, bool has_alembic_parent = false);
+void convert_matrix(const Imath::M44d &xform, Object *ob, float r_mat[4][4]);
 
 template <typename Schema>
 void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max)




More information about the Bf-blender-cvs mailing list