diff options
Diffstat (limited to 'intern/cycles/blender/blender_shader.cpp')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index bdbab1006c0..50202c3f272 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -235,13 +235,15 @@ static bool is_output_node(BL::Node& b_node) { return (b_node.is_a(&RNA_ShaderNodeOutputMaterial) || b_node.is_a(&RNA_ShaderNodeOutputWorld) - || b_node.is_a(&RNA_ShaderNodeOutputLamp)); + || b_node.is_a(&RNA_ShaderNodeOutputLamp) + || b_node.is_a(&RNA_ShaderNodeOutputEeveeMaterial)); } static ShaderNode *add_node(Scene *scene, BL::RenderEngine& b_engine, BL::BlendData& b_data, BL::Scene& b_scene, + BL::SceneLayer b_scene_layer, const bool background, ShaderGraph *graph, BL::ShaderNodeTree& b_ntree, @@ -838,7 +840,7 @@ static ShaderNode *add_node(Scene *scene, /* TODO(sergey): Use more proper update flag. */ if(true) { - b_point_density_node.cache_point_density(b_scene, settings); + b_point_density_node.cache_point_density(b_scene, b_scene_layer, settings); scene->image_manager->tag_reload_image( point_density->filename.string(), point_density->builtin_data, @@ -856,7 +858,7 @@ static ShaderNode *add_node(Scene *scene, BL::Object b_ob(b_point_density_node.object()); if(b_ob) { float3 loc, size; - point_density_texture_space(b_scene, + point_density_texture_space(b_scene, b_scene_layer, b_point_density_node, settings, loc, @@ -953,6 +955,7 @@ static void add_nodes(Scene *scene, BL::RenderEngine& b_engine, BL::BlendData& b_data, BL::Scene& b_scene, + BL::SceneLayer& b_scene_layer, const bool background, ShaderGraph *graph, BL::ShaderNodeTree& b_ntree, @@ -1043,6 +1046,7 @@ static void add_nodes(Scene *scene, b_engine, b_data, b_scene, + b_scene_layer, background, graph, b_group_ntree, @@ -1092,6 +1096,7 @@ static void add_nodes(Scene *scene, b_engine, b_data, b_scene, + b_scene_layer, background, graph, b_ntree, @@ -1155,6 +1160,7 @@ static void add_nodes(Scene *scene, BL::RenderEngine& b_engine, BL::BlendData& b_data, BL::Scene& b_scene, + BL::SceneLayer& b_scene_layer, const bool background, ShaderGraph *graph, BL::ShaderNodeTree& b_ntree) @@ -1164,6 +1170,7 @@ static void add_nodes(Scene *scene, b_engine, b_data, b_scene, + b_scene_layer, background, graph, b_ntree, @@ -1177,13 +1184,18 @@ void BlenderSync::sync_materials(bool update_all) { shader_map.set_default(scene->default_surface); - /* material loop */ - BL::BlendData::materials_iterator b_mat; - TaskPool pool; set<Shader*> updated_shaders; - for(b_data.materials.begin(b_mat); b_mat != b_data.materials.end(); ++b_mat) { + /* material loop */ + BL::BlendData::materials_iterator b_mat_orig; + for(b_data.materials.begin(b_mat_orig); + b_mat_orig != b_data.materials.end(); + ++b_mat_orig) + { + /* TODO(sergey): Iterate over evaluated data rather than using mapping. */ + BL::Material b_mat_(b_depsgraph.evaluated_id_get(*b_mat_orig)); + BL::Material *b_mat = &b_mat_; Shader *shader; /* test if we need to sync */ @@ -1197,7 +1209,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, !preview, graph, b_ntree); + add_nodes(scene, b_engine, b_data, b_scene, b_scene_layer, !preview, graph, b_ntree); } else { DiffuseBsdfNode *diffuse = new DiffuseBsdfNode(); @@ -1268,7 +1280,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, !preview, graph, b_ntree); + add_nodes(scene, b_engine, b_data, b_scene, b_scene_layer, !preview, graph, b_ntree); /* volume */ PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); @@ -1343,9 +1355,14 @@ void BlenderSync::sync_lamps(bool update_all) shader_map.set_default(scene->default_light); /* lamp loop */ - BL::BlendData::lamps_iterator b_lamp; - - for(b_data.lamps.begin(b_lamp); b_lamp != b_data.lamps.end(); ++b_lamp) { + BL::BlendData::lamps_iterator b_lamp_orig; + for(b_data.lamps.begin(b_lamp_orig); + b_lamp_orig != b_data.lamps.end(); + ++b_lamp_orig) + { + /* TODO(sergey): Iterate over evaluated data rather than using mapping. */ + BL::Lamp b_lamp_(b_depsgraph.evaluated_id_get(*b_lamp_orig)); + BL::Lamp *b_lamp = &b_lamp_; Shader *shader; /* test if we need to sync */ @@ -1358,7 +1375,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, !preview, graph, b_ntree); + add_nodes(scene, b_engine, b_data, b_scene, b_scene_layer, !preview, graph, b_ntree); } else { float strength = 1.0f; |