mirror of
https://github.com/godotengine/godot.git
synced 2024-12-09 10:09:20 +08:00
Avoid error spam when (un)pausing GPUParticles out of tree
This commit is contained in:
parent
7b1387ff21
commit
991f4d5183
@ -551,11 +551,13 @@ void GPUParticles2D::_notification(int p_what) {
|
|||||||
|
|
||||||
case NOTIFICATION_PAUSED:
|
case NOTIFICATION_PAUSED:
|
||||||
case NOTIFICATION_UNPAUSED: {
|
case NOTIFICATION_UNPAUSED: {
|
||||||
|
if (is_inside_tree()) {
|
||||||
if (can_process()) {
|
if (can_process()) {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
} else {
|
} else {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
|
@ -417,15 +417,6 @@ NodePath GPUParticles3D::get_sub_emitter() const {
|
|||||||
|
|
||||||
void GPUParticles3D::_notification(int p_what) {
|
void GPUParticles3D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_PAUSED:
|
|
||||||
case NOTIFICATION_UNPAUSED: {
|
|
||||||
if (can_process()) {
|
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
|
||||||
} else {
|
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
// Use internal process when emitting and one_shot is on so that when
|
// Use internal process when emitting and one_shot is on so that when
|
||||||
// the shot ends the editor can properly update.
|
// the shot ends the editor can properly update.
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
@ -450,6 +441,17 @@ void GPUParticles3D::_notification(int p_what) {
|
|||||||
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_PAUSED:
|
||||||
|
case NOTIFICATION_UNPAUSED: {
|
||||||
|
if (is_inside_tree()) {
|
||||||
|
if (can_process()) {
|
||||||
|
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
|
} else {
|
||||||
|
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
// Make sure particles are updated before rendering occurs if they were active before.
|
// Make sure particles are updated before rendering occurs if they were active before.
|
||||||
if (is_visible_in_tree() && !RS::get_singleton()->particles_is_inactive(particles)) {
|
if (is_visible_in_tree() && !RS::get_singleton()->particles_is_inactive(particles)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user