Setting the visible multimesh instance to -1 so that they are updated correctly on set_amount.

When emitting stops CPUParticles3D::_set_redraw(bool p_redraw) will set that value to 0 so when you change the amount after that it will actually not update correclty.

This fixes an issue where if it was not emitting when the scene loaded and it start after that the amount is not reflected correclty. This also happened when you checked out the box for emitting in the editor, changed the value of amount and then checked on the box for emitting. With this change if it is emitting during the change it does interrupt the previous particles when you change. The amount and the emit starts from beginning but that is to be expected on an amount of particles change.
This commit is contained in:
Hristo Stamenov 2021-10-24 19:38:47 +03:00
parent 80801e5f66
commit 3ec927cfef

View file

@ -73,6 +73,7 @@ void CPUParticles3D::set_amount(int p_amount) {
}
particle_data.resize((12 + 4 + 4) * p_amount);
RS::get_singleton()->multimesh_set_visible_instances(multimesh, -1);
RS::get_singleton()->multimesh_allocate_data(multimesh, p_amount, RS::MULTIMESH_TRANSFORM_3D, true, true);
particle_order.resize(p_amount);