[Bf-blender-cvs] [8c23f5e] alembic_basic_io: Avoid looking up parent's matrix if the object is not a locator or a leaf transform.

Kévin Dietrich noreply at git.blender.org
Tue May 31 01:51:12 CEST 2016


Commit: 8c23f5e78b8469eaebf29d3b913aa2f953c77601
Author: Kévin Dietrich
Date:   Mon May 30 19:23:35 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB8c23f5e78b8469eaebf29d3b913aa2f953c77601

Avoid looking up parent's matrix if the object is not a locator or a
leaf transform.

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

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

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

diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index e60c354..110aa05 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -204,6 +204,13 @@ void create_transform_matrix(float r_mat[4][4])
     copy_m4_m4(r_mat, transform_mat);
 }
 
+/* Return whether or not this object is a Maya locator, which is similar to
+ * empties used as parent object in Blender. */
+bool is_locator(const Alembic::AbcGeom::IObject &object)
+{
+	return object.getProperties().getPropertyHeader("locator") != NULL;
+}
+
 static void get_matrix(const Alembic::AbcGeom::ISampleSelector &sample_sel,
                        const Alembic::AbcGeom::IXform &leaf, Imath::M44d &m)
 {
@@ -222,6 +229,10 @@ static void get_matrix(const Alembic::AbcGeom::ISampleSelector &sample_sel,
 		return;
 	}
 
+	if (!is_locator(leaf) || (leaf.getNumChildren() != 0)) {
+		return;
+	}
+
 	Alembic::AbcGeom::IXform parent(obj, Alembic::AbcGeom::kWrapExisting);
 	Alembic::AbcGeom::IXformSchema parent_schema = parent.getSchema();
     Alembic::AbcGeom::XformSample parent_xs;
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index 32de50d..cab36a9 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -49,6 +49,8 @@ bool begins_with(const TContainer &input, const TContainer &match)
 	        && std::equal(match.begin(), match.end(), input.begin());
 }
 
+bool is_locator(const Alembic::AbcGeom::IObject &object);
+
 void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel,
                             const Alembic::AbcGeom::IXform &ixform, Object *ob,
                             float r_mat[4][4]);
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index f96be72..42359d7 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -349,13 +349,6 @@ int ABC_export(Scene *scene, bContext *C, const char *filename,
 
 /* ********************** Import file ********************** */
 
-/* Return whether or not this object is a Maya locator, which is similar to
- * empties used as parent object in Blender. */
-static bool is_locator(const IObject &object)
-{
-	return object.getProperties().getPropertyHeader("locator") != NULL;
-}
-
 static void visit_object(const IObject &object,
                          std::vector<AbcObjectReader *> &readers,
                          ImportSettings &settings)




More information about the Bf-blender-cvs mailing list