EEVEE: Alias/remove legacy RNA material attributes
- `bpy.types.Material.blend_method` aliases `bpy.types.Material.surface_render_method`. 'Opaque' and 'Alpha Clip' maps to deferred. - Renamed `show_transparent_back` to `use_transparency_overlap` - Renamed `use_screen_refraction` to `use_raytrace_refraction` - Deprecate `use_sss_translucency` and `use_sss_translucency` Related to: #113976 **NOTE** The light probe changes will be done in a different patch. Both patches should land just before we remove EEVEE Legacy from the code-base. Pull Request: https://projects.blender.org/blender/blender/pulls/122297
This commit is contained in:
parent
8db709e149
commit
c7807a425a
@ -242,7 +242,7 @@ def transmission(mh, locs, pbr_node):
|
||||
|
||||
if factor > 0 or force_transmission is True:
|
||||
# Activate screen refraction (for Eevee)
|
||||
mh.mat.use_screen_refraction = True
|
||||
mh.mat.use_raytrace_refraction = True
|
||||
|
||||
scalar_factor_and_texture(
|
||||
mh,
|
||||
|
@ -705,7 +705,7 @@ class ShaderImageTextureWrapper():
|
||||
tree.links.new(node_image.outputs["Alpha" if self.use_alpha else "Color"], self.socket_dst)
|
||||
if self.use_alpha:
|
||||
self.owner_shader.material.blend_method = 'BLEND'
|
||||
self.owner_shader.material.show_transparent_back = False
|
||||
self.owner_shader.material.use_transparency_overlap = False
|
||||
|
||||
self._node_image = node_image
|
||||
return self._node_image
|
||||
|
@ -1132,8 +1132,10 @@ url_manual_mapping = (
|
||||
("bpy.types.linestyle*modifier_alongstroke*", "render/freestyle/view_layer/line_style/modifiers/color/along_stroke.html#bpy-types-linestyle-modifier-alongstroke"),
|
||||
("bpy.types.linestyle*modifier_creaseangle*", "render/freestyle/view_layer/line_style/modifiers/color/crease_angle.html#bpy-types-linestyle-modifier-creaseangle"),
|
||||
("bpy.types.linestylecolormodifier_tangent*", "render/freestyle/view_layer/line_style/modifiers/color/tangent.html#bpy-types-linestylecolormodifier-tangent"),
|
||||
("bpy.types.material.use_transparency_over*", "render/eevee/materials/settings.html#bpy-types-material-show-transparent-back"),
|
||||
("bpy.types.material.show_transparent_back*", "render/eevee/materials/settings.html#bpy-types-material-show-transparent-back"),
|
||||
("bpy.types.material.use_screen_refraction*", "render/eevee/materials/settings.html#bpy-types-material-use-screen-refraction"),
|
||||
("bpy.types.material.use_raytrace_refracti*", "render/eevee/materials/settings.html#bpy-types-material-use-screen-refraction"),
|
||||
("bpy.types.materialgpencilstyle.mix_color*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-mix-color"),
|
||||
("bpy.types.materialgpencilstyle.show_fill*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-show-fill"),
|
||||
("bpy.types.mesh.use_mirror_vertex_group_x*", "sculpt_paint/weight_paint/tool_settings/symmetry.html#bpy-types-mesh-use-mirror-vertex-group-x"),
|
||||
|
@ -923,7 +923,7 @@ class IMAGE_OT_import_as_mesh_planes(AddObjectHelper, ImportHelper, Operator):
|
||||
material.shadow_method = self.shadow_method
|
||||
|
||||
material.use_backface_culling = self.use_backface_culling
|
||||
material.show_transparent_back = self.show_transparent_back
|
||||
material.use_transparency_overlap = self.show_transparent_back
|
||||
|
||||
node_tree = material.node_tree
|
||||
out_node = clean_node_tree(node_tree)
|
||||
|
@ -263,7 +263,7 @@ def draw_material_settings(self, context):
|
||||
if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
|
||||
layout.prop(mat, "show_transparent_back")
|
||||
|
||||
layout.prop(mat, "use_screen_refraction")
|
||||
layout.prop(mat, "use_raytrace_refraction")
|
||||
layout.prop(mat, "refraction_depth")
|
||||
layout.prop(mat, "use_sss_translucency")
|
||||
layout.prop(mat, "pass_index")
|
||||
@ -334,9 +334,9 @@ class EEVEE_NEXT_MATERIAL_PT_settings_surface(MaterialButtonsPanel, Panel):
|
||||
col = layout.column()
|
||||
col.prop(mat, "surface_render_method", text="Render Method")
|
||||
if mat.surface_render_method == 'BLENDED':
|
||||
col.prop(mat, "show_transparent_back", text="Transparency Overlap")
|
||||
col.prop(mat, "use_transparency_overlap", text="Transparency Overlap")
|
||||
elif mat.surface_render_method == 'DITHERED':
|
||||
col.prop(mat, "use_screen_refraction", text="Raytraced Transmission")
|
||||
col.prop(mat, "use_raytrace_refraction", text="Raytraced Transmission")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(mat, "thickness_mode", text="Thickness")
|
||||
|
@ -191,6 +191,33 @@ static void rna_Material_active_paint_texture_index_update(bContext *C, PointerR
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
|
||||
}
|
||||
|
||||
static int rna_Material_blend_method_get(PointerRNA *ptr)
|
||||
{
|
||||
Material *material = (Material *)ptr->owner_id;
|
||||
switch (material->surface_render_method) {
|
||||
case MA_SURFACE_METHOD_DEFERRED:
|
||||
return MA_BM_HASHED;
|
||||
case MA_SURFACE_METHOD_FORWARD:
|
||||
return MA_BM_BLEND;
|
||||
}
|
||||
return MA_BM_HASHED;
|
||||
}
|
||||
|
||||
static void rna_Material_blend_method_set(PointerRNA *ptr, int new_blend_method)
|
||||
{
|
||||
Material *material = (Material *)ptr->owner_id;
|
||||
switch (new_blend_method) {
|
||||
case MA_BM_SOLID:
|
||||
case MA_BM_CLIP:
|
||||
case MA_BM_HASHED:
|
||||
material->surface_render_method = MA_SURFACE_METHOD_DEFERRED;
|
||||
break;
|
||||
case MA_BM_BLEND:
|
||||
material->surface_render_method = MA_SURFACE_METHOD_FORWARD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Material *ma = (Material *)ptr->data;
|
||||
@ -915,7 +942,12 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
/* Blending (only Eevee for now) */
|
||||
prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_eevee_blend_items);
|
||||
RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Blend Mode",
|
||||
"Blend Mode for Transparent Faces (Deprecated: use 'surface_render_method')");
|
||||
RNA_def_property_enum_funcs(
|
||||
prop, "rna_Material_blend_method_get", "rna_Material_blend_method_set", nullptr);
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MATERIAL);
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
@ -933,14 +965,24 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
# endif
|
||||
|
||||
/* TODO(fclem): Should be renamed to use_transparency_overlap. */
|
||||
prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "use_transparency_overlap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Show Backface",
|
||||
"Use Transparency Overlap",
|
||||
"Render multiple transparent layers "
|
||||
"(may introduce transparency sorting problems)");
|
||||
|
||||
# if 1 /* This should be deleted in Blender 4.5 */
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Show Backface",
|
||||
"Render multiple transparent layers "
|
||||
"(may introduce transparency sorting problems) (Deprecated: use 'use_tranparency_overlap')");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
# endif
|
||||
|
||||
prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE);
|
||||
@ -973,8 +1015,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
"Additionally helps rejecting probes inside the object to avoid light leaks");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
/* TODO(fclem): Should be renamed to use_raytraced_transmission. */
|
||||
prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "use_raytrace_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
@ -984,11 +1025,21 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
"setting");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
# if 1 /* Delete this section once we remove old eevee. */
|
||||
# if 1 /* This should be deleted in Blender 4.5 */
|
||||
prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Raytrace Transmission",
|
||||
"Use raytracing to determine transmitted color instead of using only light probes. "
|
||||
"This prevents the surface from contributing to the lighting of surfaces not using this "
|
||||
"setting (Deprecated: use 'use_raytrace_refraction')");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSLUCENCY);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Subsurface Translucency", "Add translucency effect to subsurface");
|
||||
prop, "Subsurface Translucency", "Add translucency effect to subsurface (Deprecated)");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
|
||||
@ -997,7 +1048,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Refraction Depth",
|
||||
"Approximate the thickness of the object to compute two refraction "
|
||||
"events (0 is disabled)");
|
||||
"events (0 is disabled) (Deprecated)");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
# endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user