Cycles XML API: * Add Bump and Holdout Node * Add todo comments for various things...
authorThomas Dinges <blender@dingto.org>
Thu, 21 May 2015 19:56:42 +0000 (21:56 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 1 Jun 2015 14:56:39 +0000 (19:56 +0500)
intern/cycles/app/cycles_xml.cpp

index 53262b93dd0817795ad5e473b4ae59d979e48229..eee64394471dcb18b58a26aa4ca65bdd3d32197b 100644 (file)
@@ -391,6 +391,10 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
        for(pugi::xml_node node = graph_node.first_child(); node; node = node.next_sibling()) {
                ShaderNode *snode = NULL;
 
+               /* ToDo: Add missing nodes
+                * RGBCurvesNode, VectorCurvesNode, RGBRampNode and ConvertNode (RGB -> BW).
+                */
+
                if(string_iequals(node.name(), "image_texture")) {
                        ImageTextureNode *img = new ImageTextureNode();
 
@@ -401,6 +405,8 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
                        xml_read_enum(&img->projection, ImageTextureNode::projection_enum, node, "projection");
                        xml_read_float(&img->projection_blend, node, "projection_blend");
 
+                       /* ToDo: Interpolation */
+
                        snode = img;
                }
                else if(string_iequals(node.name(), "environment_texture")) {
@@ -513,6 +519,11 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
                        xml_read_float3(&normal->direction, node, "direction");
                        snode = normal;
                }
+               else if(string_iequals(node.name(), "bump")) {
+                       BumpNode *bump = new BumpNode();
+                       xml_read_bool(&bump->invert, node, "invert");
+                       snode = bump;
+               }
                else if(string_iequals(node.name(), "mapping")) {
                        snode = new MappingNode();
                }
@@ -567,6 +578,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
                else if(string_iequals(node.name(), "background")) {
                        snode = new BackgroundNode();
                }
+               else if(string_iequals(node.name(), "holdout")) {
+                       snode = new HoldoutNode();
+               }
                else if(string_iequals(node.name(), "absorption_volume")) {
                        snode = new AbsorptionVolumeNode();
                }
@@ -575,7 +589,14 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
                }
                else if(string_iequals(node.name(), "subsurface_scattering")) {
                        SubsurfaceScatteringNode *sss = new SubsurfaceScatteringNode();
-                       //xml_read_enum(&sss->falloff, SubsurfaceScatteringNode::falloff_enum, node, "falloff");
+
+                       string falloff;
+                       xml_read_string(&falloff, node, "falloff");
+                       if(falloff == "cubic")
+                               sss->closure = CLOSURE_BSSRDF_CUBIC_ID;
+                       else
+                               sss->closure = CLOSURE_BSSRDF_GAUSSIAN_ID;
+
                        snode = sss;
                }
                else if(string_iequals(node.name(), "geometry")) {
@@ -619,6 +640,7 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
                        snode = new InvertNode();
                }
                else if(string_iequals(node.name(), "mix")) {
+                       /* ToDo: Tag Mix case for optimization */
                        MixNode *mix = new MixNode();
                        xml_read_enum(&mix->type, MixNode::type_enum, node, "type");
                        xml_read_bool(&mix->use_clamp, node, "use_clamp");