Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-03-22 16:23:33 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-03-22 16:23:33 +0300
commit4b451838ede700d48ceaf0b7d93cd737808f9bc5 (patch)
tree4fc2e0e9bd3c4f32ea6e6ee139e4d3a1b3016937
parentc27ef5692c2d155fc25efe2a26fb81b80ffae42f (diff)
More control over verbosity with Alembic archive info printing.
-rw-r--r--intern/cycles/app/cycles_alembic.cpp29
-rw-r--r--intern/cycles/app/cycles_alembic.h11
-rw-r--r--intern/cycles/app/cycles_xml.cpp6
3 files changed, 30 insertions, 16 deletions
diff --git a/intern/cycles/app/cycles_alembic.cpp b/intern/cycles/app/cycles_alembic.cpp
index c801dd43140..5bae8ee53c4 100644
--- a/intern/cycles/app/cycles_alembic.cpp
+++ b/intern/cycles/app/cycles_alembic.cpp
@@ -186,7 +186,7 @@ static void visitProperties(std::stringstream &ss, ICompoundProperty iParent, st
ioIndent = oldIndent;
}
-static void visitObject(std::stringstream &ss, IObject iObj, std::string iIndent)
+static void visitObject(std::stringstream &ss, IObject iObj, std::string iIndent, AbcArchiveInfoLevel info_level)
{
// Object has a name, a full name, some meta data,
// and then it has a compound property full of properties.
@@ -208,18 +208,20 @@ static void visitObject(std::stringstream &ss, IObject iObj, std::string iIndent
ss << "Object " << "name=" << path << std::endl;
}
- // Get the properties.
- ICompoundProperty props = iObj.getProperties();
- visitProperties(ss, props, iIndent);
+ if (info_level >= ABC_INFO_PROPERTIES) {
+ // Get the properties.
+ ICompoundProperty props = iObj.getProperties();
+ visitProperties(ss, props, iIndent);
+ }
// now the child objects
for (size_t i = 0 ; i < iObj.getNumChildren() ; i++) {
- visitObject(ss, IObject(iObj, iObj.getChildHeader(i).getName()), iIndent);
+ visitObject(ss, IObject(iObj, iObj.getChildHeader(i).getName()), iIndent, info_level);
}
}
}
-static std::string abc_archive_info(IArchive &archive)
+static std::string abc_archive_info(IArchive &archive, AbcArchiveInfoLevel info_level)
{
std::stringstream ss;
@@ -253,12 +255,15 @@ static std::string abc_archive_info(IArchive &archive)
ss << std::endl;
}
- visitObject(ss, archive.getTop(), "");
+ if (info_level >= ABC_INFO_OBJECTS)
+ visitObject(ss, archive.getTop(), "", info_level);
return ss.str();
}
-void abc_read_ogawa_file(Scene *scene, const char *filepath)
+/* ========================================================================= */
+
+void abc_read_ogawa_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level)
{
IArchive archive;
ABC_SAFE_CALL_BEGIN
@@ -266,11 +271,12 @@ void abc_read_ogawa_file(Scene *scene, const char *filepath)
ABC_SAFE_CALL_END
if (archive) {
- printf("%s", abc_archive_info(archive).c_str());
+ if (info_level >= ABC_INFO_BASIC)
+ printf("%s", abc_archive_info(archive, info_level).c_str());
}
}
-void abc_read_hdf5_file(Scene *scene, const char *filepath)
+void abc_read_hdf5_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level)
{
#ifdef WITH_HDF5
IArchive archive;
@@ -279,7 +285,8 @@ void abc_read_hdf5_file(Scene *scene, const char *filepath)
ABC_SAFE_CALL_END
if (archive) {
- printf(abc_archive_info(archive));
+ if (info_level >= ABC_INFO_BASIC)
+ printf("%s", abc_archive_info(archive, info_level).c_str());
}
#endif
}
diff --git a/intern/cycles/app/cycles_alembic.h b/intern/cycles/app/cycles_alembic.h
index 761058bdb8c..df17f8b8fbe 100644
--- a/intern/cycles/app/cycles_alembic.h
+++ b/intern/cycles/app/cycles_alembic.h
@@ -21,8 +21,15 @@ CCL_NAMESPACE_BEGIN
class Scene;
-void abc_read_ogawa_file(Scene *scene, const char *filepath);
-void abc_read_hdf5_file(Scene *scene, const char *filepath);
+enum AbcArchiveInfoLevel {
+ ABC_INFO_NONE = 0,
+ ABC_INFO_BASIC,
+ ABC_INFO_OBJECTS,
+ ABC_INFO_PROPERTIES,
+};
+
+void abc_read_ogawa_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level = ABC_INFO_NONE);
+void abc_read_hdf5_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level = ABC_INFO_NONE);
CCL_NAMESPACE_END
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 471f08e78d0..a0a9b9e8b14 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -1122,11 +1122,11 @@ static void xml_read_alembic(const XMLReadState& state, pugi::xml_node node)
filepath = path_join(state.base, filepath);
if(xml_equal_string(node, "type", "hdf5"))
- abc_read_hdf5_file(state.scene, filepath.c_str());
+ abc_read_hdf5_file(state.scene, filepath.c_str(), ABC_INFO_BASIC);
else if(xml_equal_string(node, "type", "ogawa"))
- abc_read_ogawa_file(state.scene, filepath.c_str());
+ abc_read_ogawa_file(state.scene, filepath.c_str(), ABC_INFO_BASIC);
else
- abc_read_ogawa_file(state.scene, filepath.c_str()); /* default */
+ abc_read_ogawa_file(state.scene, filepath.c_str(), ABC_INFO_BASIC); /* default */
}
#endif
}