summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Viewport.xml2
-rw-r--r--editor/debugger/editor_profiler.cpp6
-rw-r--r--editor/debugger/editor_visual_profiler.cpp6
-rw-r--r--editor/filesystem_dock.cpp133
-rw-r--r--editor/filesystem_dock.h19
-rw-r--r--misc/extension_api_validation/4.0-stable.expected8
-rw-r--r--modules/gltf/doc_classes/GLTFSkeleton.xml2
-rw-r--r--scene/gui/spin_box.cpp3
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/main/viewport.h2
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp2
11 files changed, 157 insertions, 28 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index d363a11550..66df40c18f 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -115,7 +115,7 @@
Returns the drag data from the GUI, that was previously returned by [method Control._get_drag_data].
</description>
</method>
- <method name="gui_get_focus_owner">
+ <method name="gui_get_focus_owner" qualifiers="const">
<return type="Control" />
<description>
Returns the [Control] having the focus within this viewport. If no [Control] has the focus, returns null.
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index b0d6135d52..c81518057a 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -660,15 +660,15 @@ EditorProfiler::EditorProfiler() {
variables->set_column_title(0, TTR("Name"));
variables->set_column_expand(0, true);
variables->set_column_clip_content(0, true);
- variables->set_column_expand_ratio(0, 60);
+ variables->set_column_custom_minimum_width(0, 60);
variables->set_column_title(1, TTR("Time"));
variables->set_column_expand(1, false);
variables->set_column_clip_content(1, true);
- variables->set_column_expand_ratio(1, 100);
+ variables->set_column_custom_minimum_width(1, 75 * EDSCALE);
variables->set_column_title(2, TTR("Calls"));
variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true);
- variables->set_column_expand_ratio(2, 60);
+ variables->set_column_custom_minimum_width(2, 50 * EDSCALE);
variables->connect("item_edited", callable_mp(this, &EditorProfiler::_item_edited));
graph = memnew(TextureRect);
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 1a06e85f90..2ecb029f1a 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -114,7 +114,7 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) {
int dmode = display_mode->get_selected();
if (dmode == DISPLAY_FRAME_TIME) {
- return TS->format_number(rtos(p_time)) + " " + RTR("ms");
+ return TS->format_number(String::num(p_time, 2)) + " " + RTR("ms");
} else if (dmode == DISPLAY_FRAME_PERCENT) {
return TS->format_number(String::num(p_time * 100 / graph_limit, 2)) + " " + TS->percent_sign();
}
@@ -790,11 +790,11 @@ EditorVisualProfiler::EditorVisualProfiler() {
variables->set_column_title(1, TTR("CPU"));
variables->set_column_expand(1, false);
variables->set_column_clip_content(1, true);
- variables->set_column_custom_minimum_width(1, 60 * EDSCALE);
+ variables->set_column_custom_minimum_width(1, 75 * EDSCALE);
variables->set_column_title(2, TTR("GPU"));
variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true);
- variables->set_column_custom_minimum_width(2, 60 * EDSCALE);
+ variables->set_column_custom_minimum_width(2, 75 * EDSCALE);
variables->connect("cell_selected", callable_mp(this, &EditorVisualProfiler::_item_selected));
graph = memnew(TextureRect);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index f21229edc8..b0351d1598 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -76,6 +76,94 @@ Control *FileSystemList::make_custom_tooltip(const String &p_text) const {
return FileSystemDock::get_singleton()->create_tooltip_for_path(get_item_metadata(idx));
}
+void FileSystemList::_line_editor_submit(String p_text) {
+ popup_editor->hide();
+
+ emit_signal(SNAME("item_edited"));
+ queue_redraw();
+}
+
+bool FileSystemList::edit_selected() {
+ ERR_FAIL_COND_V_MSG(!is_anything_selected(), false, "No item selected.");
+ int s = get_current();
+ ensure_current_is_visible();
+
+ Rect2 rect;
+ Rect2 popup_rect;
+ Vector2 ofs;
+
+ Vector2 icon_size = get_item_icon(s)->get_size();
+
+ // Handles the different icon modes (TOP/LEFT).
+ switch (get_icon_mode()) {
+ case ItemList::ICON_MODE_LEFT:
+ rect = get_item_rect(s, true);
+ ofs = Vector2(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height) - rect.size.height) / 2));
+ popup_rect.position = get_screen_position() + rect.position - ofs;
+ popup_rect.size = rect.size;
+
+ // Adjust for icon position and size.
+ popup_rect.size.x -= icon_size.x;
+ popup_rect.position.x += icon_size.x;
+ break;
+ case ItemList::ICON_MODE_TOP:
+ rect = get_item_rect(s, false);
+ popup_rect.position = get_screen_position() + rect.position;
+ popup_rect.size = rect.size;
+
+ // Adjust for icon position and size.
+ popup_rect.size.y -= icon_size.y;
+ popup_rect.position.y += icon_size.y;
+ break;
+ }
+
+ popup_editor->set_position(popup_rect.position);
+ popup_editor->set_size(popup_rect.size);
+
+ String name = get_item_text(s);
+ line_editor->set_text(name);
+ line_editor->select(0, name.rfind("."));
+
+ popup_editor->popup();
+ popup_editor->child_controls_changed();
+ line_editor->grab_focus();
+ return true;
+}
+
+String FileSystemList::get_edit_text() {
+ return line_editor->get_text();
+}
+
+void FileSystemList::_text_editor_popup_modal_close() {
+ if (Input::get_singleton()->is_key_pressed(Key::ESCAPE) ||
+ Input::get_singleton()->is_key_pressed(Key::KP_ENTER) ||
+ Input::get_singleton()->is_key_pressed(Key::ENTER)) {
+ return;
+ }
+
+ _line_editor_submit(line_editor->get_text());
+}
+
+void FileSystemList::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("item_edited"));
+}
+
+FileSystemList::FileSystemList() {
+ popup_editor = memnew(Popup);
+ add_child(popup_editor);
+
+ popup_editor_vb = memnew(VBoxContainer);
+ popup_editor_vb->add_theme_constant_override("separation", 0);
+ popup_editor_vb->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
+ popup_editor->add_child(popup_editor_vb);
+
+ line_editor = memnew(LineEdit);
+ line_editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ popup_editor_vb->add_child(line_editor);
+ line_editor->connect("text_submitted", callable_mp(this, &FileSystemList::_line_editor_submit));
+ popup_editor->connect("popup_hide", callable_mp(this, &FileSystemList::_text_editor_popup_modal_close));
+}
+
FileSystemDock *FileSystemDock::singleton = nullptr;
Ref<Texture2D> FileSystemDock::_get_tree_item_icon(bool p_is_valid, String p_file_type) {
@@ -1581,13 +1669,15 @@ void FileSystemDock::_folder_removed(String p_folder) {
}
void FileSystemDock::_rename_operation_confirm() {
- if (!tree->is_anything_selected()) {
- return;
- }
+ String new_name;
TreeItem *s = tree->get_selected();
int col_index = tree->get_selected_column();
- String new_name = s->get_text(col_index);
- new_name = new_name.strip_edges();
+
+ if (tree->has_focus()) {
+ new_name = s->get_text(col_index).strip_edges();
+ } else if (files->has_focus()) {
+ new_name = files->get_edit_text().strip_edges();
+ }
String old_name = to_rename.is_file ? to_rename.path.get_file() : to_rename.path.left(-1).get_file();
bool rename_error = false;
@@ -1607,10 +1697,12 @@ void FileSystemDock::_rename_operation_confirm() {
}
}
- // Restores Tree to restore original names.
- if (rename_error) {
+ // Restore original name.
+ if (rename_error && tree->has_focus()) {
s->set_text(col_index, old_name);
return;
+ } else if (rename_error && files->has_focus()) {
+ return;
}
String old_path = to_rename.path.ends_with("/") ? to_rename.path.left(-1) : to_rename.path;
@@ -2032,21 +2124,27 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
} break;
case FILE_RENAME: {
- if (tree->is_anything_selected() && !p_selected.is_empty()) {
+ if (!p_selected.is_empty()) {
// Set to_rename variable for callback execution.
to_rename.path = p_selected[0];
to_rename.is_file = !to_rename.path.ends_with("/");
+ if (to_rename.path == "res://") {
+ break;
+ }
- // Edit node in Tree.
- tree->grab_focus();
- tree->edit_selected(true);
+ if (tree->has_focus()) {
+ // Edit node in Tree.
+ tree->edit_selected(true);
- if (to_rename.is_file) {
- String name = to_rename.path.get_file();
- tree->set_editor_selection(0, name.rfind("."));
- } else {
- String name = to_rename.path.left(-1).get_file(); // Removes the "/" suffix for folders.
- tree->set_editor_selection(0, name.length());
+ if (to_rename.is_file) {
+ String name = to_rename.path.get_file();
+ tree->set_editor_selection(0, name.rfind("."));
+ } else {
+ String name = to_rename.path.left(-1).get_file(); // Removes the "/" suffix for folders.
+ tree->set_editor_selection(0, name.length());
+ }
+ } else if (files->has_focus()) {
+ files->edit_selected();
}
}
} break;
@@ -3329,6 +3427,7 @@ FileSystemDock::FileSystemDock() {
files->connect("gui_input", callable_mp(this, &FileSystemDock::_file_list_gui_input));
files->connect("multi_selected", callable_mp(this, &FileSystemDock::_file_multi_selected));
files->connect("empty_clicked", callable_mp(this, &FileSystemDock::_file_list_empty_clicked));
+ files->connect("item_edited", callable_mp(this, &FileSystemDock::_rename_operation_confirm));
files->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
files->set_allow_rmb_select(true);
file_list_vb->add_child(files);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 480e0db84d..0af3193aa5 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -57,7 +57,24 @@ class FileSystemTree : public Tree {
};
class FileSystemList : public ItemList {
- virtual Control *make_custom_tooltip(const String &p_text) const;
+ GDCLASS(FileSystemList, ItemList);
+
+ VBoxContainer *popup_editor_vb = nullptr;
+ Popup *popup_editor = nullptr;
+ LineEdit *line_editor = nullptr;
+
+ virtual Control *make_custom_tooltip(const String &p_text) const override;
+ void _line_editor_submit(String p_text);
+ void _text_editor_popup_modal_close();
+
+protected:
+ static void _bind_methods();
+
+public:
+ bool edit_selected();
+ String get_edit_text();
+
+ FileSystemList();
};
class FileSystemDock : public VBoxContainer {
diff --git a/misc/extension_api_validation/4.0-stable.expected b/misc/extension_api_validation/4.0-stable.expected
index 88d41160ce..2dad9359d4 100644
--- a/misc/extension_api_validation/4.0-stable.expected
+++ b/misc/extension_api_validation/4.0-stable.expected
@@ -6,6 +6,14 @@ should instead be used to justify these changes and describe how users should wo
========================================================================================================================
+GH-77757
+--------
+Validate extension JSON: Error: Field 'classes/Viewport/methods/gui_get_focus_owner': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Hash changed for 'classes/Viewport/methods/gui_get_focus_owner', from 31757941 to A5E188F5. This means that the function has changed and no compatibility function was provided.
+
+This method does not affect the state of Viewport so it should be const.
+
+
GH-74736
--------
Validate extension JSON: Error: Field 'classes/MenuBar/properties/start_index': type changed value in new API, from "bool" to "int".
diff --git a/modules/gltf/doc_classes/GLTFSkeleton.xml b/modules/gltf/doc_classes/GLTFSkeleton.xml
index eb06249e45..8073db3ce9 100644
--- a/modules/gltf/doc_classes/GLTFSkeleton.xml
+++ b/modules/gltf/doc_classes/GLTFSkeleton.xml
@@ -21,6 +21,7 @@
<method name="get_godot_bone_node">
<return type="Dictionary" />
<description>
+ Returns a [Dictionary] that maps skeleton bone indices to the indices of GLTF nodes. This property is unused during import, and only set during export. In a GLTF file, a bone is a node, so Godot converts skeleton bones to GLTF nodes.
</description>
</method>
<method name="get_godot_skeleton">
@@ -37,6 +38,7 @@
<return type="void" />
<param index="0" name="godot_bone_node" type="Dictionary" />
<description>
+ Sets a [Dictionary] that maps skeleton bone indices to the indices of GLTF nodes. This property is unused during import, and only set during export. In a GLTF file, a bone is a node, so Godot converts skeleton bones to GLTF nodes.
</description>
</method>
<method name="set_unique_names">
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index a0c8f7c91f..4f4754add5 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -202,7 +202,8 @@ void SpinBox::_line_edit_focus_enter() {
void SpinBox::_line_edit_focus_exit() {
// Discontinue because the focus_exit was caused by left-clicking the arrows.
- if (get_viewport()->gui_get_focus_owner() == get_line_edit()) {
+ const Viewport *viewport = get_viewport();
+ if (!viewport || viewport->gui_get_focus_owner() == get_line_edit()) {
return;
}
// Discontinue because the focus_exit was caused by right-click context menu.
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e7970b212e..8fcf9e84c4 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -3156,7 +3156,7 @@ void Viewport::gui_release_focus() {
}
}
-Control *Viewport::gui_get_focus_owner() {
+Control *Viewport::gui_get_focus_owner() const {
ERR_READ_THREAD_GUARD_V(nullptr);
return gui.key_focus;
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 63cddddbcb..1cb32d4509 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -599,7 +599,7 @@ public:
int gui_get_canvas_sort_index();
void gui_release_focus();
- Control *gui_get_focus_owner();
+ Control *gui_get_focus_owner() const;
PackedStringArray get_configuration_warnings() const override;
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index bac788d0e9..eea891792a 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -1699,6 +1699,8 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
scene_state.used_normal_texture) {
depth_pass_mode = PASS_MODE_DEPTH_NORMAL_ROUGHNESS;
}
+ } else if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER || scene_state.used_normal_texture) {
+ depth_pass_mode = PASS_MODE_DEPTH_NORMAL_ROUGHNESS;
}
switch (depth_pass_mode) {