[Bf-blender-cvs] [ac38d5652b] master: Alembic export: avoid infinite loops trying to find parent objects.

Sybren A. Stüvel noreply at git.blender.org
Wed Feb 8 12:52:23 CET 2017


Commit: ac38d5652be1119934a2bb472f76070bd4b8789d
Author: Sybren A. Stüvel
Date:   Wed Feb 8 11:50:21 2017 +0100
Branches: master
https://developer.blender.org/rBac38d5652be1119934a2bb472f76070bd4b8789d

Alembic export: avoid infinite loops trying to find parent objects.

Also added some assertions for debugging purposes

Reviewed by: Kévin Dietrich

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

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

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

diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 896292418e..d17506ff8b 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -413,6 +413,10 @@ void AbcExporter::createTransformWriter(Object *ob, Object *parent, Object *dupl
 {
 	const std::string name = get_object_dag_path_name(ob, dupliObParent);
 
+	/* An object should not be its own parent, or we'll get infinite loops. */
+	BLI_assert(ob != parent);
+	BLI_assert(ob != dupliObParent);
+
 	/* check if we have already created a transform writer for this object */
 	if (getXForm(name) != NULL){
 		std::cerr << "xform " << name << " already exists\n";
@@ -429,6 +433,14 @@ void AbcExporter::createTransformWriter(Object *ob, Object *parent, Object *dupl
 			if (parent->parent) {
 				createTransformWriter(parent, parent->parent, dupliObParent);
 			}
+			else if (parent == dupliObParent) {
+				if (dupliObParent->parent == NULL) {
+					createTransformWriter(parent, NULL, NULL);
+				}
+				else {
+					createTransformWriter(parent, dupliObParent->parent, dupliObParent->parent);
+				}
+			}
 			else {
 				createTransformWriter(parent, dupliObParent, dupliObParent);
 			}




More information about the Bf-blender-cvs mailing list