diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-22 16:23:33 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-26 16:13:41 +0300 |
commit | ad85c05ae212273c9204e52d350379c2d4dbfe97 (patch) | |
tree | cbc8be9f036f7a31bf03e8043d1ee1d2f77947b5 /intern | |
parent | 902a747f60641a09dedd504e768fe94c407d693c (diff) |
More control over verbosity with Alembic archive info printing.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/app/cycles_alembic.cpp | 29 | ||||
-rw-r--r-- | intern/cycles/app/cycles_alembic.h | 11 | ||||
-rw-r--r-- | intern/cycles/app/cycles_xml.cpp | 6 |
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 } |