Commit: 091ef60e48b5b7fa6567d243f2f938c8874ff671
Author: Kévin Dietrich
Date:   Tue May 19 20:41:41 2015 +0200
Branches: openvdb
https://developer.blender.org/rB091ef60e48b5b7fa6567d243f2f938c8874ff671

Initial support for rendering vdb file sequences.

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

M       intern/cycles/blender/blender_shader.cpp
M       source/blender/editors/space_node/drawnode.c
M       source/blender/makesdna/DNA_node_types.h
M       source/blender/makesrna/intern/rna_nodetree.c

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

diff --git a/intern/cycles/blender/blender_shader.cpp 
b/intern/cycles/blender/blender_shader.cpp
index 8096f46..8bb7378 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -742,6 +742,18 @@ static ShaderNode *add_node(Scene *scene,
                vdb_node->filename = b_vdb_node.filename();
                vdb_node->sampling = b_vdb_node.sampling();
 
+               /* TODO(kevin) */
+               if(b_vdb_node.source() == 1) {
+                       string filename = b_vdb_node.filename();
+                       string basename = filename.substr(0, filename.size() - 
8);
+                       stringstream ss;
+                       ss << b_scene.frame_current();
+                       string frame = ss.str();
+                       frame.insert(frame.begin(), 4 - frame.size(), '0');
+
+                       vdb_node->filename = ustring::format("%s%s.vdb", 
basename, frame);
+               }
+
                BL::Node::outputs_iterator b_output;
 
                for(b_vdb_node.outputs.begin(b_output); b_output != 
b_vdb_node.outputs.end(); ++b_output) {
diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index b2939ea..3851e69 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -972,6 +972,7 @@ static void node_shader_buts_openvdb(uiLayout *layout, 
bContext *C, PointerRNA *
 
        uiItemR(layout, ptr, "filename", 0, "", 0);
        uiItemR(layout, ptr, "sampling", 0, "", 0);
+       uiItemR(layout, ptr, "source", 0, "", 0);
 
        UNUSED_VARS(C);
 }
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 32afee7..e77ee28 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -857,7 +857,7 @@ typedef struct NodeShaderUVMap {
 
 typedef struct NodeShaderOpenVDB {
        char filename[1024];
-       int sampling;
+       short sampling, source;
 } NodeShaderOpenVDB;
 
 enum {
@@ -865,6 +865,11 @@ enum {
        NODE_VDB_SAMPLE_BOX   = 1,
 };
 
+enum {
+       NODE_VDB_SRC_FILE = 0,
+       NODE_VDB_SRC_SEQ  = 1,
+};
+
 typedef struct NodeSunBeams {
        float source[2];
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 6cf9715..f0d2bd1 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3902,6 +3902,12 @@ static void def_sh_openvdb(StructRNA *srna)
                {0, NULL, 0, NULL, NULL}
        };
 
+       static const EnumPropertyItem prop_openvdb_source[] = {
+               {NODE_VDB_SRC_FILE, "FILE", 0, "Single File", "Single vdb 
file"},
+               {NODE_VDB_SRC_SEQ, "SEQUENCE", 0, "File Sequence", "Multiple 
vdb files, as a sequence"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        RNA_def_struct_sdna_from(srna, "NodeShaderOpenVDB", "storage");
 
        prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
@@ -3913,6 +3919,11 @@ static void def_sh_openvdb(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Sampling", "Grid interpolation");
        RNA_def_property_update(prop, 0, "rna_Node_update");
 
+       prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_openvdb_source);
+       RNA_def_property_ui_text(prop, "Source", "File Source");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
+
        RNA_def_struct_sdna_from(srna, "bNode", NULL);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to