summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorTomasz Chabora <kobewi4e@gmail.com>2020-03-17 16:44:48 +0100
committerTomasz Chabora <kobewi4e@gmail.com>2020-03-17 17:46:18 +0100
commit2ccd1a7805b60c15615f2d989b17ef2007b946e8 (patch)
tree26a5abb8d184b066290481feda814d83a0b2cd57 /scene/2d
parent0159787864e7ecce60a4d3142f5c82e024710f89 (diff)
Fix visibility enabler flag toggling
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/visibility_notifier_2d.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 366de28386..54511bbe1b 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -188,8 +188,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) {
bool add = false;
Variant meta;
- if (enabler[ENABLER_FREEZE_BODIES]) {
-
+ {
RigidBody2D *rb2d = Object::cast_to<RigidBody2D>(p_node);
if (rb2d && ((rb2d->get_mode() == RigidBody2D::MODE_CHARACTER || rb2d->get_mode() == RigidBody2D::MODE_RIGID))) {
@@ -198,24 +197,21 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) {
}
}
- if (enabler[ENABLER_PAUSE_ANIMATIONS]) {
-
+ {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
add = true;
}
}
- if (enabler[ENABLER_PAUSE_ANIMATED_SPRITES]) {
-
+ {
AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node);
if (as) {
add = true;
}
}
- if (enabler[ENABLER_PAUSE_PARTICLES]) {
-
+ {
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
if (ps) {
add = true;
@@ -278,7 +274,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
ERR_FAIL_COND(!nodes.has(p_node));
- {
+ if (enabler[ENABLER_FREEZE_BODIES]) {
RigidBody2D *rb = Object::cast_to<RigidBody2D>(p_node);
if (rb) {
@@ -286,7 +282,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
}
}
- {
+ if (enabler[ENABLER_PAUSE_ANIMATIONS]) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
@@ -294,7 +290,8 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
ap->set_active(p_enabled);
}
}
- {
+
+ if (enabler[ENABLER_PAUSE_ANIMATED_SPRITES]) {
AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node);
if (as) {
@@ -306,7 +303,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
}
}
- {
+ if (enabler[ENABLER_PAUSE_PARTICLES]) {
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
if (ps) {