1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Fix MultiMesh visible_instance_count being ignored after the first frame

Co-authored-by: Clay John <claynjohn@gmail.com>
This commit is contained in:
Ricardo Buring
2022-12-10 21:57:44 +01:00
committed by clayjohn
parent 604493eb6e
commit 497f5576c1
3 changed files with 12 additions and 6 deletions

View File

@@ -1805,8 +1805,12 @@ void MeshStorage::multimesh_set_visible_instances(RID p_multimesh, int p_visible
}
if (multimesh->data_cache.size()) {
//there is a data cache..
// There is a data cache, but we may need to update some sections.
_multimesh_mark_all_dirty(multimesh, false, true);
int start = multimesh->visible_instances >= 0 ? multimesh->visible_instances : multimesh->instances;
for (int i = start; i < p_visible; i++) {
_multimesh_mark_dirty(multimesh, i, true);
}
}
multimesh->visible_instances = p_visible;