Fix Cycles to mostly work with render layer / depsgraph changes.
[blender.git] / intern / cycles / blender / blender_shader.cpp
index 7d3abe35b2005104c4504a9bdbad8b9e7963c906..15689ca2391cae42f0c96d531fc6b82970153b90 100644 (file)
@@ -235,8 +235,7 @@ static ShaderNode *add_node(Scene *scene,
                             BL::RenderEngine& b_engine,
                             BL::BlendData& b_data,
                             BL::Scene& b_scene,
-                            BL::ViewLayer b_view_layer,
-                            const bool background,
+                            const bool /*background*/,
                             ShaderGraph *graph,
                             BL::ShaderNodeTree& b_ntree,
                             BL::ShaderNode& b_node)
@@ -835,6 +834,8 @@ static ShaderNode *add_node(Scene *scene,
                node = uvm;
        }
        else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
+               /* TODO: fix point density to work with new view layer depsgraph */
+#if 0
                BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
                PointDensityTextureNode *point_density = new PointDensityTextureNode();
                point_density->filename = b_point_density_node.name();
@@ -874,6 +875,7 @@ static ShaderNode *add_node(Scene *scene,
                                transform_translate(-loc) * transform_scale(size) *
                                transform_inverse(get_transform(b_ob.matrix_world()));
                }
+#endif
        }
        else if(b_node.is_a(&RNA_ShaderNodeBevel)) {
                BL::ShaderNodeBevel b_bevel_node(b_node);
@@ -1006,7 +1008,6 @@ static void add_nodes(Scene *scene,
                       BL::RenderEngine& b_engine,
                       BL::BlendData& b_data,
                       BL::Scene& b_scene,
-                      BL::ViewLayer& b_view_layer,
                       const bool background,
                       ShaderGraph *graph,
                       BL::ShaderNodeTree& b_ntree,
@@ -1093,7 +1094,6 @@ static void add_nodes(Scene *scene,
                                          b_engine,
                                          b_data,
                                          b_scene,
-                                         b_view_layer,
                                          background,
                                          graph,
                                          b_group_ntree,
@@ -1141,7 +1141,6 @@ static void add_nodes(Scene *scene,
                                                b_engine,
                                                b_data,
                                                b_scene,
-                                               b_view_layer,
                                                background,
                                                graph,
                                                b_ntree,
@@ -1205,7 +1204,6 @@ static void add_nodes(Scene *scene,
                       BL::RenderEngine& b_engine,
                       BL::BlendData& b_data,
                       BL::Scene& b_scene,
-                      BL::ViewLayer& b_view_layer,
                       const bool background,
                       ShaderGraph *graph,
                       BL::ShaderNodeTree& b_ntree)
@@ -1215,7 +1213,6 @@ static void add_nodes(Scene *scene,
                  b_engine,
                  b_data,
                  b_scene,
-                 b_view_layer,
                  background,
                  graph,
                  b_ntree,
@@ -1225,7 +1222,7 @@ static void add_nodes(Scene *scene,
 
 /* Sync Materials */
 
-void BlenderSync::sync_materials(bool update_all)
+void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
 {
        shader_map.set_default(scene->default_surface);
 
@@ -1254,7 +1251,7 @@ void BlenderSync::sync_materials(bool update_all)
                        if(b_mat->use_nodes() && b_mat->node_tree()) {
                                BL::ShaderNodeTree b_ntree(b_mat->node_tree());
 
-                               add_nodes(scene, b_engine, b_data, b_scene, b_view_layer, !preview, graph, b_ntree);
+                               add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
                        }
                        else {
                                DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
@@ -1325,7 +1322,7 @@ void BlenderSync::sync_world(bool update_all)
                if(b_world && b_world.use_nodes() && b_world.node_tree()) {
                        BL::ShaderNodeTree b_ntree(b_world.node_tree());
 
-                       add_nodes(scene, b_engine, b_data, b_scene, b_view_layer, !preview, graph, b_ntree);
+                       add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
 
                        /* volume */
                        PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
@@ -1402,7 +1399,7 @@ void BlenderSync::sync_world(bool update_all)
 
 /* Sync Lamps */
 
-void BlenderSync::sync_lamps(bool update_all)
+void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
 {
        shader_map.set_default(scene->default_light);
 
@@ -1427,7 +1424,7 @@ void BlenderSync::sync_lamps(bool update_all)
 
                                BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
 
-                               add_nodes(scene, b_engine, b_data, b_scene, b_view_layer, !preview, graph, b_ntree);
+                               add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
                        }
                        else {
                                float strength = 1.0f;
@@ -1454,7 +1451,7 @@ void BlenderSync::sync_lamps(bool update_all)
        }
 }
 
-void BlenderSync::sync_shaders()
+void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
 {
        /* for auto refresh images */
        bool auto_refresh_update = false;
@@ -1468,8 +1465,8 @@ void BlenderSync::sync_shaders()
        shader_map.pre_sync();
 
        sync_world(auto_refresh_update);
-       sync_lamps(auto_refresh_update);
-       sync_materials(auto_refresh_update);
+       sync_lamps(b_depsgraph, auto_refresh_update);
+       sync_materials(b_depsgraph, auto_refresh_update);
 
        /* false = don't delete unused shaders, not supported */
        shader_map.post_sync(false);