diff options
Diffstat (limited to 'intern/cycles/app/cycles_standalone.cpp')
-rw-r--r-- | intern/cycles/app/cycles_standalone.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index b0d49d6ee72..3980ca547c2 100644 --- a/intern/cycles/app/cycles_standalone.cpp +++ b/intern/cycles/app/cycles_standalone.cpp @@ -38,13 +38,23 @@ #endif #include "cycles_xml.h" +#ifdef WITH_ALEMBIC +#include "cycles_alembic.h" +#endif CCL_NAMESPACE_BEGIN +enum FileType { + FILETYPE_XML = 0, + FILETYPE_ABC_HDF5, + FILETYPE_ABC_OGAWA, +}; + struct Options { Session *session; Scene *scene; string filepath; + FileType filetype; int width, height; SceneParams scene_params; SessionParams session_params; @@ -121,8 +131,22 @@ static void scene_init() { options.scene = new Scene(options.scene_params, options.session_params.device); - /* Read XML */ - xml_read_file(options.scene, options.filepath.c_str()); + /* Read file */ + switch (options.filetype) { + case FILETYPE_XML: + xml_read_file(options.scene, options.filepath.c_str()); + break; +#ifdef WITH_ALEMBIC + case FILETYPE_ABC_OGAWA: + abc_read_ogawa_file(options.scene, options.filepath.c_str()); + break; + case FILETYPE_ABC_HDF5: + abc_read_hdf5_file(options.scene, options.filepath.c_str()); + break; +#endif + default: + return; + } /* Camera width/height override? */ if(!(options.width == 0 || options.height == 0)) { @@ -356,6 +380,16 @@ static void options_parse(int argc, const char **argv) /* shading system */ string ssname = "svm"; + /* input file type */ + string filetypes = "auto, xml"; +#ifdef WITH_ALEMBIC + filetypes += ", alembic_ogawa"; +#ifdef WITH_HDF5 + filetypes += ", alembic_hdf5"; +#endif +#endif + string filetype = "auto"; + /* parse options */ ArgParse ap; bool help = false, debug = false; @@ -371,6 +405,7 @@ static void options_parse(int argc, const char **argv) "--quiet", &options.quiet, "In background mode, don't print progress messages", "--samples %d", &options.session_params.samples, "Number of samples to render", "--output %s", &options.session_params.output_path, "File path to write output image", + "--filetype %s", &filetype, ("File type: " + filetypes).c_str(), "--threads %d", &options.session_params.threads, "CPU Rendering Threads", "--width %d", &options.width, "Window width in pixel", "--height %d", &options.height, "Window height in pixel", @@ -416,6 +451,21 @@ static void options_parse(int argc, const char **argv) else if(ssname == "svm") options.scene_params.shadingsystem = SHADINGSYSTEM_SVM; + if(filetype == "auto") { + string extension = options.filepath.substr(options.filepath.find_last_of(".") + 1); + + if (extension == "xml") + options.filetype = FILETYPE_XML; + else if (extension == "abc") + options.filetype = FILETYPE_ABC_OGAWA; + } + else if(filetype == "xml") + options.filetype = FILETYPE_XML; + else if(filetype == "alembic_ogawa") + options.filetype = FILETYPE_ABC_OGAWA; + else if(filetype == "alembic_hdf5") + options.filetype = FILETYPE_ABC_HDF5; + #ifndef WITH_CYCLES_STANDALONE_GUI options.session_params.background = true; #endif |