[Bf-blender-cvs] [834e026] alembic_basic_io: Cleanupo: de-duplicate some code.

Kévin Dietrich noreply at git.blender.org
Thu Jun 2 22:37:27 CEST 2016


Commit: 834e026ec3544df1e6b42d8f4750e42d1e0b8364
Author: Kévin Dietrich
Date:   Thu Jun 2 19:02:53 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB834e026ec3544df1e6b42d8f4750e42d1e0b8364

Cleanupo: de-duplicate some code.

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

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

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

diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index 447536a..24b20c0 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -422,13 +422,6 @@ static void visit_object(const IObject &object,
 	}
 }
 
-static void create_readers(IArchive &archive,
-                           std::vector<AbcObjectReader *> &readers,
-                           ImportSettings &settings)
-{
-	visit_object(archive.getTop(), readers, settings);
-}
-
 static Object *find_object(Scene *scene, const std::string &name)
 {
 	Base *base;
@@ -501,7 +494,7 @@ static void import_startjob(void *cjv, short *stop, short *do_update, float *pro
 	*data->progress = 0.05f;
 
 	std::vector<AbcObjectReader *> readers;
-	create_readers(archive, readers, data->settings);
+	visit_object(archive.getTop(), readers, data->settings);
 
 	*data->do_update = true;
 	*data->progress = 0.1f;
@@ -562,61 +555,29 @@ void ABC_import(bContext *C, const char *filepath, float scale, bool is_sequence
 
 /* ******************************* */
 
-static IXform get_xform(const IObject &object, const std::string &name, bool &found, bool &locator)
+void ABC_get_transform(Object *ob, const char *filepath, const char *object_path, float r_mat[4][4], float time)
 {
-	locator = false;
-
-	if (!object.valid()) {
-		return IXform();
-	}
-
-	std::vector<std::string> tokens;
-	split(name, '/', tokens);
-
-	IObject tmp = object;
-
-	std::vector<std::string>::iterator iter;
-	for (iter = tokens.begin(); iter != tokens.end(); ++iter) {
-		IObject child = tmp.getChild(*iter);
-
-		if (!child.valid()) {
-			continue;
-		}
-
-		tmp = child;
-	}
+	IArchive archive = open_archive(filepath);
 
-	if (!tmp.valid()) {
-		return IXform();
+	if (!archive.valid()) {
+		return;
 	}
 
-	found = true;
+	IObject tmp;
+	find_iobject(archive.getTop(), tmp, object_path);
 
-#if 1
-	const MetaData &md = tmp.getMetaData();
+	IXform ixform;
 
-	if (IXform::matches(md)/* && is_locator(tmp)*/) {
-		return IXform(tmp, kWrapExisting);
+	if (IXform::matches(tmp.getHeader())) {
+		ixform = IXform(tmp, kWrapExisting);
 	}
-#endif
-
-	return IXform(tmp.getParent(), kWrapExisting);
-}
-
-void ABC_get_transform(Object *ob, const char *filepath, const char *object_path, float r_mat[4][4], float time)
-{
-	IArchive archive = open_archive(filepath);
-
-	if (!archive.valid()) {
-		return;
+	else {
+		ixform = IXform(tmp.getParent(), kWrapExisting);
 	}
 
-	bool found = false;
-	bool locator = false;
-	const IXform ixform = get_xform(archive.getTop(), object_path, found, locator);
-	const IXformSchema xform_schema = ixform.getSchema();
+	IXformSchema schema = ixform.getSchema();
 
-	if (!found || !xform_schema.valid()) {
+	if (!!schema.valid()) {
 		return;
 	}




More information about the Bf-blender-cvs mailing list