diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-11-08 15:58:52 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-11-08 15:58:52 -0300 |
commit | 555fb3a31749b19829588391794bfc57364e070a (patch) | |
tree | d6cf95364b5bd4a6e0a786fe7611966e821492d8 /servers/visual/visual_server_scene.cpp | |
parent | d403b4086c514647bba7620591061b7de7dfaf4b (diff) |
Effectively ensure that surface materials are the right size when setting them, fixes #23596
Diffstat (limited to 'servers/visual/visual_server_scene.cpp')
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 654994b83f..33fa8d365f 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -601,8 +601,9 @@ void VisualServerScene::instance_set_surface_material(RID p_instance, int p_surf Instance *instance = instance_owner.get(p_instance); ERR_FAIL_COND(!instance); - if (instance->update_item.in_list()) { - _update_dirty_instance(instance); + if (instance->base_type == VS::INSTANCE_MESH) { + //may not have been updated yet + instance->materials.resize(VSG::storage->mesh_get_surface_count(instance->base)); } ERR_FAIL_INDEX(p_surface, instance->materials.size()); |