Skip to content

Commit 91027cf

Browse files
committed
Support setting old material/# properties on MeshInstance3D
1 parent babc272 commit 91027cf

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

scene/3d/mesh_instance_3d.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,19 @@ bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) {
7070
return true;
7171
}
7272

73-
if (p_name.operator String().begins_with("surface_material_override/")) {
74-
int idx = p_name.operator String().get_slicec('/', 1).to_int();
73+
String name = p_name;
74+
75+
#ifndef DISABLE_DEPRECATED
76+
if (name.begins_with("material/")) {
77+
WARN_DEPRECATED_MSG("This mesh uses an old deprecated parameter name. Consider re-saving this scene in order for it to continue working in future versions." +
78+
(is_inside_tree() ? vformat(" Path: \"%s\"", get_path()) : (get_name().is_empty() ? String() : vformat(" Name: \"%s\"", get_name()))));
79+
}
80+
if (name.begins_with("surface_material_override/") || name.begins_with("material/"))
81+
#else
82+
if (name.begins_with("surface_material_override/"))
83+
#endif
84+
{
85+
int idx = name.get_slicec('/', 1).to_int();
7586

7687
if (idx >= surface_override_materials.size() || idx < 0) {
7788
return false;

0 commit comments

Comments
 (0)