Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_shader.cpp
| Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | static SocketType::Type convert_socket_type(BL::NodeSocket &b_socket) | ||||
| } | } | ||||
| } | } | ||||
| static void set_default_value(ShaderInput *input, | static void set_default_value(ShaderInput *input, | ||||
| BL::NodeSocket &b_sock, | BL::NodeSocket &b_sock, | ||||
| BL::BlendData &b_data, | BL::BlendData &b_data, | ||||
| BL::ID &b_id) | BL::ID &b_id) | ||||
| { | { | ||||
| Node *node = input->parent; | Node *node = input->get_parent(); | ||||
| const SocketType &socket = input->socket_type; | const SocketType &socket = input->get_socket_type(); | ||||
| /* copy values for non linked inputs */ | /* copy values for non linked inputs */ | ||||
| switch (input->type()) { | switch (input->type()) { | ||||
| case SocketType::FLOAT: { | case SocketType::FLOAT: { | ||||
| node->set(socket, get_float(b_sock.ptr, "default_value")); | node->set(socket, get_float(b_sock.ptr, "default_value")); | ||||
| break; | break; | ||||
| } | } | ||||
| case SocketType::INT: { | case SocketType::INT: { | ||||
| ▲ Show 20 Lines • Show All 455 Lines • ▼ Show 20 Lines | static ShaderNode *add_node(Scene *scene, | ||||
| else if (b_node.is_a(&RNA_ShaderNodeBump)) { | else if (b_node.is_a(&RNA_ShaderNodeBump)) { | ||||
| BL::ShaderNodeBump b_bump_node(b_node); | BL::ShaderNodeBump b_bump_node(b_node); | ||||
| BumpNode *bump = graph->create_node<BumpNode>(); | BumpNode *bump = graph->create_node<BumpNode>(); | ||||
| bump->set_invert(b_bump_node.invert()); | bump->set_invert(b_bump_node.invert()); | ||||
| node = bump; | node = bump; | ||||
| } | } | ||||
| else if (b_node.is_a(&RNA_ShaderNodeScript)) { | else if (b_node.is_a(&RNA_ShaderNodeScript)) { | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| if (scene->shader_manager->use_osl()) { | if (scene->get_shader_manager()->use_osl()) { | ||||
| /* create script node */ | /* create script node */ | ||||
| BL::ShaderNodeScript b_script_node(b_node); | BL::ShaderNodeScript b_script_node(b_node); | ||||
| ShaderManager *manager = scene->shader_manager; | ShaderManager *manager = scene->get_shader_manager(); | ||||
| string bytecode_hash = b_script_node.bytecode_hash(); | string bytecode_hash = b_script_node.bytecode_hash(); | ||||
| if (!bytecode_hash.empty()) { | if (!bytecode_hash.empty()) { | ||||
| node = OSLShaderManager::osl_node( | node = OSLShaderManager::osl_node( | ||||
| graph, manager, "", bytecode_hash, b_script_node.bytecode()); | graph, manager, "", bytecode_hash, b_script_node.bytecode()); | ||||
| } | } | ||||
| else { | else { | ||||
| string absolute_filepath = blender_absolute_path( | string absolute_filepath = blender_absolute_path( | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (b_image) { | ||||
| /* for builtin images we're using image datablock name to find an image to | /* for builtin images we're using image datablock name to find an image to | ||||
| * read pixels from later | * read pixels from later | ||||
| * | * | ||||
| * also store frame number as well, so there's no differences in handling | * also store frame number as well, so there's no differences in handling | ||||
| * builtin names for packed images and movies | * builtin names for packed images and movies | ||||
| */ | */ | ||||
| int scene_frame = b_scene.frame_current(); | int scene_frame = b_scene.frame_current(); | ||||
| int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); | int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); | ||||
| image->handle = scene->image_manager->add_image( | image->handle = scene->get_image_manager()->add_image( | ||||
| new BlenderImageLoader(b_image, image_frame), image->image_params()); | new BlenderImageLoader(b_image, image_frame), image->image_params()); | ||||
| } | } | ||||
| else { | else { | ||||
| ustring filename = ustring( | ustring filename = ustring( | ||||
| image_user_file_path(b_image_user, b_image, b_scene.frame_current(), true)); | image_user_file_path(b_image_user, b_image, b_scene.frame_current(), true)); | ||||
| image->set_filename(filename); | image->set_filename(filename); | ||||
| } | } | ||||
| } | } | ||||
| Show All 19 Lines | if (b_image) { | ||||
| bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED || | bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED || | ||||
| b_image.source() == BL::Image::source_MOVIE || | b_image.source() == BL::Image::source_MOVIE || | ||||
| (b_engine.is_preview() && b_image.source() != BL::Image::source_SEQUENCE); | (b_engine.is_preview() && b_image.source() != BL::Image::source_SEQUENCE); | ||||
| if (is_builtin) { | if (is_builtin) { | ||||
| int scene_frame = b_scene.frame_current(); | int scene_frame = b_scene.frame_current(); | ||||
| int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); | int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); | ||||
| env->handle = scene->image_manager->add_image(new BlenderImageLoader(b_image, image_frame), | env->handle = scene->get_image_manager()->add_image( | ||||
| env->image_params()); | new BlenderImageLoader(b_image, image_frame), env->image_params()); | ||||
| } | } | ||||
| else { | else { | ||||
| env->set_filename( | env->set_filename( | ||||
| ustring(image_user_file_path(b_image_user, b_image, b_scene.frame_current(), false))); | ustring(image_user_file_path(b_image_user, b_image, b_scene.frame_current(), false))); | ||||
| } | } | ||||
| } | } | ||||
| node = env; | node = env; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | else if (b_node.is_a(&RNA_ShaderNodeUVMap)) { | ||||
| uvm->set_from_dupli(b_uvmap_node.from_instancer()); | uvm->set_from_dupli(b_uvmap_node.from_instancer()); | ||||
| node = uvm; | node = uvm; | ||||
| } | } | ||||
| else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { | else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { | ||||
| BL::ShaderNodeTexPointDensity b_point_density_node(b_node); | BL::ShaderNodeTexPointDensity b_point_density_node(b_node); | ||||
| PointDensityTextureNode *point_density = graph->create_node<PointDensityTextureNode>(); | PointDensityTextureNode *point_density = graph->create_node<PointDensityTextureNode>(); | ||||
| point_density->set_space((NodeTexVoxelSpace)b_point_density_node.space()); | point_density->set_space((NodeTexVoxelSpace)b_point_density_node.space()); | ||||
| point_density->set_interpolation(get_image_interpolation(b_point_density_node)); | point_density->set_interpolation(get_image_interpolation(b_point_density_node)); | ||||
| point_density->handle = scene->image_manager->add_image( | point_density->set_handle(scene->get_image_manager()->add_image( | ||||
| new BlenderPointDensityLoader(b_depsgraph, b_point_density_node), | new BlenderPointDensityLoader(b_depsgraph, b_point_density_node), | ||||
| point_density->image_params()); | point_density->image_params())); | ||||
| b_point_density_node.cache_point_density(b_depsgraph); | b_point_density_node.cache_point_density(b_depsgraph); | ||||
| node = point_density; | node = point_density; | ||||
| /* Transformation form world space to texture space. | /* Transformation form world space to texture space. | ||||
| * | * | ||||
| * NOTE: Do this after the texture is cached, this is because getting | * NOTE: Do this after the texture is cached, this is because getting | ||||
| * min/max will need to access this cache. | * min/max will need to access this cache. | ||||
| Show All 28 Lines | #endif | ||||
| else if (b_node.is_a(&RNA_ShaderNodeOutputAOV)) { | else if (b_node.is_a(&RNA_ShaderNodeOutputAOV)) { | ||||
| BL::ShaderNodeOutputAOV b_aov_node(b_node); | BL::ShaderNodeOutputAOV b_aov_node(b_node); | ||||
| OutputAOVNode *aov = graph->create_node<OutputAOVNode>(); | OutputAOVNode *aov = graph->create_node<OutputAOVNode>(); | ||||
| aov->set_name(ustring(b_aov_node.name())); | aov->set_name(ustring(b_aov_node.name())); | ||||
| node = aov; | node = aov; | ||||
| } | } | ||||
| if (node) { | if (node) { | ||||
| node->name = b_node.name(); | node->set_name(ustring(b_node.name())); | ||||
| graph->add(node); | graph->add(node); | ||||
| } | } | ||||
| return node; | return node; | ||||
| } | } | ||||
| static bool node_use_modified_socket_name(ShaderNode *node) | static bool node_use_modified_socket_name(ShaderNode *node) | ||||
| { | { | ||||
| if (node->special_type == SHADER_SPECIAL_TYPE_OSL) | if (node->get_special_type() == SHADER_SPECIAL_TYPE_OSL) | ||||
| return false; | return false; | ||||
| return true; | return true; | ||||
| } | } | ||||
| static ShaderInput *node_find_input_by_name(ShaderNode *node, | static ShaderInput *node_find_input_by_name(ShaderNode *node, | ||||
| BL::Node &b_node, | BL::Node &b_node, | ||||
| BL::NodeSocket &b_socket) | BL::NodeSocket &b_socket) | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (b_node->mute() || b_node->is_a(&RNA_NodeReroute)) { | ||||
| BL::NodeSocket to_socket(b_link->to_socket()); | BL::NodeSocket to_socket(b_link->to_socket()); | ||||
| SocketType::Type to_socket_type = convert_socket_type(to_socket); | SocketType::Type to_socket_type = convert_socket_type(to_socket); | ||||
| if (to_socket_type == SocketType::UNDEFINED) { | if (to_socket_type == SocketType::UNDEFINED) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ConvertNode *proxy = graph->create_node<ConvertNode>(to_socket_type, to_socket_type, true); | ConvertNode *proxy = graph->create_node<ConvertNode>(to_socket_type, to_socket_type, true); | ||||
| input_map[b_link->from_socket().ptr.data] = proxy->inputs[0]; | input_map[b_link->from_socket().ptr.data] = proxy->get_inputs()[0]; | ||||
| output_map[b_link->to_socket().ptr.data] = proxy->outputs[0]; | output_map[b_link->to_socket().ptr.data] = proxy->get_outputs()[0]; | ||||
| graph->add(proxy); | graph->add(proxy); | ||||
| } | } | ||||
| } | } | ||||
| else if (b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup) || | else if (b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup) || | ||||
| b_node->is_a(&RNA_ShaderNodeCustomGroup)) { | b_node->is_a(&RNA_ShaderNodeCustomGroup)) { | ||||
| BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL); | BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL); | ||||
| Show All 17 Lines | else if (b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup) || | ||||
| } | } | ||||
| ConvertNode *proxy = graph->create_node<ConvertNode>(input_type, input_type, true); | ConvertNode *proxy = graph->create_node<ConvertNode>(input_type, input_type, true); | ||||
| graph->add(proxy); | graph->add(proxy); | ||||
| /* register the proxy node for internal binding */ | /* register the proxy node for internal binding */ | ||||
| group_proxy_input_map[b_input->identifier()] = proxy; | group_proxy_input_map[b_input->identifier()] = proxy; | ||||
| input_map[b_input->ptr.data] = proxy->inputs[0]; | input_map[b_input->ptr.data] = proxy->get_inputs()[0]; | ||||
| set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree); | set_default_value(proxy->get_inputs()[0], *b_input, b_data, b_ntree); | ||||
| } | } | ||||
| for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { | for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { | ||||
| SocketType::Type output_type = convert_socket_type(*b_output); | SocketType::Type output_type = convert_socket_type(*b_output); | ||||
| if (output_type == SocketType::UNDEFINED) { | if (output_type == SocketType::UNDEFINED) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ConvertNode *proxy = graph->create_node<ConvertNode>(output_type, output_type, true); | ConvertNode *proxy = graph->create_node<ConvertNode>(output_type, output_type, true); | ||||
| graph->add(proxy); | graph->add(proxy); | ||||
| /* register the proxy node for internal binding */ | /* register the proxy node for internal binding */ | ||||
| group_proxy_output_map[b_output->identifier()] = proxy; | group_proxy_output_map[b_output->identifier()] = proxy; | ||||
| output_map[b_output->ptr.data] = proxy->outputs[0]; | output_map[b_output->ptr.data] = proxy->get_outputs()[0]; | ||||
| } | } | ||||
| if (b_group_ntree) { | if (b_group_ntree) { | ||||
| add_nodes(scene, | add_nodes(scene, | ||||
| b_engine, | b_engine, | ||||
| b_data, | b_data, | ||||
| b_depsgraph, | b_depsgraph, | ||||
| b_scene, | b_scene, | ||||
| graph, | graph, | ||||
| b_group_ntree, | b_group_ntree, | ||||
| group_proxy_input_map, | group_proxy_input_map, | ||||
| group_proxy_output_map); | group_proxy_output_map); | ||||
| } | } | ||||
| } | } | ||||
| else if (b_node->is_a(&RNA_NodeGroupInput)) { | else if (b_node->is_a(&RNA_NodeGroupInput)) { | ||||
| /* map each socket to a proxy node */ | /* map each socket to a proxy node */ | ||||
| for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { | for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { | ||||
| ProxyMap::const_iterator proxy_it = proxy_input_map.find(b_output->identifier()); | ProxyMap::const_iterator proxy_it = proxy_input_map.find(b_output->identifier()); | ||||
| if (proxy_it != proxy_input_map.end()) { | if (proxy_it != proxy_input_map.end()) { | ||||
| ConvertNode *proxy = proxy_it->second; | ConvertNode *proxy = proxy_it->second; | ||||
| output_map[b_output->ptr.data] = proxy->outputs[0]; | output_map[b_output->ptr.data] = proxy->get_outputs()[0]; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (b_node->is_a(&RNA_NodeGroupOutput)) { | else if (b_node->is_a(&RNA_NodeGroupOutput)) { | ||||
| BL::NodeGroupOutput b_output_node(*b_node); | BL::NodeGroupOutput b_output_node(*b_node); | ||||
| /* only the active group output is used */ | /* only the active group output is used */ | ||||
| if (b_output_node.is_active_output()) { | if (b_output_node.is_active_output()) { | ||||
| /* map each socket to a proxy node */ | /* map each socket to a proxy node */ | ||||
| for (b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) { | for (b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) { | ||||
| ProxyMap::const_iterator proxy_it = proxy_output_map.find(b_input->identifier()); | ProxyMap::const_iterator proxy_it = proxy_output_map.find(b_input->identifier()); | ||||
| if (proxy_it != proxy_output_map.end()) { | if (proxy_it != proxy_output_map.end()) { | ||||
| ConvertNode *proxy = proxy_it->second; | ConvertNode *proxy = proxy_it->second; | ||||
| input_map[b_input->ptr.data] = proxy->inputs[0]; | input_map[b_input->ptr.data] = proxy->get_inputs()[0]; | ||||
| set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree); | set_default_value(proxy->get_inputs()[0], *b_input, b_data, b_ntree); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| ShaderNode *node = NULL; | ShaderNode *node = NULL; | ||||
| if (b_node->ptr.data == output_node.ptr.data) { | if (b_node->ptr.data == output_node.ptr.data) { | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | add_nodes(scene, | ||||
| empty_proxy_map, | empty_proxy_map, | ||||
| empty_proxy_map); | empty_proxy_map); | ||||
| } | } | ||||
| /* Sync Materials */ | /* Sync Materials */ | ||||
| void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) | void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) | ||||
| { | { | ||||
| shader_map.set_default(scene->default_surface); | shader_map.set_default(scene->get_default_surface()); | ||||
| TaskPool pool; | TaskPool pool; | ||||
| set<Shader *> updated_shaders; | set<Shader *> updated_shaders; | ||||
| BL::Depsgraph::ids_iterator b_id; | BL::Depsgraph::ids_iterator b_id; | ||||
| for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { | for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { | ||||
| if (!b_id->is_a(&RNA_Material)) { | if (!b_id->is_a(&RNA_Material)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| BL::Material b_mat(*b_id); | BL::Material b_mat(*b_id); | ||||
| Shader *shader; | Shader *shader; | ||||
| /* test if we need to sync */ | /* test if we need to sync */ | ||||
| if (shader_map.add_or_update(&shader, b_mat) || update_all) { | if (shader_map.add_or_update(&shader, b_mat) || update_all) { | ||||
| ShaderGraph *graph = new ShaderGraph(); | ShaderGraph *graph = new ShaderGraph(); | ||||
| shader->name = b_mat.name().c_str(); | shader->set_name(ustring(b_mat.name().c_str())); | ||||
| shader->set_pass_id(b_mat.pass_index()); | shader->set_pass_id(b_mat.pass_index()); | ||||
| /* create nodes */ | /* create nodes */ | ||||
| if (b_mat.use_nodes() && b_mat.node_tree()) { | if (b_mat.use_nodes() && b_mat.node_tree()) { | ||||
| BL::ShaderNodeTree b_ntree(b_mat.node_tree()); | BL::ShaderNodeTree b_ntree(b_mat.node_tree()); | ||||
| add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | foreach (Shader *shader, updated_shaders) { | ||||
| shader->tag_update(scene); | shader->tag_update(scene); | ||||
| } | } | ||||
| } | } | ||||
| /* Sync World */ | /* Sync World */ | ||||
| void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all) | void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all) | ||||
| { | { | ||||
| Background *background = scene->background; | Background *background = scene->get_background(); | ||||
| BL::World b_world = b_scene.world(); | BL::World b_world = b_scene.world(); | ||||
| BlenderViewportParameters new_viewport_parameters(b_v3d); | BlenderViewportParameters new_viewport_parameters(b_v3d); | ||||
| if (world_recalc || update_all || b_world.ptr.data != world_map || | if (world_recalc || update_all || b_world.ptr.data != world_map || | ||||
| viewport_parameters.modified(new_viewport_parameters)) { | viewport_parameters.modified(new_viewport_parameters)) { | ||||
| Shader *shader = scene->default_background; | Shader *shader = scene->get_default_background(); | ||||
| ShaderGraph *graph = new ShaderGraph(); | ShaderGraph *graph = new ShaderGraph(); | ||||
| /* create nodes */ | /* create nodes */ | ||||
| if (new_viewport_parameters.use_scene_world && b_world && b_world.use_nodes() && | if (new_viewport_parameters.use_scene_world && b_world && b_world.use_nodes() && | ||||
| b_world.node_tree()) { | b_world.node_tree()) { | ||||
| BL::ShaderNodeTree b_ntree(b_world.node_tree()); | BL::ShaderNodeTree b_ntree(b_world.node_tree()); | ||||
| add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all) | ||||
| if (background->is_modified()) | if (background->is_modified()) | ||||
| background->tag_update(scene); | background->tag_update(scene); | ||||
| } | } | ||||
| /* Sync Lights */ | /* Sync Lights */ | ||||
| void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all) | void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all) | ||||
| { | { | ||||
| shader_map.set_default(scene->default_light); | shader_map.set_default(scene->get_default_light()); | ||||
| BL::Depsgraph::ids_iterator b_id; | BL::Depsgraph::ids_iterator b_id; | ||||
| for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { | for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) { | ||||
| if (!b_id->is_a(&RNA_Light)) { | if (!b_id->is_a(&RNA_Light)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| BL::Light b_light(*b_id); | BL::Light b_light(*b_id); | ||||
| Shader *shader; | Shader *shader; | ||||
| /* test if we need to sync */ | /* test if we need to sync */ | ||||
| if (shader_map.add_or_update(&shader, b_light) || update_all) { | if (shader_map.add_or_update(&shader, b_light) || update_all) { | ||||
| ShaderGraph *graph = new ShaderGraph(); | ShaderGraph *graph = new ShaderGraph(); | ||||
| /* create nodes */ | /* create nodes */ | ||||
| if (b_light.use_nodes() && b_light.node_tree()) { | if (b_light.use_nodes() && b_light.node_tree()) { | ||||
| shader->name = b_light.name().c_str(); | shader->set_name(ustring(b_light.name().c_str())); | ||||
| BL::ShaderNodeTree b_ntree(b_light.node_tree()); | BL::ShaderNodeTree b_ntree(b_light.node_tree()); | ||||
| add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | ||||
| } | } | ||||
| else { | else { | ||||
| EmissionNode *emission = graph->create_node<EmissionNode>(); | EmissionNode *emission = graph->create_node<EmissionNode>(); | ||||
| emission->set_color(make_float3(1.0f, 1.0f, 1.0f)); | emission->set_color(make_float3(1.0f, 1.0f, 1.0f)); | ||||
| Show All 11 Lines | |||||
| } | } | ||||
| void BlenderSync::sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d) | void BlenderSync::sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d) | ||||
| { | { | ||||
| /* for auto refresh images */ | /* for auto refresh images */ | ||||
| bool auto_refresh_update = false; | bool auto_refresh_update = false; | ||||
| if (preview) { | if (preview) { | ||||
| ImageManager *image_manager = scene->image_manager; | ImageManager *image_manager = scene->get_image_manager(); | ||||
| int frame = b_scene.frame_current(); | int frame = b_scene.frame_current(); | ||||
| auto_refresh_update = image_manager->set_animation_frame_update(frame); | auto_refresh_update = image_manager->set_animation_frame_update(frame); | ||||
| } | } | ||||
| shader_map.pre_sync(); | shader_map.pre_sync(); | ||||
| sync_world(b_depsgraph, b_v3d, auto_refresh_update); | sync_world(b_depsgraph, b_v3d, auto_refresh_update); | ||||
| sync_lights(b_depsgraph, auto_refresh_update); | sync_lights(b_depsgraph, auto_refresh_update); | ||||
| sync_materials(b_depsgraph, auto_refresh_update); | sync_materials(b_depsgraph, auto_refresh_update); | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||