[Bf-blender-cvs] [4ef7ad1] gooseberry: Simple inclusion of alembic files from inside xml files for cycles standalone.

Lukas Tönne noreply at git.blender.org
Mon Mar 23 13:04:44 CET 2015


Commit: 4ef7ad13fa833e7ec321dbe2521b457be2591981
Author: Lukas Tönne
Date:   Sun Mar 22 13:26:46 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB4ef7ad13fa833e7ec321dbe2521b457be2591981

Simple inclusion of alembic files from inside xml files for cycles
standalone.

The cycles XML files now can refer to Alembic (.abc) files. This will
call the default alembic reader to read in scene data. Currently it
simply prints the Alembic file structure.

Eventually a proper schema needs to be defined for both xml and abc.
Also care has to be taken to handle potential conflicts between settings
both within xml/abc and between them.

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

M	intern/cycles/app/cycles_xml.cpp

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

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 05e3438..471f08e 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -42,6 +42,9 @@
 #include "util_xml.h"
 
 #include "cycles_xml.h"
+#ifdef WITH_ALEMBIC
+#include "cycles_alembic.h"
+#endif
 
 CCL_NAMESPACE_BEGIN
 
@@ -1109,6 +1112,25 @@ static void xml_read_state(XMLReadState& state, pugi::xml_node node)
 		state.displacement_method = Mesh::DISPLACE_BOTH;
 }
 
+/* Alembic */
+static void xml_read_alembic(const XMLReadState& state, pugi::xml_node node)
+{
+#ifdef WITH_ALEMBIC
+	string filepath;
+	
+	if(xml_read_string(&filepath, node, "file")) {
+		filepath = path_join(state.base, filepath);
+		
+		if(xml_equal_string(node, "type", "hdf5"))
+			abc_read_hdf5_file(state.scene, filepath.c_str());
+		else if(xml_equal_string(node, "type", "ogawa"))
+			abc_read_ogawa_file(state.scene, filepath.c_str());
+		else
+			abc_read_ogawa_file(state.scene, filepath.c_str()); /* default */
+	}
+#endif
+}
+
 /* Scene */
 
 static void xml_read_include(const XMLReadState& state, const string& src);
@@ -1158,6 +1180,9 @@ static void xml_read_scene(const XMLReadState& state, pugi::xml_node scene_node)
 			if(xml_read_string(&src, node, "src"))
 				xml_read_include(state, src);
 		}
+		else if(string_iequals(node.name(), "alembic")) {
+			xml_read_alembic(state, node);
+		}
 		else
 			fprintf(stderr, "Unknown node \"%s\".\n", node.name());
 	}




More information about the Bf-blender-cvs mailing list