diff options
Diffstat (limited to 'intern/cycles/blender/blender_shader.cpp')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 424 |
1 files changed, 223 insertions, 201 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 03ed88ea9ec..dda8a2aa4f3 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -42,11 +42,11 @@ typedef map<string, ConvertNode *> ProxyMap; /* Find */ -void BlenderSync::find_shader(BL::ID &id, vector<Shader *> &used_shaders, Shader *default_shader) +void BlenderSync::find_shader(BL::ID &id, array<Node *> &used_shaders, Shader *default_shader) { Shader *shader = (id) ? shader_map.find(id) : default_shader; - used_shaders.push_back(shader); + used_shaders.push_back_slow(shader); shader->tag_used(scene); } @@ -194,19 +194,19 @@ static void set_default_value(ShaderInput *input, } } -static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping &b_mapping) +static void get_tex_mapping(TextureNode *mapping, BL::TexMapping &b_mapping) { if (!b_mapping) return; - mapping->translation = get_float3(b_mapping.translation()); - mapping->rotation = get_float3(b_mapping.rotation()); - mapping->scale = get_float3(b_mapping.scale()); - mapping->type = (TextureMapping::Type)b_mapping.vector_type(); + mapping->set_tex_mapping_translation(get_float3(b_mapping.translation())); + mapping->set_tex_mapping_rotation(get_float3(b_mapping.rotation())); + mapping->set_tex_mapping_scale(get_float3(b_mapping.scale())); + mapping->set_tex_mapping_type((TextureMapping::Type)b_mapping.vector_type()); - mapping->x_mapping = (TextureMapping::Mapping)b_mapping.mapping_x(); - mapping->y_mapping = (TextureMapping::Mapping)b_mapping.mapping_y(); - mapping->z_mapping = (TextureMapping::Mapping)b_mapping.mapping_z(); + mapping->set_tex_mapping_x_mapping((TextureMapping::Mapping)b_mapping.mapping_x()); + mapping->set_tex_mapping_y_mapping((TextureMapping::Mapping)b_mapping.mapping_y()); + mapping->set_tex_mapping_z_mapping((TextureMapping::Mapping)b_mapping.mapping_z()); } static ShaderNode *add_node(Scene *scene, @@ -225,34 +225,48 @@ static ShaderNode *add_node(Scene *scene, BL::ShaderNodeRGBCurve b_curve_node(b_node); BL::CurveMapping mapping(b_curve_node.mapping()); RGBCurvesNode *curves = graph->create_node<RGBCurvesNode>(); - curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, true); - curvemapping_minmax(mapping, true, &curves->min_x, &curves->max_x); + array<float3> curve_mapping_curves; + float min_x, max_x; + curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, true); + curvemapping_minmax(mapping, true, &min_x, &max_x); + curves->set_min_x(min_x); + curves->set_max_x(max_x); + curves->set_curves(curve_mapping_curves); node = curves; } if (b_node.is_a(&RNA_ShaderNodeVectorCurve)) { BL::ShaderNodeVectorCurve b_curve_node(b_node); BL::CurveMapping mapping(b_curve_node.mapping()); VectorCurvesNode *curves = graph->create_node<VectorCurvesNode>(); - curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, false); - curvemapping_minmax(mapping, false, &curves->min_x, &curves->max_x); + array<float3> curve_mapping_curves; + float min_x, max_x; + curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, false); + curvemapping_minmax(mapping, false, &min_x, &max_x); + curves->set_min_x(min_x); + curves->set_max_x(max_x); + curves->set_curves(curve_mapping_curves); node = curves; } else if (b_node.is_a(&RNA_ShaderNodeValToRGB)) { RGBRampNode *ramp = graph->create_node<RGBRampNode>(); BL::ShaderNodeValToRGB b_ramp_node(b_node); BL::ColorRamp b_color_ramp(b_ramp_node.color_ramp()); - colorramp_to_array(b_color_ramp, ramp->ramp, ramp->ramp_alpha, RAMP_TABLE_SIZE); - ramp->interpolate = b_color_ramp.interpolation() != BL::ColorRamp::interpolation_CONSTANT; + array<float3> ramp_values; + array<float> ramp_alpha; + colorramp_to_array(b_color_ramp, ramp_values, ramp_alpha, RAMP_TABLE_SIZE); + ramp->set_ramp(ramp_values); + ramp->set_ramp_alpha(ramp_alpha); + ramp->set_interpolate(b_color_ramp.interpolation() != BL::ColorRamp::interpolation_CONSTANT); node = ramp; } else if (b_node.is_a(&RNA_ShaderNodeRGB)) { ColorNode *color = graph->create_node<ColorNode>(); - color->value = get_node_output_rgba(b_node, "Color"); + color->set_value(get_node_output_rgba(b_node, "Color")); node = color; } else if (b_node.is_a(&RNA_ShaderNodeValue)) { ValueNode *value = graph->create_node<ValueNode>(); - value->value = get_node_output_value(b_node, "Value"); + value->set_value(get_node_output_value(b_node, "Value")); node = value; } else if (b_node.is_a(&RNA_ShaderNodeCameraData)) { @@ -270,8 +284,8 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeMixRGB)) { BL::ShaderNodeMixRGB b_mix_node(b_node); MixNode *mix = graph->create_node<MixNode>(); - mix->type = (NodeMix)b_mix_node.blend_type(); - mix->use_clamp = b_mix_node.use_clamp(); + mix->set_mix_type((NodeMix)b_mix_node.blend_type()); + mix->set_use_clamp(b_mix_node.use_clamp()); node = mix; } else if (b_node.is_a(&RNA_ShaderNodeSeparateRGB)) { @@ -301,43 +315,45 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeMapRange)) { BL::ShaderNodeMapRange b_map_range_node(b_node); MapRangeNode *map_range_node = graph->create_node<MapRangeNode>(); - map_range_node->clamp = b_map_range_node.clamp(); - map_range_node->type = (NodeMapRangeType)b_map_range_node.interpolation_type(); + map_range_node->set_clamp(b_map_range_node.clamp()); + map_range_node->set_range_type((NodeMapRangeType)b_map_range_node.interpolation_type()); node = map_range_node; } else if (b_node.is_a(&RNA_ShaderNodeClamp)) { BL::ShaderNodeClamp b_clamp_node(b_node); ClampNode *clamp_node = graph->create_node<ClampNode>(); - clamp_node->type = (NodeClampType)b_clamp_node.clamp_type(); + clamp_node->set_clamp_type((NodeClampType)b_clamp_node.clamp_type()); node = clamp_node; } else if (b_node.is_a(&RNA_ShaderNodeMath)) { BL::ShaderNodeMath b_math_node(b_node); MathNode *math_node = graph->create_node<MathNode>(); - math_node->type = (NodeMathType)b_math_node.operation(); - math_node->use_clamp = b_math_node.use_clamp(); + math_node->set_math_type((NodeMathType)b_math_node.operation()); + math_node->set_use_clamp(b_math_node.use_clamp()); node = math_node; } else if (b_node.is_a(&RNA_ShaderNodeVectorMath)) { BL::ShaderNodeVectorMath b_vector_math_node(b_node); VectorMathNode *vector_math_node = graph->create_node<VectorMathNode>(); - vector_math_node->type = (NodeVectorMathType)b_vector_math_node.operation(); + vector_math_node->set_math_type((NodeVectorMathType)b_vector_math_node.operation()); node = vector_math_node; } else if (b_node.is_a(&RNA_ShaderNodeVectorRotate)) { BL::ShaderNodeVectorRotate b_vector_rotate_node(b_node); VectorRotateNode *vector_rotate_node = graph->create_node<VectorRotateNode>(); - vector_rotate_node->type = (NodeVectorRotateType)b_vector_rotate_node.rotation_type(); - vector_rotate_node->invert = b_vector_rotate_node.invert(); + vector_rotate_node->set_rotate_type( + (NodeVectorRotateType)b_vector_rotate_node.rotation_type()); + vector_rotate_node->set_invert(b_vector_rotate_node.invert()); node = vector_rotate_node; } else if (b_node.is_a(&RNA_ShaderNodeVectorTransform)) { BL::ShaderNodeVectorTransform b_vector_transform_node(b_node); VectorTransformNode *vtransform = graph->create_node<VectorTransformNode>(); - vtransform->type = (NodeVectorTransformType)b_vector_transform_node.vector_type(); - vtransform->convert_from = (NodeVectorTransformConvertSpace) - b_vector_transform_node.convert_from(); - vtransform->convert_to = (NodeVectorTransformConvertSpace)b_vector_transform_node.convert_to(); + vtransform->set_transform_type((NodeVectorTransformType)b_vector_transform_node.vector_type()); + vtransform->set_convert_from( + (NodeVectorTransformConvertSpace)b_vector_transform_node.convert_from()); + vtransform->set_convert_to( + (NodeVectorTransformConvertSpace)b_vector_transform_node.convert_to()); node = vtransform; } else if (b_node.is_a(&RNA_ShaderNodeNormal)) { @@ -345,13 +361,13 @@ static ShaderNode *add_node(Scene *scene, b_node.outputs.begin(out_it); NormalNode *norm = graph->create_node<NormalNode>(); - norm->direction = get_node_output_vector(b_node, "Normal"); + norm->set_direction(get_node_output_vector(b_node, "Normal")); node = norm; } else if (b_node.is_a(&RNA_ShaderNodeMapping)) { BL::ShaderNodeMapping b_mapping_node(b_node); MappingNode *mapping = graph->create_node<MappingNode>(); - mapping->type = (NodeMappingType)b_mapping_node.vector_type(); + mapping->set_mapping_type((NodeMappingType)b_mapping_node.vector_type()); node = mapping; } else if (b_node.is_a(&RNA_ShaderNodeFresnel)) { @@ -369,7 +385,7 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeAttribute)) { BL::ShaderNodeAttribute b_attr_node(b_node); AttributeNode *attr = graph->create_node<AttributeNode>(); - attr->attribute = b_attr_node.attribute_name(); + attr->set_attribute(ustring(b_attr_node.attribute_name())); node = attr; } else if (b_node.is_a(&RNA_ShaderNodeBackground)) { @@ -384,16 +400,16 @@ static ShaderNode *add_node(Scene *scene, switch (b_aniso_node.distribution()) { case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN: - aniso->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ID; + aniso->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID); break; case BL::ShaderNodeBsdfAnisotropic::distribution_GGX: - aniso->distribution = CLOSURE_BSDF_MICROFACET_GGX_ID; + aniso->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID); break; case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX: - aniso->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID; + aniso->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID); break; case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY: - aniso->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID; + aniso->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); break; } @@ -409,16 +425,16 @@ static ShaderNode *add_node(Scene *scene, switch (b_subsurface_node.falloff()) { case BL::ShaderNodeSubsurfaceScattering::falloff_CUBIC: - subsurface->falloff = CLOSURE_BSSRDF_CUBIC_ID; + subsurface->set_falloff(CLOSURE_BSSRDF_CUBIC_ID); break; case BL::ShaderNodeSubsurfaceScattering::falloff_GAUSSIAN: - subsurface->falloff = CLOSURE_BSSRDF_GAUSSIAN_ID; + subsurface->set_falloff(CLOSURE_BSSRDF_GAUSSIAN_ID); break; case BL::ShaderNodeSubsurfaceScattering::falloff_BURLEY: - subsurface->falloff = CLOSURE_BSSRDF_BURLEY_ID; + subsurface->set_falloff(CLOSURE_BSSRDF_BURLEY_ID); break; case BL::ShaderNodeSubsurfaceScattering::falloff_RANDOM_WALK: - subsurface->falloff = CLOSURE_BSSRDF_RANDOM_WALK_ID; + subsurface->set_falloff(CLOSURE_BSSRDF_RANDOM_WALK_ID); break; } @@ -430,19 +446,19 @@ static ShaderNode *add_node(Scene *scene, switch (b_glossy_node.distribution()) { case BL::ShaderNodeBsdfGlossy::distribution_SHARP: - glossy->distribution = CLOSURE_BSDF_REFLECTION_ID; + glossy->set_distribution(CLOSURE_BSDF_REFLECTION_ID); break; case BL::ShaderNodeBsdfGlossy::distribution_BECKMANN: - glossy->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ID; + glossy->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID); break; case BL::ShaderNodeBsdfGlossy::distribution_GGX: - glossy->distribution = CLOSURE_BSDF_MICROFACET_GGX_ID; + glossy->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID); break; case BL::ShaderNodeBsdfGlossy::distribution_ASHIKHMIN_SHIRLEY: - glossy->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID; + glossy->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); break; case BL::ShaderNodeBsdfGlossy::distribution_MULTI_GGX: - glossy->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID; + glossy->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID); break; } node = glossy; @@ -452,16 +468,16 @@ static ShaderNode *add_node(Scene *scene, GlassBsdfNode *glass = graph->create_node<GlassBsdfNode>(); switch (b_glass_node.distribution()) { case BL::ShaderNodeBsdfGlass::distribution_SHARP: - glass->distribution = CLOSURE_BSDF_SHARP_GLASS_ID; + glass->set_distribution(CLOSURE_BSDF_SHARP_GLASS_ID); break; case BL::ShaderNodeBsdfGlass::distribution_BECKMANN: - glass->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID; + glass->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID); break; case BL::ShaderNodeBsdfGlass::distribution_GGX: - glass->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID; + glass->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID); break; case BL::ShaderNodeBsdfGlass::distribution_MULTI_GGX: - glass->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID; + glass->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID); break; } node = glass; @@ -471,13 +487,13 @@ static ShaderNode *add_node(Scene *scene, RefractionBsdfNode *refraction = graph->create_node<RefractionBsdfNode>(); switch (b_refraction_node.distribution()) { case BL::ShaderNodeBsdfRefraction::distribution_SHARP: - refraction->distribution = CLOSURE_BSDF_REFRACTION_ID; + refraction->set_distribution(CLOSURE_BSDF_REFRACTION_ID); break; case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN: - refraction->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID; + refraction->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID); break; case BL::ShaderNodeBsdfRefraction::distribution_GGX: - refraction->distribution = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; + refraction->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID); break; } node = refraction; @@ -487,10 +503,10 @@ static ShaderNode *add_node(Scene *scene, ToonBsdfNode *toon = graph->create_node<ToonBsdfNode>(); switch (b_toon_node.component()) { case BL::ShaderNodeBsdfToon::component_DIFFUSE: - toon->component = CLOSURE_BSDF_DIFFUSE_TOON_ID; + toon->set_component(CLOSURE_BSDF_DIFFUSE_TOON_ID); break; case BL::ShaderNodeBsdfToon::component_GLOSSY: - toon->component = CLOSURE_BSDF_GLOSSY_TOON_ID; + toon->set_component(CLOSURE_BSDF_GLOSSY_TOON_ID); break; } node = toon; @@ -500,10 +516,10 @@ static ShaderNode *add_node(Scene *scene, HairBsdfNode *hair = graph->create_node<HairBsdfNode>(); switch (b_hair_node.component()) { case BL::ShaderNodeBsdfHair::component_Reflection: - hair->component = CLOSURE_BSDF_HAIR_REFLECTION_ID; + hair->set_component(CLOSURE_BSDF_HAIR_REFLECTION_ID); break; case BL::ShaderNodeBsdfHair::component_Transmission: - hair->component = CLOSURE_BSDF_HAIR_TRANSMISSION_ID; + hair->set_component(CLOSURE_BSDF_HAIR_TRANSMISSION_ID); break; } node = hair; @@ -511,11 +527,11 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeBsdfHairPrincipled)) { BL::ShaderNodeBsdfHairPrincipled b_principled_hair_node(b_node); PrincipledHairBsdfNode *principled_hair = graph->create_node<PrincipledHairBsdfNode>(); - principled_hair->parametrization = (NodePrincipledHairParametrization)get_enum( - b_principled_hair_node.ptr, - "parametrization", - NODE_PRINCIPLED_HAIR_NUM, - NODE_PRINCIPLED_HAIR_REFLECTANCE); + principled_hair->set_parametrization( + (NodePrincipledHairParametrization)get_enum(b_principled_hair_node.ptr, + "parametrization", + NODE_PRINCIPLED_HAIR_NUM, + NODE_PRINCIPLED_HAIR_REFLECTANCE)); node = principled_hair; } else if (b_node.is_a(&RNA_ShaderNodeBsdfPrincipled)) { @@ -523,18 +539,18 @@ static ShaderNode *add_node(Scene *scene, PrincipledBsdfNode *principled = graph->create_node<PrincipledBsdfNode>(); switch (b_principled_node.distribution()) { case BL::ShaderNodeBsdfPrincipled::distribution_GGX: - principled->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID; + principled->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID); break; case BL::ShaderNodeBsdfPrincipled::distribution_MULTI_GGX: - principled->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID; + principled->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID); break; } switch (b_principled_node.subsurface_method()) { case BL::ShaderNodeBsdfPrincipled::subsurface_method_BURLEY: - principled->subsurface_method = CLOSURE_BSSRDF_PRINCIPLED_ID; + principled->set_subsurface_method(CLOSURE_BSSRDF_PRINCIPLED_ID); break; case BL::ShaderNodeBsdfPrincipled::subsurface_method_RANDOM_WALK: - principled->subsurface_method = CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID; + principled->set_subsurface_method(CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID); break; } node = principled; @@ -554,9 +570,9 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeAmbientOcclusion)) { BL::ShaderNodeAmbientOcclusion b_ao_node(b_node); AmbientOcclusionNode *ao = graph->create_node<AmbientOcclusionNode>(); - ao->samples = b_ao_node.samples(); - ao->inside = b_ao_node.inside(); - ao->only_local = b_ao_node.only_local(); + ao->set_samples(b_ao_node.samples()); + ao->set_inside(b_ao_node.inside()); + ao->set_only_local(b_ao_node.only_local()); node = ao; } else if (b_node.is_a(&RNA_ShaderNodeVolumeScatter)) { @@ -575,7 +591,7 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeWireframe)) { BL::ShaderNodeWireframe b_wireframe_node(b_node); WireframeNode *wire = graph->create_node<WireframeNode>(); - wire->use_pixel_size = b_wireframe_node.use_pixel_size(); + wire->set_use_pixel_size(b_wireframe_node.use_pixel_size()); node = wire; } else if (b_node.is_a(&RNA_ShaderNodeWavelength)) { @@ -605,13 +621,13 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeVertexColor)) { BL::ShaderNodeVertexColor b_vertex_color_node(b_node); VertexColorNode *vertex_color_node = graph->create_node<VertexColorNode>(); - vertex_color_node->layer_name = b_vertex_color_node.layer_name(); + vertex_color_node->set_layer_name(ustring(b_vertex_color_node.layer_name())); node = vertex_color_node; } else if (b_node.is_a(&RNA_ShaderNodeBump)) { BL::ShaderNodeBump b_bump_node(b_node); BumpNode *bump = graph->create_node<BumpNode>(); - bump->invert = b_bump_node.invert(); + bump->set_invert(b_bump_node.invert()); node = bump; } else if (b_node.is_a(&RNA_ShaderNodeScript)) { @@ -644,25 +660,26 @@ static ShaderNode *add_node(Scene *scene, BL::ImageUser b_image_user(b_image_node.image_user()); ImageTextureNode *image = graph->create_node<ImageTextureNode>(); - image->interpolation = get_image_interpolation(b_image_node); - image->extension = get_image_extension(b_image_node); - image->projection = (NodeImageProjection)b_image_node.projection(); - image->projection_blend = b_image_node.projection_blend(); + image->set_interpolation(get_image_interpolation(b_image_node)); + image->set_extension(get_image_extension(b_image_node)); + image->set_projection((NodeImageProjection)b_image_node.projection()); + image->set_projection_blend(b_image_node.projection_blend()); BL::TexMapping b_texture_mapping(b_image_node.texture_mapping()); - get_tex_mapping(&image->tex_mapping, b_texture_mapping); + get_tex_mapping(image, b_texture_mapping); if (b_image) { PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr; - image->colorspace = get_enum_identifier(colorspace_ptr, "name"); + image->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name"))); - image->animated = b_image_node.image_user().use_auto_refresh(); - image->alpha_type = get_image_alpha_type(b_image); + image->set_animated(b_image_node.image_user().use_auto_refresh()); + image->set_alpha_type(get_image_alpha_type(b_image)); - image->tiles.clear(); + array<int> tiles; BL::Image::tiles_iterator b_iter; for (b_image.tiles.begin(b_iter); b_iter != b_image.tiles.end(); ++b_iter) { - image->tiles.push_back(b_iter->number()); + tiles.push_back_slow(b_iter->number()); } + image->set_tiles(tiles); /* builtin images will use callback-based reading because * they could only be loaded correct from blender side @@ -684,8 +701,9 @@ static ShaderNode *add_node(Scene *scene, new BlenderImageLoader(b_image, image_frame), image->image_params()); } else { - image->filename = image_user_file_path( - b_image_user, b_image, b_scene.frame_current(), true); + ustring filename = ustring( + image_user_file_path(b_image_user, b_image, b_scene.frame_current(), true)); + image->set_filename(filename); } } node = image; @@ -696,17 +714,17 @@ static ShaderNode *add_node(Scene *scene, BL::ImageUser b_image_user(b_env_node.image_user()); EnvironmentTextureNode *env = graph->create_node<EnvironmentTextureNode>(); - env->interpolation = get_image_interpolation(b_env_node); - env->projection = (NodeEnvironmentProjection)b_env_node.projection(); + env->set_interpolation(get_image_interpolation(b_env_node)); + env->set_projection((NodeEnvironmentProjection)b_env_node.projection()); BL::TexMapping b_texture_mapping(b_env_node.texture_mapping()); - get_tex_mapping(&env->tex_mapping, b_texture_mapping); + get_tex_mapping(env, b_texture_mapping); if (b_image) { PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr; - env->colorspace = get_enum_identifier(colorspace_ptr, "name"); + env->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name"))); - env->animated = b_env_node.image_user().use_auto_refresh(); - env->alpha_type = get_image_alpha_type(b_image); + env->set_animated(b_env_node.image_user().use_auto_refresh()); + env->set_alpha_type(get_image_alpha_type(b_image)); bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED || b_image.source() == BL::Image::source_MOVIE || @@ -719,8 +737,8 @@ static ShaderNode *add_node(Scene *scene, env->image_params()); } else { - env->filename = image_user_file_path( - b_image_user, b_image, b_scene.frame_current(), false); + env->set_filename( + ustring(image_user_file_path(b_image_user, b_image, b_scene.frame_current(), false))); } } node = env; @@ -728,103 +746,103 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeTexGradient)) { BL::ShaderNodeTexGradient b_gradient_node(b_node); GradientTextureNode *gradient = graph->create_node<GradientTextureNode>(); - gradient->type = (NodeGradientType)b_gradient_node.gradient_type(); + gradient->set_gradient_type((NodeGradientType)b_gradient_node.gradient_type()); BL::TexMapping b_texture_mapping(b_gradient_node.texture_mapping()); - get_tex_mapping(&gradient->tex_mapping, b_texture_mapping); + get_tex_mapping(gradient, b_texture_mapping); node = gradient; } else if (b_node.is_a(&RNA_ShaderNodeTexVoronoi)) { BL::ShaderNodeTexVoronoi b_voronoi_node(b_node); VoronoiTextureNode *voronoi = graph->create_node<VoronoiTextureNode>(); - voronoi->dimensions = b_voronoi_node.voronoi_dimensions(); - voronoi->feature = (NodeVoronoiFeature)b_voronoi_node.feature(); - voronoi->metric = (NodeVoronoiDistanceMetric)b_voronoi_node.distance(); + voronoi->set_dimensions(b_voronoi_node.voronoi_dimensions()); + voronoi->set_feature((NodeVoronoiFeature)b_voronoi_node.feature()); + voronoi->set_metric((NodeVoronoiDistanceMetric)b_voronoi_node.distance()); BL::TexMapping b_texture_mapping(b_voronoi_node.texture_mapping()); - get_tex_mapping(&voronoi->tex_mapping, b_texture_mapping); + get_tex_mapping(voronoi, b_texture_mapping); node = voronoi; } else if (b_node.is_a(&RNA_ShaderNodeTexMagic)) { BL::ShaderNodeTexMagic b_magic_node(b_node); MagicTextureNode *magic = graph->create_node<MagicTextureNode>(); - magic->depth = b_magic_node.turbulence_depth(); + magic->set_depth(b_magic_node.turbulence_depth()); BL::TexMapping b_texture_mapping(b_magic_node.texture_mapping()); - get_tex_mapping(&magic->tex_mapping, b_texture_mapping); + get_tex_mapping(magic, b_texture_mapping); node = magic; } else if (b_node.is_a(&RNA_ShaderNodeTexWave)) { BL::ShaderNodeTexWave b_wave_node(b_node); WaveTextureNode *wave = graph->create_node<WaveTextureNode>(); - wave->type = (NodeWaveType)b_wave_node.wave_type(); - wave->bands_direction = (NodeWaveBandsDirection)b_wave_node.bands_direction(); - wave->rings_direction = (NodeWaveRingsDirection)b_wave_node.rings_direction(); - wave->profile = (NodeWaveProfile)b_wave_node.wave_profile(); + wave->set_wave_type((NodeWaveType)b_wave_node.wave_type()); + wave->set_bands_direction((NodeWaveBandsDirection)b_wave_node.bands_direction()); + wave->set_rings_direction((NodeWaveRingsDirection)b_wave_node.rings_direction()); + wave->set_profile((NodeWaveProfile)b_wave_node.wave_profile()); BL::TexMapping b_texture_mapping(b_wave_node.texture_mapping()); - get_tex_mapping(&wave->tex_mapping, b_texture_mapping); + get_tex_mapping(wave, b_texture_mapping); node = wave; } else if (b_node.is_a(&RNA_ShaderNodeTexChecker)) { BL::ShaderNodeTexChecker b_checker_node(b_node); CheckerTextureNode *checker = graph->create_node<CheckerTextureNode>(); BL::TexMapping b_texture_mapping(b_checker_node.texture_mapping()); - get_tex_mapping(&checker->tex_mapping, b_texture_mapping); + get_tex_mapping(checker, b_texture_mapping); node = checker; } else if (b_node.is_a(&RNA_ShaderNodeTexBrick)) { BL::ShaderNodeTexBrick b_brick_node(b_node); BrickTextureNode *brick = graph->create_node<BrickTextureNode>(); - brick->offset = b_brick_node.offset(); - brick->offset_frequency = b_brick_node.offset_frequency(); - brick->squash = b_brick_node.squash(); - brick->squash_frequency = b_brick_node.squash_frequency(); + brick->set_offset(b_brick_node.offset()); + brick->set_offset_frequency(b_brick_node.offset_frequency()); + brick->set_squash(b_brick_node.squash()); + brick->set_squash_frequency(b_brick_node.squash_frequency()); BL::TexMapping b_texture_mapping(b_brick_node.texture_mapping()); - get_tex_mapping(&brick->tex_mapping, b_texture_mapping); + get_tex_mapping(brick, b_texture_mapping); node = brick; } else if (b_node.is_a(&RNA_ShaderNodeTexNoise)) { BL::ShaderNodeTexNoise b_noise_node(b_node); NoiseTextureNode *noise = graph->create_node<NoiseTextureNode>(); - noise->dimensions = b_noise_node.noise_dimensions(); + noise->set_dimensions(b_noise_node.noise_dimensions()); BL::TexMapping b_texture_mapping(b_noise_node.texture_mapping()); - get_tex_mapping(&noise->tex_mapping, b_texture_mapping); + get_tex_mapping(noise, b_texture_mapping); node = noise; } else if (b_node.is_a(&RNA_ShaderNodeTexMusgrave)) { BL::ShaderNodeTexMusgrave b_musgrave_node(b_node); MusgraveTextureNode *musgrave_node = graph->create_node<MusgraveTextureNode>(); - musgrave_node->type = (NodeMusgraveType)b_musgrave_node.musgrave_type(); - musgrave_node->dimensions = b_musgrave_node.musgrave_dimensions(); + musgrave_node->set_musgrave_type((NodeMusgraveType)b_musgrave_node.musgrave_type()); + musgrave_node->set_dimensions(b_musgrave_node.musgrave_dimensions()); BL::TexMapping b_texture_mapping(b_musgrave_node.texture_mapping()); - get_tex_mapping(&musgrave_node->tex_mapping, b_texture_mapping); + get_tex_mapping(musgrave_node, b_texture_mapping); node = musgrave_node; } else if (b_node.is_a(&RNA_ShaderNodeTexCoord)) { BL::ShaderNodeTexCoord b_tex_coord_node(b_node); TextureCoordinateNode *tex_coord = graph->create_node<TextureCoordinateNode>(); - tex_coord->from_dupli = b_tex_coord_node.from_instancer(); + tex_coord->set_from_dupli(b_tex_coord_node.from_instancer()); if (b_tex_coord_node.object()) { - tex_coord->use_transform = true; - tex_coord->ob_tfm = get_transform(b_tex_coord_node.object().matrix_world()); + tex_coord->set_use_transform(true); + tex_coord->set_ob_tfm(get_transform(b_tex_coord_node.object().matrix_world())); } node = tex_coord; } else if (b_node.is_a(&RNA_ShaderNodeTexSky)) { BL::ShaderNodeTexSky b_sky_node(b_node); SkyTextureNode *sky = graph->create_node<SkyTextureNode>(); - sky->type = (NodeSkyType)b_sky_node.sky_type(); - sky->sun_direction = normalize(get_float3(b_sky_node.sun_direction())); - sky->turbidity = b_sky_node.turbidity(); - sky->ground_albedo = b_sky_node.ground_albedo(); - sky->sun_disc = b_sky_node.sun_disc(); - sky->sun_size = b_sky_node.sun_size(); - sky->sun_intensity = b_sky_node.sun_intensity(); - sky->sun_elevation = b_sky_node.sun_elevation(); - sky->sun_rotation = b_sky_node.sun_rotation(); - sky->altitude = 1000.0f * b_sky_node.altitude(); - sky->air_density = b_sky_node.air_density(); - sky->dust_density = b_sky_node.dust_density(); - sky->ozone_density = b_sky_node.ozone_density(); + sky->set_sky_type((NodeSkyType)b_sky_node.sky_type()); + sky->set_sun_direction(normalize(get_float3(b_sky_node.sun_direction()))); + sky->set_turbidity(b_sky_node.turbidity()); + sky->set_ground_albedo(b_sky_node.ground_albedo()); + sky->set_sun_disc(b_sky_node.sun_disc()); + sky->set_sun_size(b_sky_node.sun_size()); + sky->set_sun_intensity(b_sky_node.sun_intensity()); + sky->set_sun_elevation(b_sky_node.sun_elevation()); + sky->set_sun_rotation(b_sky_node.sun_rotation()); + sky->set_altitude(1000.0f * b_sky_node.altitude()); + sky->set_air_density(b_sky_node.air_density()); + sky->set_dust_density(b_sky_node.dust_density()); + sky->set_ozone_density(b_sky_node.ozone_density()); BL::TexMapping b_texture_mapping(b_sky_node.texture_mapping()); - get_tex_mapping(&sky->tex_mapping, b_texture_mapping); + get_tex_mapping(sky, b_texture_mapping); node = sky; } else if (b_node.is_a(&RNA_ShaderNodeTexIES)) { @@ -832,13 +850,14 @@ static ShaderNode *add_node(Scene *scene, IESLightNode *ies = graph->create_node<IESLightNode>(); switch (b_ies_node.mode()) { case BL::ShaderNodeTexIES::mode_EXTERNAL: - ies->filename = blender_absolute_path(b_data, b_ntree, b_ies_node.filepath()); + ies->set_filename(ustring(blender_absolute_path(b_data, b_ntree, b_ies_node.filepath()))); break; case BL::ShaderNodeTexIES::mode_INTERNAL: - ies->ies = get_text_datablock_content(b_ies_node.ies().ptr); - if (ies->ies.empty()) { - ies->ies = "\n"; + ustring ies_content = ustring(get_text_datablock_content(b_ies_node.ies().ptr)); + if (ies_content.empty()) { + ies_content = "\n"; } + ies->set_ies(ies_content); break; } node = ies; @@ -846,36 +865,36 @@ static ShaderNode *add_node(Scene *scene, else if (b_node.is_a(&RNA_ShaderNodeTexWhiteNoise)) { BL::ShaderNodeTexWhiteNoise b_tex_white_noise_node(b_node); WhiteNoiseTextureNode *white_noise_node = graph->create_node<WhiteNoiseTextureNode>(); - white_noise_node->dimensions = b_tex_white_noise_node.noise_dimensions(); + white_noise_node->set_dimensions(b_tex_white_noise_node.noise_dimensions()); node = white_noise_node; } else if (b_node.is_a(&RNA_ShaderNodeNormalMap)) { BL::ShaderNodeNormalMap b_normal_map_node(b_node); NormalMapNode *nmap = graph->create_node<NormalMapNode>(); - nmap->space = (NodeNormalMapSpace)b_normal_map_node.space(); - nmap->attribute = b_normal_map_node.uv_map(); + nmap->set_space((NodeNormalMapSpace)b_normal_map_node.space()); + nmap->set_attribute(ustring(b_normal_map_node.uv_map())); node = nmap; } else if (b_node.is_a(&RNA_ShaderNodeTangent)) { BL::ShaderNodeTangent b_tangent_node(b_node); TangentNode *tangent = graph->create_node<TangentNode>(); - tangent->direction_type = (NodeTangentDirectionType)b_tangent_node.direction_type(); - tangent->axis = (NodeTangentAxis)b_tangent_node.axis(); - tangent->attribute = b_tangent_node.uv_map(); + tangent->set_direction_type((NodeTangentDirectionType)b_tangent_node.direction_type()); + tangent->set_axis((NodeTangentAxis)b_tangent_node.axis()); + tangent->set_attribute(ustring(b_tangent_node.uv_map())); node = tangent; } else if (b_node.is_a(&RNA_ShaderNodeUVMap)) { BL::ShaderNodeUVMap b_uvmap_node(b_node); UVMapNode *uvm = graph->create_node<UVMapNode>(); - uvm->attribute = b_uvmap_node.uv_map(); - uvm->from_dupli = b_uvmap_node.from_instancer(); + uvm->set_attribute(ustring(b_uvmap_node.uv_map())); + uvm->set_from_dupli(b_uvmap_node.from_instancer()); node = uvm; } else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { BL::ShaderNodeTexPointDensity b_point_density_node(b_node); PointDensityTextureNode *point_density = graph->create_node<PointDensityTextureNode>(); - point_density->space = (NodeTexVoxelSpace)b_point_density_node.space(); - point_density->interpolation = get_image_interpolation(b_point_density_node); + point_density->set_space((NodeTexVoxelSpace)b_point_density_node.space()); + point_density->set_interpolation(get_image_interpolation(b_point_density_node)); point_density->handle = scene->image_manager->add_image( new BlenderPointDensityLoader(b_depsgraph, b_point_density_node), point_density->image_params()); @@ -892,33 +911,33 @@ static ShaderNode *add_node(Scene *scene, if (b_ob) { float3 loc, size; point_density_texture_space(b_depsgraph, b_point_density_node, loc, size); - point_density->tfm = transform_translate(-loc) * transform_scale(size) * - transform_inverse(get_transform(b_ob.matrix_world())); + point_density->set_tfm(transform_translate(-loc) * transform_scale(size) * + transform_inverse(get_transform(b_ob.matrix_world()))); } } else if (b_node.is_a(&RNA_ShaderNodeBevel)) { BL::ShaderNodeBevel b_bevel_node(b_node); BevelNode *bevel = graph->create_node<BevelNode>(); - bevel->samples = b_bevel_node.samples(); + bevel->set_samples(b_bevel_node.samples()); node = bevel; } else if (b_node.is_a(&RNA_ShaderNodeDisplacement)) { BL::ShaderNodeDisplacement b_disp_node(b_node); DisplacementNode *disp = graph->create_node<DisplacementNode>(); - disp->space = (NodeNormalMapSpace)b_disp_node.space(); + disp->set_space((NodeNormalMapSpace)b_disp_node.space()); node = disp; } else if (b_node.is_a(&RNA_ShaderNodeVectorDisplacement)) { BL::ShaderNodeVectorDisplacement b_disp_node(b_node); VectorDisplacementNode *disp = graph->create_node<VectorDisplacementNode>(); - disp->space = (NodeNormalMapSpace)b_disp_node.space(); - disp->attribute = ""; + disp->set_space((NodeNormalMapSpace)b_disp_node.space()); + disp->set_attribute(ustring("")); node = disp; } else if (b_node.is_a(&RNA_ShaderNodeOutputAOV)) { BL::ShaderNodeOutputAOV b_aov_node(b_node); OutputAOVNode *aov = graph->create_node<OutputAOVNode>(); - aov->name = b_aov_node.name(); + aov->set_name(ustring(b_aov_node.name())); node = aov; } @@ -1245,7 +1264,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) ShaderGraph *graph = new ShaderGraph(); shader->name = b_mat.name().c_str(); - shader->pass_id = b_mat.pass_index(); + shader->set_pass_id(b_mat.pass_index()); /* create nodes */ if (b_mat.use_nodes() && b_mat.node_tree()) { @@ -1255,7 +1274,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) } else { DiffuseBsdfNode *diffuse = graph->create_node<DiffuseBsdfNode>(); - diffuse->color = get_float3(b_mat.diffuse_color()); + diffuse->set_color(get_float3(b_mat.diffuse_color())); graph->add(diffuse); ShaderNode *out = graph->output(); @@ -1264,13 +1283,13 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) /* settings */ PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles"); - shader->use_mis = get_boolean(cmat, "sample_as_light"); - shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow"); - shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume"); - shader->volume_sampling_method = get_volume_sampling(cmat); - shader->volume_interpolation_method = get_volume_interpolation(cmat); - shader->volume_step_rate = get_float(cmat, "volume_step_rate"); - shader->displacement_method = get_displacement_method(cmat); + shader->set_use_mis(get_boolean(cmat, "sample_as_light")); + shader->set_use_transparent_shadow(get_boolean(cmat, "use_transparent_shadow")); + shader->set_heterogeneous_volume(!get_boolean(cmat, "homogeneous_volume")); + shader->set_volume_sampling_method(get_volume_sampling(cmat)); + shader->set_volume_interpolation_method(get_volume_interpolation(cmat)); + shader->set_volume_step_rate(get_float(cmat, "volume_step_rate")); + shader->set_displacement_method(get_displacement_method(cmat)); shader->set_graph(graph); @@ -1311,7 +1330,6 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all) void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all) { Background *background = scene->background; - Background prevbackground = *background; BL::World b_world = b_scene.world(); @@ -1331,14 +1349,14 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, /* volume */ PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); - shader->heterogeneous_volume = !get_boolean(cworld, "homogeneous_volume"); - shader->volume_sampling_method = get_volume_sampling(cworld); - shader->volume_interpolation_method = get_volume_interpolation(cworld); - shader->volume_step_rate = get_float(cworld, "volume_step_size"); + shader->set_heterogeneous_volume(!get_boolean(cworld, "homogeneous_volume")); + shader->set_volume_sampling_method(get_volume_sampling(cworld)); + shader->set_volume_interpolation_method(get_volume_interpolation(cworld)); + shader->set_volume_step_rate(get_float(cworld, "volume_step_size")); } else if (new_viewport_parameters.use_scene_world && b_world) { BackgroundNode *background = graph->create_node<BackgroundNode>(); - background->color = get_float3(b_world.color()); + background->set_color(get_float3(b_world.color())); graph->add(background); ShaderNode *out = graph->output(); @@ -1360,29 +1378,32 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, graph->add(light_path); MixNode *mix_scene_with_background = graph->create_node<MixNode>(); - mix_scene_with_background->color2 = world_color; + mix_scene_with_background->set_color2(world_color); graph->add(mix_scene_with_background); EnvironmentTextureNode *texture_environment = graph->create_node<EnvironmentTextureNode>(); - texture_environment->tex_mapping.type = TextureMapping::VECTOR; - texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z; - texture_environment->filename = new_viewport_parameters.studiolight_path; + texture_environment->set_tex_mapping_type(TextureMapping::VECTOR); + float3 rotation_z = texture_environment->get_tex_mapping_rotation(); + rotation_z[2] = new_viewport_parameters.studiolight_rotate_z; + texture_environment->set_tex_mapping_rotation(rotation_z); + texture_environment->set_filename(new_viewport_parameters.studiolight_path); graph->add(texture_environment); MixNode *mix_intensity = graph->create_node<MixNode>(); - mix_intensity->type = NODE_MIX_MUL; - mix_intensity->fac = 1.0f; - mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity, - new_viewport_parameters.studiolight_intensity, - new_viewport_parameters.studiolight_intensity); + mix_intensity->set_mix_type(NODE_MIX_MUL); + mix_intensity->set_fac(1.0f); + mix_intensity->set_color2(make_float3(new_viewport_parameters.studiolight_intensity, + new_viewport_parameters.studiolight_intensity, + new_viewport_parameters.studiolight_intensity)); graph->add(mix_intensity); TextureCoordinateNode *texture_coordinate = graph->create_node<TextureCoordinateNode>(); graph->add(texture_coordinate); MixNode *mix_background_with_environment = graph->create_node<MixNode>(); - mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha; - mix_background_with_environment->color1 = world_color; + mix_background_with_environment->set_fac( + new_viewport_parameters.studiolight_background_alpha); + mix_background_with_environment->set_color1(world_color); graph->add(mix_background_with_environment); ShaderNode *out = graph->output(); @@ -1404,9 +1425,9 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, /* AO */ BL::WorldLighting b_light = b_world.light_settings(); - background->use_ao = b_light.use_ambient_occlusion(); - background->ao_factor = b_light.ao_factor(); - background->ao_distance = b_light.distance(); + background->set_use_ao(b_light.use_ambient_occlusion()); + background->set_ao_factor(b_light.ao_factor()); + background->set_ao_distance(b_light.distance()); /* visibility */ PointerRNA cvisibility = RNA_pointer_get(&b_world.ptr, "cycles_visibility"); @@ -1418,12 +1439,12 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, visibility |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0; visibility |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0; - background->visibility = visibility; + background->set_visibility(visibility); } else { - background->use_ao = false; - background->ao_factor = 0.0f; - background->ao_distance = FLT_MAX; + background->set_use_ao(false); + background->set_ao_factor(0.0f); + background->set_ao_distance(FLT_MAX); } shader->set_graph(graph); @@ -1432,22 +1453,23 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, } PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); - background->transparent = b_scene.render().film_transparent(); + background->set_transparent(b_scene.render().film_transparent()); - if (background->transparent) { - background->transparent_glass = get_boolean(cscene, "film_transparent_glass"); - background->transparent_roughness_threshold = get_float(cscene, "film_transparent_roughness"); + if (background->get_transparent()) { + background->set_transparent_glass(get_boolean(cscene, "film_transparent_glass")); + background->set_transparent_roughness_threshold( + get_float(cscene, "film_transparent_roughness")); } else { - background->transparent_glass = false; - background->transparent_roughness_threshold = 0.0f; + background->set_transparent_glass(false); + background->set_transparent_roughness_threshold(0.0f); } - background->use_shader = view_layer.use_background_shader | - viewport_parameters.custom_viewport_parameters(); - background->use_ao = background->use_ao && view_layer.use_background_ao; + background->set_use_shader(view_layer.use_background_shader | + viewport_parameters.custom_viewport_parameters()); + background->set_use_ao(background->get_use_ao() && view_layer.use_background_ao); - if (background->modified(prevbackground)) + if (background->is_modified()) background->tag_update(scene); } @@ -1480,8 +1502,8 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all) } else { EmissionNode *emission = graph->create_node<EmissionNode>(); - emission->color = make_float3(1.0f, 1.0f, 1.0f); - emission->strength = 1.0f; + emission->set_color(make_float3(1.0f, 1.0f, 1.0f)); + emission->set_strength(1.0f); graph->add(emission); ShaderNode *out = graph->output(); |