Ability to pause particles, closes #3675
This commit is contained in:
parent
1f638b206e
commit
bb47bca1f6
3 changed files with 22 additions and 0 deletions
|
@ -300,6 +300,15 @@ void Particles2D::_notification(int p_what) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
|
||||||
|
if (can_process()) {
|
||||||
|
VS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
VS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
||||||
_update_particle_emission_transform();
|
_update_particle_emission_transform();
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,6 +266,18 @@ void Particles::_validate_property(PropertyInfo &property) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Particles::_notification(int p_what) {
|
||||||
|
|
||||||
|
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
|
||||||
|
if (can_process()) {
|
||||||
|
VS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
VS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Particles::_bind_methods() {
|
void Particles::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles::set_emitting);
|
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles::set_emitting);
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
void _notification(int p_what);
|
||||||
virtual void _validate_property(PropertyInfo &property) const;
|
virtual void _validate_property(PropertyInfo &property) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue