summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/code_edit.cpp9
-rw-r--r--scene/gui/code_edit.h1
-rw-r--r--scene/gui/container.cpp6
-rw-r--r--scene/gui/container.h3
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/main/viewport.cpp10
-rw-r--r--scene/resources/canvas_item_material.cpp2
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/packed_scene.cpp2
-rw-r--r--scene/scene_string_names.cpp1
-rw-r--r--scene/scene_string_names.h1
12 files changed, 28 insertions, 15 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index b816f12bc3..da54903871 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -433,7 +433,7 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
return;
}
if (k->is_action("ui_end", true)) {
- code_completion_current_selected = MIN(code_completion_options.size() - 1, code_completion_current_selected + code_completion_max_lines);
+ code_completion_current_selected = code_completion_options.size() - 1;
update();
accept_event();
return;
@@ -2937,6 +2937,7 @@ void CodeEdit::_lines_edited_from(int p_from_line, int p_to_line) {
return;
}
+ lines_edited_changed += p_to_line - p_from_line;
lines_edited_from = (lines_edited_from == -1) ? MIN(p_from_line, p_to_line) : MIN(lines_edited_from, MIN(p_from_line, p_to_line));
lines_edited_to = (lines_edited_to == -1) ? MAX(p_from_line, p_to_line) : MAX(lines_edited_from, MAX(p_from_line, p_to_line));
}
@@ -2963,7 +2964,6 @@ void CodeEdit::_text_changed() {
}
lc = get_line_count();
- int line_change_size = (lines_edited_to - lines_edited_from);
List<int> breakpoints;
breakpointed_lines.get_key_list(&breakpoints);
for (const int &line : breakpoints) {
@@ -2974,8 +2974,8 @@ void CodeEdit::_text_changed() {
breakpointed_lines.erase(line);
emit_signal(SNAME("breakpoint_toggled"), line);
- int next_line = line + line_change_size;
- if (next_line < lc && is_line_breakpointed(next_line)) {
+ int next_line = line + lines_edited_changed;
+ if (next_line > -1 && next_line < lc && is_line_breakpointed(next_line)) {
emit_signal(SNAME("breakpoint_toggled"), next_line);
breakpointed_lines[next_line] = true;
continue;
@@ -2984,6 +2984,7 @@ void CodeEdit::_text_changed() {
lines_edited_from = -1;
lines_edited_to = -1;
+ lines_edited_changed = 0;
}
CodeEdit::CodeEdit() {
diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h
index d8eccb7d32..f0d971dd35 100644
--- a/scene/gui/code_edit.h
+++ b/scene/gui/code_edit.h
@@ -240,6 +240,7 @@ private:
int line_spacing = 1;
/* Callbacks */
+ int lines_edited_changed = 0;
int lines_edited_from = -1;
int lines_edited_to = -1;
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 11941529cd..a1bd82f6f7 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -87,6 +87,9 @@ void Container::_sort_children() {
return;
}
+ notification(NOTIFICATION_PRE_SORT_CHILDREN);
+ emit_signal(SceneStringNames::get_singleton()->pre_sort_children);
+
notification(NOTIFICATION_SORT_CHILDREN);
emit_signal(SceneStringNames::get_singleton()->sort_children);
pending_sort = false;
@@ -174,7 +177,10 @@ void Container::_bind_methods() {
ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort);
ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect);
+ BIND_CONSTANT(NOTIFICATION_PRE_SORT_CHILDREN);
BIND_CONSTANT(NOTIFICATION_SORT_CHILDREN);
+
+ ADD_SIGNAL(MethodInfo("pre_sort_children"));
ADD_SIGNAL(MethodInfo("sort_children"));
}
diff --git a/scene/gui/container.h b/scene/gui/container.h
index bce3085f0c..f3ae948556 100644
--- a/scene/gui/container.h
+++ b/scene/gui/container.h
@@ -51,7 +51,8 @@ protected:
public:
enum {
- NOTIFICATION_SORT_CHILDREN = 50
+ NOTIFICATION_PRE_SORT_CHILDREN = 50,
+ NOTIFICATION_SORT_CHILDREN = 51,
};
void fit_child_in_rect(Control *p_child, const Rect2 &p_rect);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 57bcbb7c2d..6370ea9c95 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2399,6 +2399,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
}
String TextEdit::get_tooltip(const Point2 &p_pos) const {
+ Object *tooltip_obj = ObjectDB::get_instance(tooltip_obj_id);
if (!tooltip_obj) {
return Control::get_tooltip(p_pos);
}
@@ -2421,7 +2422,8 @@ String TextEdit::get_tooltip(const Point2 &p_pos) const {
}
void TextEdit::set_tooltip_request_func(Object *p_obj, const StringName &p_function, const Variant &p_udata) {
- tooltip_obj = p_obj;
+ ERR_FAIL_NULL(p_obj);
+ tooltip_obj_id = p_obj->get_instance_id();
tooltip_func = p_function;
tooltip_ud = p_udata;
}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 07e585847a..3230de776f 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -330,7 +330,7 @@ private:
int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column) const;
/* Tooltip. */
- Object *tooltip_obj = nullptr;
+ ObjectID tooltip_obj_id;
StringName tooltip_func;
Variant tooltip_ud;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index b3b743370b..e88bb3b952 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -57,17 +57,17 @@
#include "servers/audio_server.h"
void ViewportTexture::setup_local_to_scene() {
+ Node *local_scene = get_local_scene();
+ if (!local_scene) {
+ return;
+ }
+
if (vp) {
vp->viewport_textures.erase(this);
}
vp = nullptr;
- Node *local_scene = get_local_scene();
- if (!local_scene) {
- return;
- }
-
Node *vpn = local_scene->get_node(path);
ERR_FAIL_COND_MSG(!vpn, "ViewportTexture: Path to node is invalid.");
diff --git a/scene/resources/canvas_item_material.cpp b/scene/resources/canvas_item_material.cpp
index fa95ab0e79..b291724c4c 100644
--- a/scene/resources/canvas_item_material.cpp
+++ b/scene/resources/canvas_item_material.cpp
@@ -135,7 +135,7 @@ void CanvasItemMaterial::_update_shader() {
code += " particle_frame = mod(particle_frame, particle_total_frames);\n";
code += " }";
code += " UV /= vec2(h_frames, v_frames);\n";
- code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
+ code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
code += "}\n";
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 66f04f0292..abb3381c4e 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -811,7 +811,7 @@ void BaseMaterial3D::_update_shader() {
code += " particle_frame = mod(particle_frame, particle_total_frames);\n";
code += " }";
code += " UV /= vec2(h_frames, v_frames);\n";
- code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
+ code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);\n";
} break;
case BILLBOARD_MAX:
break; // Internal value, skip.
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index c8d3ea5e37..60cda637ca 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -388,7 +388,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
editable_instances.push_back(p_owner->get_path_to(p_node));
// Node is the root of an editable instance.
is_editable_instance = true;
- } else if (p_node->get_owner() && p_node->get_owner() != p_owner && p_owner->is_editable_instance(p_node->get_owner())) {
+ } else if (p_node->get_owner() && p_owner->is_ancestor_of(p_node->get_owner()) && p_owner->is_editable_instance(p_node->get_owner())) {
// Node is part of an editable instance.
is_editable_instance = true;
}
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index b283749ffa..29e5dd6056 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -73,6 +73,7 @@ SceneStringNames::SceneStringNames() {
focus_entered = StaticCString::create("focus_entered");
focus_exited = StaticCString::create("focus_exited");
+ pre_sort_children = StaticCString::create("pre_sort_children");
sort_children = StaticCString::create("sort_children");
body_shape_entered = StaticCString::create("body_shape_entered");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 2923351eab..5e3195952e 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -89,6 +89,7 @@ public:
StringName focus_entered;
StringName focus_exited;
+ StringName pre_sort_children;
StringName sort_children;
StringName finished;