summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2022-12-22 20:25:17 -0700
committerclayjohn <claynjohn@gmail.com>2022-12-22 20:25:17 -0700
commit1cc232ea4e9d64abbdd9d9ccd6c942599c1f2107 (patch)
tree963e2b42fc9f867df128d21bbd3e20d02f3d6747
parentc547c4ef5908b9d591497e40217200ecb12e0ebd (diff)
Remove compatibility code for MeshInstance3D surface override material
-rw-r--r--scene/3d/mesh_instance_3d.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 16de95bfb1..c4ec54fa8f 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -53,18 +53,7 @@ bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) {
if (p_name.operator String().begins_with("surface_material_override/")) {
int idx = p_name.operator String().get_slicec('/', 1).to_int();
- // This is a bit of a hack to ensure compatibility with material
- // overrides that start indexing at 1.
- // We assume that idx 0 is always read first, if its not, this won't work.
- if (idx == 0) {
- surface_index_0 = true;
- }
- if (!surface_index_0) {
- // This means the file was created when the indexing started at 1, so decrease by one.
- idx--;
- }
-
- if (idx > surface_override_materials.size() || idx < 0) {
+ if (idx >= surface_override_materials.size() || idx < 0) {
return false;
}