summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/visibility_notifier_2d.cpp21
-rw-r--r--scene/3d/visibility_notifier.cpp10
-rw-r--r--scene/gui/line_edit.cpp18
3 files changed, 23 insertions, 26 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) {
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index 986607f18d..5bc568bd5d 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -150,8 +150,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) {
bool add = false;
Variant meta;
- if (enabler[ENABLER_FREEZE_BODIES]) {
-
+ {
RigidBody *rb = Object::cast_to<RigidBody>(p_node);
if (rb && ((rb->get_mode() == RigidBody::MODE_CHARACTER || rb->get_mode() == RigidBody::MODE_RIGID))) {
@@ -160,8 +159,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) {
}
}
- if (enabler[ENABLER_PAUSE_ANIMATIONS]) {
-
+ {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
add = true;
@@ -219,14 +217,14 @@ void VisibilityEnabler::_change_node_state(Node *p_node, bool p_enabled) {
ERR_FAIL_COND(!nodes.has(p_node));
- {
+ if (enabler[ENABLER_FREEZE_BODIES]) {
RigidBody *rb = Object::cast_to<RigidBody>(p_node);
if (rb)
rb->set_sleeping(!p_enabled);
}
- {
+ if (enabler[ENABLER_PAUSE_ANIMATIONS]) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index fdddf0b5fa..73380c6b1b 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1093,7 +1093,11 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
int char_w = 0;
if (font != NULL) {
- char_w = font->get_char_size(text[ofs]).width;
+ if (is_secret()) {
+ char_w = font->get_char_size(secret_character[0]).width;
+ } else {
+ char_w = font->get_char_size(text[ofs]).width;
+ }
}
pixel_ofs += char_w;
@@ -1710,13 +1714,11 @@ void LineEdit::update_cached_width() {
}
void LineEdit::update_placeholder_width() {
- if ((max_length <= 0) || (placeholder_translated.length() <= max_length)) {
- Ref<Font> font = get_font("font");
- cached_placeholder_width = 0;
- if (font != NULL) {
- for (int i = 0; i < placeholder_translated.length(); i++) {
- cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width;
- }
+ Ref<Font> font = get_font("font");
+ cached_placeholder_width = 0;
+ if (font != NULL) {
+ for (int i = 0; i < placeholder_translated.length(); i++) {
+ cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width;
}
}
}