summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp97
-rw-r--r--editor/code_editor.h2
-rw-r--r--editor/connections_dialog.cpp131
-rw-r--r--editor/connections_dialog.h4
-rw-r--r--editor/create_dialog.cpp4
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.cpp2
-rw-r--r--editor/debugger/editor_profiler.cpp4
-rw-r--r--editor/debugger/editor_visual_profiler.cpp4
-rw-r--r--editor/editor_build_profile.cpp3
-rw-r--r--editor/editor_file_system.cpp14
-rw-r--r--editor/editor_node.cpp20
-rw-r--r--editor/editor_properties.cpp9
-rw-r--r--editor/editor_settings.cpp3
-rw-r--r--editor/editor_spin_slider.cpp2
-rw-r--r--editor/editor_themes.cpp4
-rw-r--r--editor/editor_zoom_widget.cpp10
-rw-r--r--editor/editor_zoom_widget.h2
-rw-r--r--editor/event_listener_line_edit.cpp13
-rw-r--r--editor/event_listener_line_edit.h4
-rw-r--r--editor/export/editor_export_platform.h1
-rw-r--r--editor/export/editor_export_platform_pc.cpp6
-rw-r--r--editor/export/project_export.cpp4
-rw-r--r--editor/groups_editor.cpp144
-rw-r--r--editor/groups_editor.h11
-rw-r--r--editor/icons/BoneMapHumanBody.svg27
-rw-r--r--editor/icons/Line.svg1
-rw-r--r--editor/import/resource_importer_layered_texture.cpp4
-rw-r--r--editor/import/resource_importer_scene.cpp237
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp3
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp4
-rw-r--r--editor/input_event_configuration_dialog.cpp4
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp36
-rw-r--r--editor/plugins/animation_player_editor_plugin.h1
-rw-r--r--editor/plugins/bone_map_editor_plugin.h1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp12
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h3
-rw-r--r--editor/plugins/curve_editor_plugin.cpp2
-rw-r--r--editor/plugins/editor_preview_plugins.cpp12
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp6
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp49
-rw-r--r--editor/plugins/node_3d_editor_plugin.h8
-rw-r--r--editor/plugins/script_text_editor.cpp95
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp105
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h10
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.cpp4
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp2
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp1
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp5
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp10
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.h2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
-rw-r--r--editor/project_converter_3_to_4.cpp28
-rw-r--r--editor/project_manager.cpp12
-rw-r--r--editor/scene_tree_dock.cpp9
57 files changed, 788 insertions, 414 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index b73b49a434..e328f76545 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -230,6 +230,14 @@ void FindReplaceBar::_replace_all() {
Point2i prev_match = Point2(-1, -1);
bool selection_enabled = text_editor->has_selection(0);
+ if (!is_selection_only()) {
+ text_editor->deselect();
+ selection_enabled = false;
+ } else {
+ result_line = -1;
+ result_col = -1;
+ }
+
Point2i selection_begin, selection_end;
if (selection_enabled) {
selection_begin = Point2i(text_editor->get_selection_from_line(0), text_editor->get_selection_from_column(0));
@@ -238,9 +246,6 @@ void FindReplaceBar::_replace_all() {
int vsval = text_editor->get_v_scroll();
- text_editor->set_caret_line(0, false, true, 0, 0);
- text_editor->set_caret_column(0, true, 0);
-
String repl_text = get_replace_text();
int search_text_len = get_search_text().length();
@@ -253,7 +258,11 @@ void FindReplaceBar::_replace_all() {
if (selection_enabled && is_selection_only()) {
text_editor->set_caret_line(selection_begin.width, false, true, 0, 0);
text_editor->set_caret_column(selection_begin.height, true, 0);
+ } else {
+ text_editor->set_caret_line(0, false, true, 0, 0);
+ text_editor->set_caret_column(0, true, 0);
}
+
if (search_current()) {
do {
// replace area
@@ -269,7 +278,7 @@ void FindReplaceBar::_replace_all() {
text_editor->unfold_line(result_line);
text_editor->select(result_line, result_col, result_line, match_to.y, 0);
- if (selection_enabled && is_selection_only()) {
+ if (selection_enabled) {
if (match_from < selection_begin || match_to > selection_end) {
break; // Done.
}
@@ -297,11 +306,9 @@ void FindReplaceBar::_replace_all() {
text_editor->set_caret_line(orig_cursor.x, false, true, 0, 0);
text_editor->set_caret_column(orig_cursor.y, true, 0);
- if (selection_enabled && is_selection_only()) {
+ if (selection_enabled) {
// Reselect.
text_editor->select(selection_begin.x, selection_begin.y, selection_end.x, selection_end.y, 0);
- } else {
- text_editor->deselect(0);
}
text_editor->set_v_scroll(vsval);
@@ -314,21 +321,28 @@ void FindReplaceBar::_replace_all() {
needs_to_count_results = true;
}
-void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
- r_line = text_editor->get_caret_line(0);
- r_col = text_editor->get_caret_column(0);
+void FindReplaceBar::_get_search_from(int &r_line, int &r_col, bool p_is_searching_next) {
+ if (!text_editor->has_selection(0) || is_selection_only()) {
+ r_line = text_editor->get_caret_line(0);
+ r_col = text_editor->get_caret_column(0);
- if (text_editor->has_selection(0) && is_selection_only()) {
+ if (!p_is_searching_next && r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) {
+ r_col = result_col;
+ }
return;
}
- if (r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) {
- r_col = result_col;
+ if (p_is_searching_next) {
+ r_line = text_editor->get_selection_to_line();
+ r_col = text_editor->get_selection_to_column();
+ } else {
+ r_line = text_editor->get_selection_from_line();
+ r_col = text_editor->get_selection_from_column();
}
}
void FindReplaceBar::_update_results_count() {
- if (!needs_to_count_results && (result_line != -1)) {
+ if (!needs_to_count_results && (result_line != -1) && results_count_to_current > 0) {
results_count_to_current += (flags & TextEdit::SEARCH_BACKWARDS) ? -1 : 1;
if (results_count_to_current > results_count) {
@@ -340,9 +354,6 @@ void FindReplaceBar::_update_results_count() {
return;
}
- results_count = 0;
- results_count_to_current = 0;
-
String searched = get_search_text();
if (searched.is_empty()) {
return;
@@ -350,6 +361,8 @@ void FindReplaceBar::_update_results_count() {
needs_to_count_results = false;
+ results_count = 0;
+
for (int i = 0; i < text_editor->get_line_count(); i++) {
String line_text = text_editor->get_line(i);
@@ -373,8 +386,13 @@ void FindReplaceBar::_update_results_count() {
results_count++;
- if (i == result_line && col_pos == result_col) {
- results_count_to_current = results_count;
+ if (i == result_line) {
+ if (col_pos == result_col) {
+ results_count_to_current = results_count;
+ } else if (col_pos < result_col && col_pos + searched.length() > result_col) {
+ col_pos = result_col;
+ results_count_to_current = results_count;
+ }
}
col_pos += searched.length();
@@ -392,10 +410,10 @@ void FindReplaceBar::_update_matches_label() {
if (results_count == 0) {
matches_label->set_text("No match");
- } else if (results_count == 1) {
- matches_label->set_text(vformat(TTR("%d match"), results_count));
+ } else if (results_count_to_current == -1) {
+ matches_label->set_text(vformat(TTRN("%d match", "%d matches", results_count), results_count));
} else {
- matches_label->set_text(vformat(TTR("%d of %d matches"), results_count_to_current, results_count));
+ matches_label->set_text(vformat(TTRN("%d of %d match", "%d of %d matches", results_count), results_count_to_current, results_count));
}
}
}
@@ -417,6 +435,10 @@ bool FindReplaceBar::search_current() {
}
bool FindReplaceBar::search_prev() {
+ if (is_selection_only() && !replace_all_mode) {
+ return false;
+ }
+
if (!is_visible()) {
popup_search(true);
}
@@ -435,9 +457,6 @@ bool FindReplaceBar::search_prev() {
int line, col;
_get_search_from(line, col);
- if (text_editor->has_selection(0)) {
- col--; // Skip currently selected word.
- }
col -= text.length();
if (col < 0) {
@@ -452,17 +471,15 @@ bool FindReplaceBar::search_prev() {
}
bool FindReplaceBar::search_next() {
+ if (is_selection_only() && !replace_all_mode) {
+ return false;
+ }
+
if (!is_visible()) {
popup_search(true);
}
flags = 0;
- String text;
- if (replace_all_mode) {
- text = get_replace_text();
- } else {
- text = get_search_text();
- }
if (is_whole_words()) {
flags |= TextEdit::SEARCH_WHOLE_WORDS;
@@ -472,18 +489,7 @@ bool FindReplaceBar::search_next() {
}
int line, col;
- _get_search_from(line, col);
-
- if (line == result_line && col == result_col) {
- col += text.length();
- if (col > text_editor->get_line(line).length()) {
- line += 1;
- if (line >= text_editor->get_line_count()) {
- line = 0;
- }
- col = 0;
- }
- }
+ _get_search_from(line, col, true);
return _search(flags, line, col);
}
@@ -513,8 +519,10 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) {
search_text->call_deferred(SNAME("grab_focus"));
}
- if (text_editor->has_selection(0) && !selection_only->is_pressed()) {
+ if (text_editor->has_selection(0) && !is_selection_only()) {
search_text->set_text(text_editor->get_selected_text(0));
+ result_line = text_editor->get_selection_from_line();
+ result_col = text_editor->get_selection_from_column();
}
if (!get_search_text().is_empty()) {
@@ -538,6 +546,7 @@ void FindReplaceBar::popup_search(bool p_show_only) {
replace_text->hide();
hbc_button_replace->hide();
hbc_option_replace->hide();
+ selection_only->set_pressed(false);
_show_search(false, p_show_only);
}
diff --git a/editor/code_editor.h b/editor/code_editor.h
index c3279e8764..ded7518287 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -92,7 +92,7 @@ class FindReplaceBar : public HBoxContainer {
bool replace_all_mode = false;
bool preserve_cursor = false;
- void _get_search_from(int &r_line, int &r_col);
+ void _get_search_from(int &r_line, int &r_col, bool p_is_searching_next = false);
void _update_results_count();
void _update_matches_label();
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 258ce434f6..de7f5c8b88 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_undo_redo_manager.h"
#include "editor/scene_tree_dock.h"
#include "plugins/script_editor_plugin.h"
+#include "scene/resources/packed_scene.h"
static Node *_find_first_script(Node *p_root, Node *p_node) {
if (p_node != p_root && p_node->get_owner() != p_root) {
@@ -160,6 +161,9 @@ void ConnectDialog::_tree_node_selected() {
}
dst_path = source->get_path_to(current);
+ if (!edit_mode) {
+ set_dst_method(generate_method_callback_name(source, signal, current));
+ }
_update_ok_enabled();
}
@@ -205,6 +209,45 @@ void ConnectDialog::_remove_bind() {
cdbinds->params.remove_at(idx);
cdbinds->notify_changed();
}
+/*
+ * Automatically generates a name for the callback method.
+ */
+StringName ConnectDialog::generate_method_callback_name(Node *p_source, String p_signal_name, Node *p_target) {
+ String node_name = p_source->get_name();
+ for (int i = 0; i < node_name.length(); i++) { // TODO: Regex filter may be cleaner.
+ char32_t c = node_name[i];
+ if (!is_ascii_identifier_char(c)) {
+ if (c == ' ') {
+ // Replace spaces with underlines.
+ c = '_';
+ } else {
+ // Remove any other characters.
+ node_name.remove_at(i);
+ i--;
+ continue;
+ }
+ }
+ node_name[i] = c;
+ }
+
+ Dictionary subst;
+ subst["NodeName"] = node_name.to_pascal_case();
+ subst["nodeName"] = node_name.to_camel_case();
+ subst["node_name"] = node_name.to_snake_case();
+
+ subst["SignalName"] = p_signal_name.to_pascal_case();
+ subst["signalName"] = p_signal_name.to_camel_case();
+ subst["signal_name"] = p_signal_name.to_snake_case();
+
+ String dst_method;
+ if (p_source == p_target) {
+ dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_to_self_name")).format(subst);
+ } else {
+ dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_name")).format(subst);
+ }
+
+ return dst_method;
+}
/*
* Enables or disables the connect button. The connect button is enabled if a
@@ -371,6 +414,7 @@ void ConnectDialog::popup_dialog(const String &p_for_signal) {
first_popup = false;
_advanced_pressed();
}
+
popup_centered();
}
@@ -690,9 +734,11 @@ void ConnectionsDock::_disconnect_all() {
while (child) {
Connection connection = child->get_metadata(0);
- ConnectDialog::ConnectionData cd = connection;
- undo_redo->add_do_method(selected_node, "disconnect", cd.signal, cd.get_callable());
- undo_redo->add_undo_method(selected_node, "connect", cd.signal, cd.get_callable(), cd.binds, cd.flags);
+ if (!_is_connection_inherited(connection)) {
+ ConnectDialog::ConnectionData cd = connection;
+ undo_redo->add_do_method(selected_node, "disconnect", cd.signal, cd.get_callable());
+ undo_redo->add_undo_method(selected_node, "connect", cd.signal, cd.get_callable(), cd.binds, cd.flags);
+ }
child = child->get_next();
}
@@ -737,49 +783,43 @@ bool ConnectionsDock::_is_item_signal(TreeItem &p_item) {
return (p_item.get_parent() == tree->get_root() || p_item.get_parent()->get_parent() == tree->get_root());
}
+bool ConnectionsDock::_is_connection_inherited(Connection &p_connection) {
+ Node *scene_root = EditorNode::get_singleton()->get_edited_scene();
+ Ref<PackedScene> scn = ResourceLoader::load(scene_root->get_scene_file_path());
+ ERR_FAIL_NULL_V(scn, false);
+
+ Ref<SceneState> state = scn->get_state();
+ ERR_FAIL_NULL_V(state, false);
+
+ Node *source = Object::cast_to<Node>(p_connection.signal.get_object());
+ Node *target = Object::cast_to<Node>(p_connection.callable.get_object());
+
+ const NodePath source_path = scene_root->get_path_to(source);
+ const NodePath target_path = scene_root->get_path_to(target);
+ const StringName signal_name = p_connection.signal.get_name();
+ const StringName method_name = p_connection.callable.get_method();
+
+ // If it cannot be found in PackedScene, this connection was inherited.
+ return !state->has_connection(source_path, signal_name, target_path, method_name, true);
+}
+
/*
* Open connection dialog with TreeItem data to CREATE a brand-new connection.
*/
void ConnectionsDock::_open_connection_dialog(TreeItem &p_item) {
String signal_name = p_item.get_metadata(0).operator Dictionary()["name"];
const String &signal_name_ref = signal_name;
- String node_name = selected_node->get_name();
- for (int i = 0; i < node_name.length(); i++) { // TODO: Regex filter may be cleaner.
- char32_t c = node_name[i];
- if (!is_ascii_identifier_char(c)) {
- if (c == ' ') {
- // Replace spaces with underlines.
- c = '_';
- } else {
- // Remove any other characters.
- node_name.remove_at(i);
- i--;
- continue;
- }
- }
- node_name[i] = c;
- }
Node *dst_node = selected_node->get_owner() ? selected_node->get_owner() : selected_node;
if (!dst_node || dst_node->get_script().is_null()) {
dst_node = _find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root());
}
- Dictionary subst;
- subst["NodeName"] = node_name.to_pascal_case();
- subst["nodeName"] = node_name.to_camel_case();
- subst["node_name"] = node_name.to_snake_case();
- subst["SignalName"] = signal_name.to_pascal_case();
- subst["signalName"] = signal_name.to_camel_case();
- subst["signal_name"] = signal_name.to_snake_case();
-
- String dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_name")).format(subst);
-
ConnectDialog::ConnectionData cd;
cd.source = selected_node;
cd.signal = StringName(signal_name_ref);
cd.target = dst_node;
- cd.method = StringName(dst_method);
+ cd.method = ConnectDialog::generate_method_callback_name(cd.source, signal_name, cd.target);
connect_dialog->popup_dialog(signal_name_ref);
connect_dialog->init(cd);
connect_dialog->set_title(TTR("Connect a Signal to a Method"));
@@ -849,6 +889,19 @@ void ConnectionsDock::_handle_signal_menu_option(int p_option) {
}
}
+void ConnectionsDock::_signal_menu_about_to_popup() {
+ TreeItem *signal_item = tree->get_selected();
+
+ bool disable_disconnect_all = true;
+ for (int i = 0; i < signal_item->get_child_count(); i++) {
+ if (!signal_item->get_child(i)->has_meta("_inherited_connection")) {
+ disable_disconnect_all = false;
+ }
+ }
+
+ signal_menu->set_item_disabled(slot_menu->get_item_index(DISCONNECT_ALL), disable_disconnect_all);
+}
+
void ConnectionsDock::_handle_slot_menu_option(int p_option) {
TreeItem *item = tree->get_selected();
@@ -871,6 +924,13 @@ void ConnectionsDock::_handle_slot_menu_option(int p_option) {
}
}
+void ConnectionsDock::_slot_menu_about_to_popup() {
+ bool connection_is_inherited = tree->get_selected()->has_meta("_inherited_connection");
+
+ slot_menu->set_item_disabled(slot_menu->get_item_index(EDIT), connection_is_inherited);
+ slot_menu->set_item_disabled(slot_menu->get_item_index(DISCONNECT), connection_is_inherited);
+}
+
void ConnectionsDock::_rmb_pressed(Vector2 p_position, MouseButton p_button) {
if (p_button != MouseButton::RIGHT) {
return;
@@ -984,7 +1044,7 @@ void ConnectionsDock::update_tree() {
name = base;
}
- if (!icon.is_valid()) {
+ if (icon.is_null()) {
icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons"));
}
@@ -1116,6 +1176,12 @@ void ConnectionsDock::update_tree() {
connection_item->set_text(0, path);
connection_item->set_metadata(0, connection);
connection_item->set_icon(0, get_theme_icon(SNAME("Slot"), SNAME("EditorIcons")));
+
+ if (_is_connection_inherited(connection)) {
+ // The scene inherits this connection.
+ connection_item->set_custom_color(0, get_theme_color(SNAME("warning_color"), SNAME("Editor")));
+ connection_item->set_meta("_inherited_connection", true);
+ }
}
}
@@ -1168,6 +1234,7 @@ ConnectionsDock::ConnectionsDock() {
signal_menu = memnew(PopupMenu);
add_child(signal_menu);
signal_menu->connect("id_pressed", callable_mp(this, &ConnectionsDock::_handle_signal_menu_option));
+ signal_menu->connect("about_to_popup", callable_mp(this, &ConnectionsDock::_signal_menu_about_to_popup));
signal_menu->add_item(TTR("Connect..."), CONNECT);
signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL);
signal_menu->add_item(TTR("Copy Name"), COPY_NAME);
@@ -1175,6 +1242,7 @@ ConnectionsDock::ConnectionsDock() {
slot_menu = memnew(PopupMenu);
add_child(slot_menu);
slot_menu->connect("id_pressed", callable_mp(this, &ConnectionsDock::_handle_slot_menu_option));
+ slot_menu->connect("about_to_popup", callable_mp(this, &ConnectionsDock::_slot_menu_about_to_popup));
slot_menu->add_item(TTR("Edit..."), EDIT);
slot_menu->add_item(TTR("Go to Method"), GO_TO_SCRIPT);
slot_menu->add_item(TTR("Disconnect"), DISCONNECT);
@@ -1187,6 +1255,7 @@ ConnectionsDock::ConnectionsDock() {
add_theme_constant_override("separation", 3 * EDSCALE);
EDITOR_DEF("interface/editors/default_signal_callback_name", "_on_{node_name}_{signal_name}");
+ EDITOR_DEF("interface/editors/default_signal_callback_to_self_name", "_on_{signal_name}");
}
ConnectionsDock::~ConnectionsDock() {
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index db2f855617..126a0ca828 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -144,6 +144,7 @@ protected:
static void _bind_methods();
public:
+ static StringName generate_method_callback_name(Node *p_source, String p_signal_name, Node *p_target);
Node *get_source() const;
StringName get_signal_name() const;
NodePath get_dst_path() const;
@@ -211,13 +212,16 @@ class ConnectionsDock : public VBoxContainer {
void _tree_item_selected();
void _tree_item_activated();
bool _is_item_signal(TreeItem &p_item);
+ bool _is_connection_inherited(Connection &p_connection);
void _open_connection_dialog(TreeItem &p_item);
void _open_connection_dialog(ConnectDialog::ConnectionData p_cd);
void _go_to_script(TreeItem &p_item);
void _handle_signal_menu_option(int p_option);
+ void _signal_menu_about_to_popup();
void _handle_slot_menu_option(int p_option);
+ void _slot_menu_about_to_popup();
void _rmb_pressed(Vector2 p_position, MouseButton p_button);
void _close();
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index ceca428306..7a4e58c6f9 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -752,9 +752,7 @@ CreateDialog::CreateDialog() {
favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected));
favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated));
favorites->add_theme_constant_override("draw_guides", 1);
-#ifndef _MSC_VER
-#warning cannot forward drag data to a non control, must be fixed
-#endif
+ // Cannot forward drag data to a non control, must be fixed.
//favorites->set_drag_forwarding(this);
fav_vb->add_margin_child(TTR("Favorites:"), favorites, true);
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
index 809c0c2cff..ae8752eb6d 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
@@ -656,7 +656,7 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) {
bool DebugAdapterProtocol::process_message(const String &p_text) {
JSON json;
- ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Mal-formed message!");
+ ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Malformed message!");
Dictionary params = json.get_data();
bool completed = true;
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index a882275375..dfa2b8e70f 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -308,9 +308,7 @@ void EditorProfiler::_update_plot() {
}
}
- Ref<Image> img;
- img.instantiate();
- img->create(w, h, false, Image::FORMAT_RGBA8, graph_image);
+ Ref<Image> img = Image::create_from_data(w, h, false, Image::FORMAT_RGBA8, graph_image);
if (reset_texture) {
if (graph_texture.is_null()) {
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 8e7135f1c5..8552c8e9ef 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -298,9 +298,7 @@ void EditorVisualProfiler::_update_plot() {
}
}
- Ref<Image> img;
- img.instantiate();
- img->create(w, h, false, Image::FORMAT_RGBA8, graph_image);
+ Ref<Image> img = Image::create_from_data(w, h, false, Image::FORMAT_RGBA8, graph_image);
if (reset_texture) {
if (graph_texture.is_null()) {
diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp
index 0f0ab4a339..7fd27692b0 100644
--- a/editor/editor_build_profile.cpp
+++ b/editor/editor_build_profile.cpp
@@ -255,8 +255,7 @@ Error EditorBuildProfile::save_to_file(const String &p_path) {
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);
ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
- JSON json;
- String text = json.stringify(data, "\t");
+ String text = JSON::stringify(data, "\t");
f->store_string(text);
return OK;
}
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 6f34c677db..c28bb18891 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -2259,7 +2259,7 @@ void EditorFileSystem::move_group_file(const String &p_path, const String &p_new
ResourceUID::ID EditorFileSystem::_resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate) {
if (!p_path.is_resource_file() || p_path.begins_with(ProjectSettings::get_singleton()->get_project_data_path())) {
- //saved externally (configuration file) or internal file, do not assign an ID.
+ // Saved externally (configuration file) or internal file, do not assign an ID.
return ResourceUID::INVALID_ID;
}
@@ -2267,15 +2267,21 @@ ResourceUID::ID EditorFileSystem::_resource_saver_get_resource_id_for_path(const
int cpos = -1;
if (!singleton->_find_file(p_path, &fs, cpos)) {
+ // Fallback to ResourceLoader if filesystem cache fails (can happen during scanning etc.).
+ ResourceUID::ID fallback = ResourceLoader::get_resource_uid(p_path);
+ if (fallback != ResourceUID::INVALID_ID) {
+ return fallback;
+ }
+
if (p_generate) {
- return ResourceUID::get_singleton()->create_id(); //just create a new one, we will be notified of save anyway and fetch the right UUID at that time, to keep things simple.
+ return ResourceUID::get_singleton()->create_id(); // Just create a new one, we will be notified of save anyway and fetch the right UUID at that time, to keep things simple.
} else {
return ResourceUID::INVALID_ID;
}
} else if (fs->files[cpos]->uid != ResourceUID::INVALID_ID) {
return fs->files[cpos]->uid;
} else if (p_generate) {
- return ResourceUID::get_singleton()->create_id(); //just create a new one, we will be notified of save anyway and fetch the right UUID at that time, to keep things simple.
+ return ResourceUID::get_singleton()->create_id(); // Just create a new one, we will be notified of save anyway and fetch the right UUID at that time, to keep things simple.
} else {
return ResourceUID::INVALID_ID;
}
@@ -2422,7 +2428,7 @@ EditorFileSystem::EditorFileSystem() {
scan_total = 0;
update_script_classes_queued.clear();
- ResourceUID::get_singleton()->clear(); //will be updated on scan
+ MessageQueue::get_singleton()->push_callable(callable_mp(ResourceUID::get_singleton(), &ResourceUID::clear)); // Will be updated on scan.
ResourceSaver::set_get_resource_id_for_path(_resource_saver_get_resource_id_for_path);
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 288ee4fa8f..8ee82888f3 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1181,7 +1181,8 @@ void EditorNode::_vp_resized() {
}
void EditorNode::_titlebar_resized() {
- const Size2 &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID);
+ DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_global_position().y + menu_hb->get_size().y / 2, menu_hb->get_global_position().y + menu_hb->get_size().y / 2), DisplayServer::MAIN_WINDOW_ID);
+ const Vector3i &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID);
if (left_menu_spacer) {
int w = (gui_base->is_layout_rtl()) ? margin.y : margin.x;
left_menu_spacer->set_custom_minimum_size(Size2(w, 0));
@@ -1190,6 +1191,9 @@ void EditorNode::_titlebar_resized() {
int w = (gui_base->is_layout_rtl()) ? margin.x : margin.y;
right_menu_spacer->set_custom_minimum_size(Size2(w, 0));
}
+ if (menu_hb) {
+ menu_hb->set_custom_minimum_size(Size2(0, margin.z - menu_hb->get_global_position().y));
+ }
}
void EditorNode::_version_button_pressed() {
@@ -1614,7 +1618,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
// which would result in an invalid texture.
if (c3d == 0 && c2d == 0) {
img.instantiate();
- img->create(1, 1, false, Image::FORMAT_RGB8);
+ img->initialize_data(1, 1, false, Image::FORMAT_RGB8);
} else if (c3d < c2d) {
Ref<ViewportTexture> viewport_texture = scene_root->get_texture();
if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) {
@@ -5905,7 +5909,7 @@ void EditorNode::_update_renderer_color() {
if (renderer->get_text() == "gl_compatibility") {
renderer->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
} else if (renderer->get_text() == "forward_plus" || renderer->get_text() == "mobile") {
- renderer->add_theme_color_override("font_color", theme_base->get_theme_color(SNAME("vulkan_color"), SNAME("Editor")));
+ renderer->add_theme_color_override("font_color", theme_base->get_theme_color(SNAME("highend_color"), SNAME("Editor")));
}
}
@@ -6177,10 +6181,17 @@ EditorNode::EditorNode() {
// Define a minimum window size to prevent UI elements from overlapping or being cut off.
DisplayServer::get_singleton()->window_set_min_size(Size2(1024, 600) * EDSCALE);
- ResourceLoader::set_abort_on_missing_resources(false);
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
+
+ int swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons");
+ if (swap_cancel_ok != 0) { // 0 is auto, set in register_scene based on DisplayServer.
+ // Swap on means OK first.
+ AcceptDialog::set_swap_cancel_ok(swap_cancel_ok == 2);
+ }
+
+ ResourceLoader::set_abort_on_missing_resources(false);
ResourceLoader::set_error_notify_func(this, _load_error_notify);
ResourceLoader::set_dependency_error_notify_func(this, _dependency_error_report);
@@ -7560,7 +7571,6 @@ EditorNode::EditorNode() {
// Extend menu bar to window title.
if (can_expand) {
- DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_minimum_size().y / 2, menu_hb->get_minimum_size().y / 2), DisplayServer::MAIN_WINDOW_ID);
DisplayServer::get_singleton()->window_set_flag(DisplayServer::WINDOW_FLAG_EXTEND_TO_TITLE, true, DisplayServer::MAIN_WINDOW_ID);
menu_hb->set_can_move_window(true);
}
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 155802d16c..899fa69be1 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -90,7 +90,9 @@ void EditorPropertyText::update_property() {
String s = get_edited_object()->get(get_edited_property());
updating = true;
if (text->get_text() != s) {
+ int caret = text->get_caret_column();
text->set_text(s);
+ text->set_caret_column(caret);
}
text->set_editable(!is_read_only());
updating = false;
@@ -760,8 +762,13 @@ void EditorPropertyEnum::_option_selected(int p_which) {
}
void EditorPropertyEnum::update_property() {
- int64_t which = get_edited_object()->get(get_edited_property());
+ Variant current = get_edited_object()->get(get_edited_property());
+ if (current.get_type() == Variant::NIL) {
+ options->select(-1);
+ return;
+ }
+ int64_t which = current;
for (int i = 0; i < options->get_item_count(); i++) {
if (which == (int64_t)options->get_item_metadata(i)) {
options->select(i);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 0c01fcb869..5bdfd8d377 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -438,6 +438,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING_USAGE(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/single_window_mode", false, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
_initial_set("interface/editor/mouse_extra_buttons_navigate_history", true);
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
+ EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/accept_dialog_cancel_ok_buttons", 0,
+ vformat("Auto (%s),Cancel First,OK First", DisplayServer::get_singleton()->get_swap_cancel_ok() ? "OK First" : "Cancel First"),
+ PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
#ifdef DEV_ENABLED
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/show_internal_errors_in_toast_notifications", 0, "Auto (Enabled),Enabled,Disabled")
#else
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 5edb6d877c..1cdfceebc8 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -143,7 +143,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
}
Ref<InputEventKey> k = p_event;
- if (k.is_valid() && k->is_pressed() && k->is_action("ui_accept")) {
+ if (k.is_valid() && k->is_pressed() && k->is_action("ui_accept", true)) {
_focus_entered();
}
}
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 27ac57216a..1d9e320be1 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -564,9 +564,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("readonly_color", "Editor", readonly_color);
if (!dark_theme) {
- theme->set_color("vulkan_color", "Editor", Color::hex(0xad1128ff));
+ theme->set_color("highend_color", "Editor", Color::hex(0xad1128ff));
} else {
- theme->set_color("vulkan_color", "Editor", Color(1.0, 0.0, 0.0));
+ theme->set_color("highend_color", "Editor", Color(1.0, 0.0, 0.0));
}
const int thumb_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size");
theme->set_constant("scale", "Editor", EDSCALE);
diff --git a/editor/editor_zoom_widget.cpp b/editor/editor_zoom_widget.cpp
index 88e99d9b30..8e820f41ee 100644
--- a/editor/editor_zoom_widget.cpp
+++ b/editor/editor_zoom_widget.cpp
@@ -161,13 +161,19 @@ void EditorZoomWidget::_bind_methods() {
ADD_SIGNAL(MethodInfo("zoom_changed", PropertyInfo(Variant::FLOAT, "zoom")));
}
+void EditorZoomWidget::set_shortcut_context(Node *p_node) const {
+ zoom_minus->set_shortcut_context(p_node);
+ zoom_plus->set_shortcut_context(p_node);
+ zoom_reset->set_shortcut_context(p_node);
+}
+
EditorZoomWidget::EditorZoomWidget() {
// Zoom buttons
zoom_minus = memnew(Button);
zoom_minus->set_flat(true);
add_child(zoom_minus);
zoom_minus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_minus));
- zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KeyModifierMask::CMD_OR_CTRL | Key::MINUS));
+ zoom_minus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_minus", TTR("Zoom Out"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::MINUS), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_SUBTRACT) }));
zoom_minus->set_shortcut_context(this);
zoom_minus->set_focus_mode(FOCUS_NONE);
@@ -189,7 +195,7 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_plus->set_flat(true);
add_child(zoom_plus);
zoom_plus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_plus));
- zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KeyModifierMask::CMD_OR_CTRL | Key::EQUAL)); // Usually direct access key for PLUS
+ zoom_plus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_plus", TTR("Zoom In"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::EQUAL), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_ADD) }));
zoom_plus->set_shortcut_context(this);
zoom_plus->set_focus_mode(FOCUS_NONE);
diff --git a/editor/editor_zoom_widget.h b/editor/editor_zoom_widget.h
index 4690a57a2b..995b9e1808 100644
--- a/editor/editor_zoom_widget.h
+++ b/editor/editor_zoom_widget.h
@@ -57,6 +57,8 @@ public:
float get_zoom();
void set_zoom(float p_zoom);
void set_zoom_by_increments(int p_increment_count, bool p_integer_only = false);
+ // Sets the shortcut context for the zoom buttons. By default their context is this EditorZoomWidget control.
+ void set_shortcut_context(Node *p_node) const;
};
#endif // EDITOR_ZOOM_WIDGET_H
diff --git a/editor/event_listener_line_edit.cpp b/editor/event_listener_line_edit.cpp
index 14e482432a..e4c35a5b81 100644
--- a/editor/event_listener_line_edit.cpp
+++ b/editor/event_listener_line_edit.cpp
@@ -59,8 +59,9 @@ void EventListenerLineEdit::gui_input(const Ref<InputEvent> &p_event) {
// First event will be an event which is used to focus this control - i.e. a mouse click, or a tab press.
// Ignore the first one so that clicking into the LineEdit does not override the current event.
// Ignore is reset to true when the control is unfocused.
- if (ignore) {
- ignore = false;
+ // This class also specially handles grab_focus() calls.
+ if (ignore_next_event) {
+ ignore_next_event = false;
return;
}
@@ -85,7 +86,7 @@ void EventListenerLineEdit::_on_focus() {
}
void EventListenerLineEdit::_on_unfocus() {
- ignore = true;
+ ignore_next_event = true;
set_placeholder(TTR("Filter by event..."));
}
@@ -109,6 +110,12 @@ int EventListenerLineEdit::get_allowed_input_types() const {
return allowed_input_types;
}
+void EventListenerLineEdit::grab_focus() {
+ // If we grab focus through code, we don't need to ignore the first event!
+ ignore_next_event = false;
+ Control::grab_focus();
+}
+
void EventListenerLineEdit::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
diff --git a/editor/event_listener_line_edit.h b/editor/event_listener_line_edit.h
index 5b415e8a2d..c4cd5e4511 100644
--- a/editor/event_listener_line_edit.h
+++ b/editor/event_listener_line_edit.h
@@ -44,7 +44,7 @@ class EventListenerLineEdit : public LineEdit {
GDCLASS(EventListenerLineEdit, LineEdit)
int allowed_input_types = INPUT_KEY | INPUT_MOUSE_BUTTON | INPUT_JOY_BUTTON | INPUT_JOY_MOTION;
- bool ignore = true;
+ bool ignore_next_event = true;
bool share_keycodes = false;
Ref<InputEvent> event;
@@ -67,6 +67,8 @@ public:
void set_allowed_input_types(int input_types);
int get_allowed_input_types() const;
+ void grab_focus();
+
public:
EventListenerLineEdit();
};
diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h
index 88dc7bd5cd..5db79b98d1 100644
--- a/editor/export/editor_export_platform.h
+++ b/editor/export/editor_export_platform.h
@@ -144,6 +144,7 @@ public:
};
virtual Ref<EditorExportPreset> create_preset();
+ virtual bool is_executable(const String &p_path) const { return false; }
virtual void clear_messages() { messages.clear(); }
virtual void add_message(ExportMessageType p_type, const String &p_category, const String &p_message) {
diff --git a/editor/export/editor_export_platform_pc.cpp b/editor/export/editor_export_platform_pc.cpp
index 8538414523..c5b61e9b03 100644
--- a/editor/export/editor_export_platform_pc.cpp
+++ b/editor/export/editor_export_platform_pc.cpp
@@ -185,10 +185,12 @@ Error EditorExportPlatformPC::export_project_data(const Ref<EditorExportPreset>
String src_path = ProjectSettings::get_singleton()->globalize_path(so_files[i].path);
String target_path;
if (so_files[i].target.is_empty()) {
- target_path = p_path.get_base_dir().path_join(src_path.get_file());
+ target_path = p_path.get_base_dir();
} else {
- target_path = p_path.get_base_dir().path_join(so_files[i].target).path_join(src_path.get_file());
+ target_path = p_path.get_base_dir().path_join(so_files[i].target);
+ da->make_dir_recursive(target_path);
}
+ target_path = target_path.path_join(src_path.get_file());
if (da->dir_exists(src_path)) {
err = da->make_dir_recursive(target_path);
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 05a17c9951..9b5e76bcd7 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -1015,9 +1015,7 @@ ProjectExportDialog::ProjectExportDialog() {
preset_vb->add_child(mc);
mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
presets = memnew(ItemList);
-#ifndef _MSC_VER
-#warning must reimplement drag forward
-#endif
+ // TODO: Must reimplement drag forwarding.
//presets->set_drag_forwarding(this);
mc->add_child(presets);
presets->connect("item_selected", callable_mp(this, &ProjectExportDialog::_edit_preset));
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index dac86acae4..f11e328087 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -39,6 +39,24 @@
#include "scene/gui/label.h"
#include "scene/resources/packed_scene.h"
+static bool can_edit(Node *p_node, String p_group) {
+ Node *n = p_node;
+ bool can_edit = true;
+ while (n) {
+ Ref<SceneState> ss = (n == EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
+ if (ss.is_valid()) {
+ int path = ss->find_node_by_path(n->get_path_to(p_node));
+ if (path != -1) {
+ if (ss->is_node_in_group(path, p_group)) {
+ can_edit = false;
+ }
+ }
+ }
+ n = n->get_owner();
+ }
+ return can_edit;
+}
+
void GroupDialog::_group_selected() {
nodes_to_add->clear();
add_node_root = nodes_to_add->create_item();
@@ -94,7 +112,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(p_current, "Node");
node->set_icon(0, icon);
- if (!_can_edit(p_current, selected_group)) {
+ if (!can_edit(p_current, selected_group)) {
node->set_selectable(0, false);
node->set_custom_color(0, groups->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
}
@@ -105,24 +123,6 @@ void GroupDialog::_load_nodes(Node *p_current) {
}
}
-bool GroupDialog::_can_edit(Node *p_node, String p_group) {
- Node *n = p_node;
- bool can_edit = true;
- while (n) {
- Ref<SceneState> ss = (n == EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
- if (ss.is_valid()) {
- int path = ss->find_node_by_path(n->get_path_to(p_node));
- if (path != -1) {
- if (ss->is_node_in_group(path, p_group)) {
- can_edit = false;
- }
- }
- }
- n = n->get_owner();
- }
- return can_edit;
-}
-
void GroupDialog::_add_pressed() {
TreeItem *selected = nodes_to_add->get_next_selected(nullptr);
@@ -218,19 +218,14 @@ void GroupDialog::_add_group_text_changed(const String &p_new_text) {
}
void GroupDialog::_group_renamed() {
- TreeItem *renamed_group = groups->get_edited();
+ TreeItem *renamed_group = groups->get_selected();
if (!renamed_group) {
return;
}
const String name = renamed_group->get_text(0).strip_edges();
- for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) {
- if (E != renamed_group && E->get_text(0) == name) {
- renamed_group->set_text(0, selected_group);
- error->set_text(TTR("Group name already exists."));
- error->popup_centered();
- return;
- }
+ if (name == selected_group) {
+ return;
}
if (name.is_empty()) {
@@ -240,6 +235,15 @@ void GroupDialog::_group_renamed() {
return;
}
+ for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) {
+ if (E != renamed_group && E->get_text(0) == name) {
+ renamed_group->set_text(0, selected_group);
+ error->set_text(TTR("Group name already exists."));
+ error->popup_centered();
+ return;
+ }
+ }
+
renamed_group->set_text(0, name); // Spaces trimmed.
undo_redo->create_action(TTR("Rename Group"));
@@ -248,7 +252,7 @@ void GroupDialog::_group_renamed() {
scene_tree->get_nodes_in_group(selected_group, &nodes);
bool removed_all = true;
for (Node *node : nodes) {
- if (_can_edit(node, selected_group)) {
+ if (can_edit(node, selected_group)) {
undo_redo->add_do_method(node, "remove_from_group", selected_group);
undo_redo->add_undo_method(node, "remove_from_group", name);
undo_redo->add_do_method(node, "add_to_group", name, true);
@@ -324,7 +328,7 @@ void GroupDialog::_modify_group_pressed(Object *p_item, int p_column, int p_id,
scene_tree->get_nodes_in_group(name, &nodes);
bool removed_all = true;
for (Node *E : nodes) {
- if (_can_edit(E, name)) {
+ if (can_edit(E, name)) {
undo_redo->add_do_method(E, "remove_from_group", name);
undo_redo->add_undo_method(E, "add_to_group", name, true);
} else {
@@ -571,7 +575,7 @@ GroupDialog::GroupDialog() {
set_title(TTR("Group Editor"));
- error = memnew(ConfirmationDialog);
+ error = memnew(AcceptDialog);
add_child(error);
error->set_ok_button_text(TTR("Close"));
@@ -584,14 +588,12 @@ void GroupsEditor::_add_group(const String &p_group) {
if (!node) {
return;
}
-
const String name = group_name->get_text().strip_edges();
- if (name.is_empty()) {
- return;
- }
group_name->clear();
if (node->is_in_group(name)) {
+ error->set_text(TTR("Group name already exists."));
+ error->popup_centered();
return;
}
@@ -609,6 +611,65 @@ void GroupsEditor::_add_group(const String &p_group) {
undo_redo->commit_action();
}
+void GroupsEditor::_group_selected() {
+ if (!tree->is_anything_selected()) {
+ return;
+ }
+ selected_group = tree->get_selected()->get_text(0);
+}
+
+void GroupsEditor::_group_renamed() {
+ if (!node || !can_edit(node, selected_group)) {
+ return;
+ }
+
+ TreeItem *ti = tree->get_selected();
+ if (!ti) {
+ return;
+ }
+
+ const String name = ti->get_text(0).strip_edges();
+ if (name == selected_group) {
+ return;
+ }
+
+ if (name.is_empty()) {
+ ti->set_text(0, selected_group);
+ error->set_text(TTR("Invalid group name."));
+ error->popup_centered();
+ return;
+ }
+
+ for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) {
+ if (E != ti && E->get_text(0) == name) {
+ ti->set_text(0, selected_group);
+ error->set_text(TTR("Group name already exists."));
+ error->popup_centered();
+ return;
+ }
+ }
+
+ ti->set_text(0, name); // Spaces trimmed.
+
+ undo_redo->create_action(TTR("Rename Group"));
+
+ undo_redo->add_do_method(node, "remove_from_group", selected_group);
+ undo_redo->add_undo_method(node, "remove_from_group", name);
+ undo_redo->add_do_method(node, "add_to_group", name, true);
+ undo_redo->add_undo_method(node, "add_to_group", selected_group, true);
+
+ undo_redo->add_do_method(this, "_group_selected");
+ undo_redo->add_undo_method(this, "_group_selected");
+ undo_redo->add_do_method(this, "update_tree");
+ undo_redo->add_undo_method(this, "update_tree");
+
+ // To force redraw of scene tree.
+ undo_redo->add_do_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");
+ undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");
+
+ undo_redo->commit_action();
+}
+
void GroupsEditor::_modify_group(Object *p_item, int p_column, int p_id, MouseButton p_button) {
if (p_button != MouseButton::LEFT) {
return;
@@ -624,7 +685,7 @@ void GroupsEditor::_modify_group(Object *p_item, int p_column, int p_id, MouseBu
}
switch (p_id) {
case DELETE_GROUP: {
- String name = ti->get_text(0);
+ const String name = ti->get_text(0);
undo_redo->create_action(TTR("Remove from Group"));
undo_redo->add_do_method(node, "remove_from_group", name);
@@ -666,6 +727,7 @@ void GroupsEditor::update_tree() {
groups.sort_custom<_GroupInfoComparator>();
TreeItem *root = tree->create_item();
+ groups_root = root;
for (const GroupInfo &gi : groups) {
if (!gi.persistent) {
@@ -692,6 +754,7 @@ void GroupsEditor::update_tree() {
TreeItem *item = tree->create_item(root);
item->set_text(0, gi.name);
+ item->set_editable(0, true);
if (can_be_deleted) {
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), DELETE_GROUP);
item->add_button(0, get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), COPY_GROUP);
@@ -717,6 +780,7 @@ void GroupsEditor::_show_group_dialog() {
void GroupsEditor::_bind_methods() {
ClassDB::bind_method("update_tree", &GroupsEditor::update_tree);
+ ClassDB::bind_method("_group_selected", &GroupsEditor::_group_selected);
}
GroupsEditor::GroupsEditor() {
@@ -749,13 +813,21 @@ GroupsEditor::GroupsEditor() {
add->connect("pressed", callable_mp(this, &GroupsEditor::_add_group).bind(String()));
tree = memnew(Tree);
+ vbc->add_child(tree);
tree->set_hide_root(true);
+ tree->set_allow_reselect(true);
+ tree->set_allow_rmb_select(true);
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- vbc->add_child(tree);
+ tree->connect("item_selected", callable_mp(this, &GroupsEditor::_group_selected));
tree->connect("button_clicked", callable_mp(this, &GroupsEditor::_modify_group));
+ tree->connect("item_edited", callable_mp(this, &GroupsEditor::_group_renamed));
tree->add_theme_constant_override("draw_guides", 1);
add_theme_constant_override("separation", 3 * EDSCALE);
+ error = memnew(AcceptDialog);
+ add_child(error);
+ error->get_ok_button()->set_text(TTR("Close"));
+
_group_name_changed("");
}
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index 8bbea4e652..5d012a3501 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -44,7 +44,7 @@ class EditorUndoRedoManager;
class GroupDialog : public AcceptDialog {
GDCLASS(GroupDialog, AcceptDialog);
- ConfirmationDialog *error = nullptr;
+ AcceptDialog *error = nullptr;
SceneTree *scene_tree = nullptr;
TreeItem *groups_root = nullptr;
@@ -88,8 +88,6 @@ class GroupDialog : public AcceptDialog {
void _modify_group_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _delete_group_item(const String &p_name);
- bool _can_edit(Node *p_node, String p_group);
-
void _load_groups(Node *p_current);
void _load_nodes(Node *p_current);
@@ -113,8 +111,10 @@ class GroupsEditor : public VBoxContainer {
GDCLASS(GroupsEditor, VBoxContainer);
Node *node = nullptr;
+ TreeItem *groups_root = nullptr;
GroupDialog *group_dialog = nullptr;
+ AcceptDialog *error = nullptr;
LineEdit *group_name = nullptr;
Button *add = nullptr;
@@ -122,11 +122,16 @@ class GroupsEditor : public VBoxContainer {
Ref<EditorUndoRedoManager> undo_redo;
+ String selected_group;
+
void update_tree();
void _add_group(const String &p_group = "");
void _modify_group(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _group_name_changed(const String &p_new_text);
+ void _group_selected();
+ void _group_renamed();
+
void _show_group_dialog();
protected:
diff --git a/editor/icons/BoneMapHumanBody.svg b/editor/icons/BoneMapHumanBody.svg
index 2c2c5db1f6..8674157aaa 100644
--- a/editor/icons/BoneMapHumanBody.svg
+++ b/editor/icons/BoneMapHumanBody.svg
@@ -1 +1,26 @@
-<svg enable-background="new 0 0 1024 1024" height="1024" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h1024v1024h-1024z" fill="#3f3f3f"/><path d="m926.5 217.162c-11.5-2-26.03 4.547-37.5 6.5-15.723 2.678-25.238 3.24-33.333 5.167-1.227.292-3.103.763-5.792.958 0 0-.019.16-.052.437-36.819.994-106.823-6.062-138.156-2.062-23.816 3.041-86.334-5.667-105.667-6-13.911-.239-59.292-4.583-71.75-2.5-.667-4.083-1.5-10.75.95-17.468 14.881-7.246 27.229-21.569 35.341-38.467.922 4.424 6.252 4.929 12.459-14.231 5.662-17.478 2.324-22.254-2.313-22.525.172-2.056.279-4.105.313-6.142.788-48.041-15-78.667-69-78.667s-69.787 30.626-69 78.667c.033 2.036.141 4.086.313 6.142-4.637.271-7.975 5.048-2.313 22.525 6.207 19.16 11.537 18.655 12.459 14.231 8.113 16.897 20.461 31.221 35.342 38.467 2.449 6.718 1.617 13.385.949 17.468-12.457-2.083-57.838 2.261-71.75 2.5-19.332.333-81.85 9.041-105.666 6-31.333-4-101.337 3.056-138.156 2.062-.033-.276-.053-.437-.053-.437-2.689-.195-4.564-.666-5.791-.958-8.096-1.927-17.611-2.489-33.334-5.167-11.469-1.953-26-8.5-37.5-6.5-3.367.586 6 9.834 15.5 12.334 13.635 3.588 25.25 10.666 36 13.166-2.25 3.75-15.59 7.063-23 12-5.336 3.557 6.5 6.5 12 5 20.842-5.684 22.973.389 37.514-9.019 30.078 4.078 102.537 20.514 122.154 14.186 12.457-4.018 100.332 7.083 142.332 5.833 6.039-.18 1.656 65.563 2 73.5 3 69-16.842 133.135-18.666 169.667-1.92 38.42-3.42 57.919 7.666 131.333 6.967 46.126-2.521 82.079-2 94 6 137 29 172 4 221-14 27.44 67.449 26.958 65 9-3.012-22.092-12.666-22.333-10.666-46.333 1.896-22.768 16.049-151.298 8.666-206.667-2-15 0-26 2-66 2.355-47.101 7-88 14-123 7 35 11.645 75.899 14 123 2 40 4 51 2 66-7.383 55.369 6.77 183.899 8.667 206.667 2 24-7.654 24.241-10.667 46.333-2.449 17.958 79 18.44 65-9-25-49-2-84 4-221 .522-11.921-8.966-47.874-2-94 11.086-73.414 9.586-92.913 7.667-131.333-1.824-36.532-21.667-100.667-18.667-169.667.345-7.938-4.039-73.68 2-73.5 42 1.25 129.876-9.852 142.333-5.833 19.616 6.328 92.076-10.107 122.153-14.186 14.541 9.407 16.673 3.335 37.514 9.019 5.5 1.5 17.336-1.443 12-5-7.409-4.937-20.75-8.25-23-12 10.75-2.5 22.366-9.578 36.001-13.166 9.5-2.5 18.866-11.748 15.499-12.334z" fill="#b2b2b2"/></svg>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="レイヤー_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
+ y="0px" width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
+<path fill="#3F3F3F" d="M0,0h1024v1024H0V0z"/>
+<path fill="#B2B2B2" d="M512,536.162c7,35,11.645,66.898,14,114c2,40,4,51,2,66c-7.384,55.369,6.77,183.898,8.666,206.667
+ c2,24-7.653,24.241-10.666,46.333c-2.449,17.958,79,18.439,65-9c-25-49-2-84,4-221c0.521-11.921-8.967-47.874-2-94
+ c11.086-73.414,8.42-107.242,6.5-145.662c-1.245-31.973-1-56.963-9-138.963c-0.976-10.002,5.915-79.268,11.954-79.088
+ c42,1.25,97.313-5.009,118.145-14.68c28.901,3.73,97.81-12.047,127.887-16.126c14.541,9.407,16.673,3.335,37.515,9.019
+ c5.5,1.5,17.336-1.443,12-5c-7.409-4.937-20.75-8.25-23-12c10.75-2.5,22.365-9.578,36-13.166c9.5-2.5,18.866-11.748,15.5-12.334l0,0
+ c-11.5-2-26.03,4.547-37.5,6.5c-15.724,2.678-25.238,3.24-33.334,5.167c-1.227,0.292-3.103,0.763-5.791,0.958
+ c0,0-0.02,0.16-0.053,0.437c-36.818,0.994-80.322-9.724-130.31-5.569c-34.026-3.925-94.181-5.16-113.513-5.493
+ c-13.911-0.239-59.293-2.583-71.75-0.5c-0.668-4.083-1.5-9.75,0.949-16.468c14.881-7.246,19.188-17.796,27.301-34.694
+ c0.922,4.424,6.252,4.929,12.459-14.231c5.661-17.478,2.323-22.254-2.313-22.525c0.172-2.056,0.279-4.105,0.313-6.142
+ C573.746,76.562,566,42.163,512,42.163s-61.746,34.399-60.959,82.44c0.034,2.037,0.142,4.086,0.313,6.142
+ c-4.637,0.271-7.975,5.047-2.313,22.525c6.207,19.16,11.537,18.655,12.459,14.231c8.112,16.898,12.42,27.448,27.301,34.694
+ c2.449,6.718,1.617,12.385,0.949,16.468c-12.457-2.083-57.839,0.261-71.75,0.5c-19.332,0.333-79.486,1.568-113.513,5.493
+ c-49.987-4.155-93.491,6.563-130.31,5.569c-0.033-0.277-0.053-0.437-0.053-0.437c-2.688-0.195-4.564-0.666-5.791-0.958
+ c-8.096-1.927-17.61-2.489-33.334-5.167c-11.47-1.953-26-8.5-37.5-6.5l0,0c-3.366,0.586,6,9.834,15.5,12.334
+ c13.635,3.588,25.25,10.666,36,13.166c-2.25,3.75-15.591,7.063-23,12c-5.336,3.557,6.5,6.5,12,5
+ c20.842-5.684,22.974,0.388,37.515-9.019c30.077,4.079,98.985,19.857,127.887,16.126c20.832,9.671,76.145,15.93,118.145,14.68
+ c6.039-0.18,12.93,69.085,11.954,79.088c-8,82-7.755,106.99-9,138.963c-1.92,38.419-4.586,72.248,6.5,145.662
+ c6.967,46.126-2.521,82.079-2,94c6,137,29,172,4,221c-14,27.439,67.449,26.958,65,9c-3.013-22.092-12.666-22.333-10.666-46.333
+ c1.896-22.769,16.05-151.298,8.666-206.667c-2-15,0-26,2-66C500.356,603.061,505,571.162,512,536.162z"/>
+</svg>
diff --git a/editor/icons/Line.svg b/editor/icons/Line.svg
new file mode 100644
index 0000000000..c7b1f8a701
--- /dev/null
+++ b/editor/icons/Line.svg
@@ -0,0 +1 @@
+<svg height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg"><path d="m2 1050.4 8-8" fill="none" stroke="#ffffff" stroke-linecap="round" stroke-width="2" transform="translate(0 -1040.4)"/></svg>
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index 9dafa47c1c..e1df78e741 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -186,9 +186,7 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
int mm_d = MAX(1, d >> 1);
for (int i = 0; i < mm_d; i++) {
- Ref<Image> mm;
- mm.instantiate();
- mm->create(mm_w, mm_h, false, p_images[0]->get_format());
+ Ref<Image> mm = Image::create_empty(mm_w, mm_h, false, p_images[0]->get_format());
Vector3 pos;
pos.z = float(i) * float(d) / float(mm_d) + 0.5;
for (int x = 0; x < mm_w; x++) {
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index b5798a5784..756d61f712 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -953,43 +953,49 @@ Node *ResourceImporterScene::_pre_fix_animations(Node *p_node, Node *p_root, con
if (Object::cast_to<AnimationPlayer>(p_node)) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
+ List<StringName> anims;
+ ap->get_animation_list(&anims);
- Array animation_clips;
- {
- int clip_count = node_settings["clips/amount"];
+ for (const StringName &name : anims) {
+ Ref<Animation> anim = ap->get_animation(name);
+ Array animation_slices;
- for (int i = 0; i < clip_count; i++) {
- String name = node_settings["clip_" + itos(i + 1) + "/name"];
- int from_frame = node_settings["clip_" + itos(i + 1) + "/start_frame"];
- int end_frame = node_settings["clip_" + itos(i + 1) + "/end_frame"];
- Animation::LoopMode loop_mode = static_cast<Animation::LoopMode>((int)node_settings["clip_" + itos(i + 1) + "/loop_mode"]);
- bool save_to_file = node_settings["clip_" + itos(i + 1) + "/save_to_file/enabled"];
- bool save_to_path = node_settings["clip_" + itos(i + 1) + "/save_to_file/path"];
- bool save_to_file_keep_custom = node_settings["clip_" + itos(i + 1) + "/save_to_file/keep_custom_tracks"];
+ if (p_animation_data.has(name)) {
+ Dictionary anim_settings = p_animation_data[name];
+ int slices_count = anim_settings["slices/amount"];
+
+ for (int i = 0; i < slices_count; i++) {
+ String slice_name = anim_settings["slice_" + itos(i + 1) + "/name"];
+ int from_frame = anim_settings["slice_" + itos(i + 1) + "/start_frame"];
+ int end_frame = anim_settings["slice_" + itos(i + 1) + "/end_frame"];
+ Animation::LoopMode loop_mode = static_cast<Animation::LoopMode>((int)anim_settings["slice_" + itos(i + 1) + "/loop_mode"]);
+ bool save_to_file = anim_settings["slice_" + itos(i + 1) + "/save_to_file/enabled"];
+ bool save_to_path = anim_settings["slice_" + itos(i + 1) + "/save_to_file/path"];
+ bool save_to_file_keep_custom = anim_settings["slice_" + itos(i + 1) + "/save_to_file/keep_custom_tracks"];
+
+ animation_slices.push_back(slice_name);
+ animation_slices.push_back(from_frame / p_animation_fps);
+ animation_slices.push_back(end_frame / p_animation_fps);
+ animation_slices.push_back(loop_mode);
+ animation_slices.push_back(save_to_file);
+ animation_slices.push_back(save_to_path);
+ animation_slices.push_back(save_to_file_keep_custom);
+ }
+ }
- animation_clips.push_back(name);
- animation_clips.push_back(from_frame / p_animation_fps);
- animation_clips.push_back(end_frame / p_animation_fps);
- animation_clips.push_back(loop_mode);
- animation_clips.push_back(save_to_file);
- animation_clips.push_back(save_to_path);
- animation_clips.push_back(save_to_file_keep_custom);
+ if (animation_slices.size() > 0) {
+ _create_slices(ap, anim, animation_slices, true);
}
}
- if (animation_clips.size()) {
- _create_clips(ap, animation_clips, true);
- } else {
- List<StringName> anims;
- ap->get_animation_list(&anims);
- AnimationImportTracks import_tracks_mode[TRACK_CHANNEL_MAX] = {
- AnimationImportTracks(int(node_settings["import_tracks/position"])),
- AnimationImportTracks(int(node_settings["import_tracks/rotation"])),
- AnimationImportTracks(int(node_settings["import_tracks/scale"]))
- };
- if (anims.size() > 1 && (import_tracks_mode[0] != ANIMATION_IMPORT_TRACKS_IF_PRESENT || import_tracks_mode[1] != ANIMATION_IMPORT_TRACKS_IF_PRESENT || import_tracks_mode[2] != ANIMATION_IMPORT_TRACKS_IF_PRESENT)) {
- _optimize_track_usage(ap, import_tracks_mode);
- }
+ AnimationImportTracks import_tracks_mode[TRACK_CHANNEL_MAX] = {
+ AnimationImportTracks(int(node_settings["import_tracks/position"])),
+ AnimationImportTracks(int(node_settings["import_tracks/rotation"])),
+ AnimationImportTracks(int(node_settings["import_tracks/scale"]))
+ };
+
+ if (anims.size() > 1 && (import_tracks_mode[0] != ANIMATION_IMPORT_TRACKS_IF_PRESENT || import_tracks_mode[1] != ANIMATION_IMPORT_TRACKS_IF_PRESENT || import_tracks_mode[2] != ANIMATION_IMPORT_TRACKS_IF_PRESENT)) {
+ _optimize_track_usage(ap, import_tracks_mode);
}
}
@@ -1408,144 +1414,138 @@ Ref<Animation> ResourceImporterScene::_save_animation_to_file(Ref<Animation> ani
return anim;
}
-void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_clips, bool p_bake_all) {
- if (!anim->has_animation("default")) {
- ERR_FAIL_COND_MSG(p_clips.size() > 0, "To create clips, animations must be named \"default\".");
- return;
- }
+void ResourceImporterScene::_create_slices(AnimationPlayer *ap, Ref<Animation> anim, const Array &p_slices, bool p_bake_all) {
+ Ref<AnimationLibrary> al = ap->get_animation_library(ap->find_animation_library(anim));
- Ref<Animation> default_anim = anim->get_animation("default");
- Ref<AnimationLibrary> al = anim->get_animation_library(anim->find_animation(default_anim));
-
- for (int i = 0; i < p_clips.size(); i += 7) {
- String name = p_clips[i];
- float from = p_clips[i + 1];
- float to = p_clips[i + 2];
- Animation::LoopMode loop_mode = static_cast<Animation::LoopMode>((int)p_clips[i + 3]);
- bool save_to_file = p_clips[i + 4];
- String save_to_path = p_clips[i + 5];
- bool keep_current = p_clips[i + 6];
+ for (int i = 0; i < p_slices.size(); i += 7) {
+ String name = p_slices[i];
+ float from = p_slices[i + 1];
+ float to = p_slices[i + 2];
+ Animation::LoopMode loop_mode = static_cast<Animation::LoopMode>((int)p_slices[i + 3]);
+ bool save_to_file = p_slices[i + 4];
+ String save_to_path = p_slices[i + 5];
+ bool keep_current = p_slices[i + 6];
if (from >= to) {
continue;
}
Ref<Animation> new_anim = memnew(Animation);
- for (int j = 0; j < default_anim->get_track_count(); j++) {
+ for (int j = 0; j < anim->get_track_count(); j++) {
List<float> keys;
- int kc = default_anim->track_get_key_count(j);
+ int kc = anim->track_get_key_count(j);
int dtrack = -1;
for (int k = 0; k < kc; k++) {
- float kt = default_anim->track_get_key_time(j, k);
+ float kt = anim->track_get_key_time(j, k);
if (kt >= from && kt < to) {
//found a key within range, so create track
if (dtrack == -1) {
- new_anim->add_track(default_anim->track_get_type(j));
+ new_anim->add_track(anim->track_get_type(j));
dtrack = new_anim->get_track_count() - 1;
- new_anim->track_set_path(dtrack, default_anim->track_get_path(j));
+ new_anim->track_set_path(dtrack, anim->track_get_path(j));
if (kt > (from + 0.01) && k > 0) {
- if (default_anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
+ if (anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
Vector3 p;
- default_anim->position_track_interpolate(j, from, &p);
+ anim->position_track_interpolate(j, from, &p);
new_anim->position_track_insert_key(dtrack, 0, p);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
Quaternion r;
- default_anim->rotation_track_interpolate(j, from, &r);
+ anim->rotation_track_interpolate(j, from, &r);
new_anim->rotation_track_insert_key(dtrack, 0, r);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
Vector3 s;
- default_anim->scale_track_interpolate(j, from, &s);
+ anim->scale_track_interpolate(j, from, &s);
new_anim->scale_track_insert_key(dtrack, 0, s);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
- Variant var = default_anim->value_track_interpolate(j, from);
+ } else if (anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = anim->value_track_interpolate(j, from);
new_anim->track_insert_key(dtrack, 0, var);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
float interp;
- default_anim->blend_shape_track_interpolate(j, from, &interp);
+ anim->blend_shape_track_interpolate(j, from, &interp);
new_anim->blend_shape_track_insert_key(dtrack, 0, interp);
}
}
}
- if (default_anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
+ if (anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
Vector3 p;
- default_anim->position_track_get_key(j, k, &p);
+ anim->position_track_get_key(j, k, &p);
new_anim->position_track_insert_key(dtrack, kt - from, p);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
Quaternion r;
- default_anim->rotation_track_get_key(j, k, &r);
+ anim->rotation_track_get_key(j, k, &r);
new_anim->rotation_track_insert_key(dtrack, kt - from, r);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
Vector3 s;
- default_anim->scale_track_get_key(j, k, &s);
+ anim->scale_track_get_key(j, k, &s);
new_anim->scale_track_insert_key(dtrack, kt - from, s);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
- Variant var = default_anim->track_get_key_value(j, k);
+ } else if (anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = anim->track_get_key_value(j, k);
new_anim->track_insert_key(dtrack, kt - from, var);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
float interp;
- default_anim->blend_shape_track_get_key(j, k, &interp);
+ anim->blend_shape_track_get_key(j, k, &interp);
new_anim->blend_shape_track_insert_key(dtrack, kt - from, interp);
}
}
if (dtrack != -1 && kt >= to) {
- if (default_anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
+ if (anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
Vector3 p;
- default_anim->position_track_interpolate(j, to, &p);
+ anim->position_track_interpolate(j, to, &p);
new_anim->position_track_insert_key(dtrack, to - from, p);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
Quaternion r;
- default_anim->rotation_track_interpolate(j, to, &r);
+ anim->rotation_track_interpolate(j, to, &r);
new_anim->rotation_track_insert_key(dtrack, to - from, r);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
Vector3 s;
- default_anim->scale_track_interpolate(j, to, &s);
+ anim->scale_track_interpolate(j, to, &s);
new_anim->scale_track_insert_key(dtrack, to - from, s);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
- Variant var = default_anim->value_track_interpolate(j, to);
+ } else if (anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = anim->value_track_interpolate(j, to);
new_anim->track_insert_key(dtrack, to - from, var);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
float interp;
- default_anim->blend_shape_track_interpolate(j, to, &interp);
+ anim->blend_shape_track_interpolate(j, to, &interp);
new_anim->blend_shape_track_insert_key(dtrack, to - from, interp);
}
}
}
if (dtrack == -1 && p_bake_all) {
- new_anim->add_track(default_anim->track_get_type(j));
+ new_anim->add_track(anim->track_get_type(j));
dtrack = new_anim->get_track_count() - 1;
- new_anim->track_set_path(dtrack, default_anim->track_get_path(j));
- if (default_anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
+ new_anim->track_set_path(dtrack, anim->track_get_path(j));
+ if (anim->track_get_type(j) == Animation::TYPE_POSITION_3D) {
Vector3 p;
- default_anim->position_track_interpolate(j, from, &p);
+ anim->position_track_interpolate(j, from, &p);
new_anim->position_track_insert_key(dtrack, 0, p);
- default_anim->position_track_interpolate(j, to, &p);
+ anim->position_track_interpolate(j, to, &p);
new_anim->position_track_insert_key(dtrack, to - from, p);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_ROTATION_3D) {
Quaternion r;
- default_anim->rotation_track_interpolate(j, from, &r);
+ anim->rotation_track_interpolate(j, from, &r);
new_anim->rotation_track_insert_key(dtrack, 0, r);
- default_anim->rotation_track_interpolate(j, to, &r);
+ anim->rotation_track_interpolate(j, to, &r);
new_anim->rotation_track_insert_key(dtrack, to - from, r);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_SCALE_3D) {
Vector3 s;
- default_anim->scale_track_interpolate(j, from, &s);
+ anim->scale_track_interpolate(j, from, &s);
new_anim->scale_track_insert_key(dtrack, 0, s);
- default_anim->scale_track_interpolate(j, to, &s);
+ anim->scale_track_interpolate(j, to, &s);
new_anim->scale_track_insert_key(dtrack, to - from, s);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
- Variant var = default_anim->value_track_interpolate(j, from);
+ } else if (anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = anim->value_track_interpolate(j, from);
new_anim->track_insert_key(dtrack, 0, var);
- Variant to_var = default_anim->value_track_interpolate(j, to);
+ Variant to_var = anim->value_track_interpolate(j, to);
new_anim->track_insert_key(dtrack, to - from, to_var);
- } else if (default_anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
+ } else if (anim->track_get_type(j) == Animation::TYPE_BLEND_SHAPE) {
float interp;
- default_anim->blend_shape_track_interpolate(j, from, &interp);
+ anim->blend_shape_track_interpolate(j, from, &interp);
new_anim->blend_shape_track_insert_key(dtrack, 0, interp);
- default_anim->blend_shape_track_interpolate(j, to, &interp);
+ anim->blend_shape_track_interpolate(j, to, &interp);
new_anim->blend_shape_track_insert_key(dtrack, to - from, interp);
}
}
@@ -1562,7 +1562,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
}
}
- al->remove_animation("default"); // Remove default (no longer needed).
+ al->remove_animation(ap->find_animation(anim)); // Remove original animation (no longer needed).
}
void ResourceImporterScene::_optimize_animations(AnimationPlayer *anim, float p_max_vel_error, float p_max_ang_error, int p_prc_error) {
@@ -1642,6 +1642,17 @@ void ResourceImporterScene::get_internal_import_options(InternalImportCategory p
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "save_to_file/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "save_to_file/path", PROPERTY_HINT_SAVE_FILE, "*.res,*.tres"), ""));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "save_to_file/keep_custom_tracks"), ""));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slices/amount", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
+
+ for (int i = 0; i < 256; i++) {
+ r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "slice_" + itos(i + 1) + "/name"), ""));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/start_frame"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/end_frame"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/loop_mode", PROPERTY_HINT_ENUM, "None,Linear,Pingpong"), 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "slice_" + itos(i + 1) + "/save_to_file/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "slice_" + itos(i + 1) + "/save_to_file/path", PROPERTY_HINT_SAVE_FILE, ".res,*.tres"), ""));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "slice_" + itos(i + 1) + "/save_to_file/keep_custom_tracks"), false));
+ }
} break;
case INTERNAL_IMPORT_CATEGORY_ANIMATION_NODE: {
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "import/skip_import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
@@ -1654,17 +1665,6 @@ void ResourceImporterScene::get_internal_import_options(InternalImportCategory p
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/position", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/rotation", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/scale", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slices/amount", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
-
- for (int i = 0; i < 256; i++) {
- r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "slice_" + itos(i + 1) + "/name"), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/start_frame"), 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/end_frame"), 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "slice_" + itos(i + 1) + "/loop_mode", PROPERTY_HINT_ENUM, "None,Linear,Pingpong"), 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "slice_" + itos(i + 1) + "/save_to_file/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
- r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "slice_" + itos(i + 1) + "/save_to_file/path", PROPERTY_HINT_SAVE_FILE, ".res,*.tres"), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "slice_" + itos(i + 1) + "/save_to_file/keep_custom_tracks"), false));
- }
} break;
case INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE: {
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "import/skip_import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
@@ -1767,6 +1767,13 @@ bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategor
if (p_option == "save_to_file/path" || p_option == "save_to_file/keep_custom_tracks") {
return p_options["save_to_file/enabled"];
}
+ if (p_option.begins_with("slice_")) {
+ int max_slice = p_options["slices/amount"];
+ int slice = p_option.get_slice("_", 1).to_int() - 1;
+ if (slice >= max_slice) {
+ return false;
+ }
+ }
} break;
case INTERNAL_IMPORT_CATEGORY_ANIMATION_NODE: {
if (p_option.begins_with("optimizer/") && p_option != "optimizer/enabled" && !bool(p_options["optimizer/enabled"])) {
@@ -1775,14 +1782,6 @@ bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategor
if (p_option.begins_with("compression/") && p_option != "compression/enabled" && !bool(p_options["compression/enabled"])) {
return false;
}
-
- if (p_option.begins_with("slice_")) {
- int max_slice = p_options["slices/amount"];
- int slice = p_option.get_slice("_", 1).to_int() - 1;
- if (slice >= max_slice) {
- return false;
- }
- }
} break;
case INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE: {
const bool use_retarget = p_options["retarget/bone_map"].get_validated_object() != nullptr;
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 386519bc59..498e9f2964 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -283,7 +283,7 @@ public:
Node *_post_fix_animations(Node *p_node, Node *p_root, const Dictionary &p_node_data, const Dictionary &p_animation_data, float p_animation_fps);
Ref<Animation> _save_animation_to_file(Ref<Animation> anim, bool p_save_to_file, String p_save_to_path, bool p_keep_custom_tracks);
- void _create_clips(AnimationPlayer *anim, const Array &p_clips, bool p_bake_all);
+ void _create_slices(AnimationPlayer *ap, Ref<Animation> anim, const Array &p_clips, bool p_bake_all);
void _optimize_animations(AnimationPlayer *anim, float p_max_vel_error, float p_max_ang_error, int p_prc_error);
void _compress_animations(AnimationPlayer *anim, int p_page_size_kb);
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 73f1c0b39b..ed3f1ff489 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -233,7 +233,8 @@ void ResourceImporterTexture::get_import_options(const String &p_path, List<Impo
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "process/size_limit", PROPERTY_HINT_RANGE, "0,4096,1"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "detect_3d/compress_to", PROPERTY_HINT_ENUM, "Disabled,VRAM Compressed,Basis Universal"), (p_preset == PRESET_DETECT) ? 1 : 0));
- if (p_path.get_extension() == "svg") {
+ // Do path based customization only if a path was passed.
+ if (p_path.is_empty() || p_path.get_extension() == "svg") {
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "svg/scale", PROPERTY_HINT_RANGE, "0.001,100,0.001"), 1.0));
// Editor use only, applies to SVG.
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index 9171f04f42..bf22a9377e 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -273,9 +273,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
EditorAtlasPacker::chart_pack(charts, atlas_width, atlas_height);
//blit the atlas
- Ref<Image> new_atlas;
- new_atlas.instantiate();
- new_atlas->create(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
+ Ref<Image> new_atlas = Image::create_empty(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
for (int i = 0; i < pack_data_files.size(); i++) {
PackData &pack_data = pack_data_files.write[i];
diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp
index ed9a5898fb..c577c61db7 100644
--- a/editor/input_event_configuration_dialog.cpp
+++ b/editor/input_event_configuration_dialog.cpp
@@ -533,6 +533,10 @@ String InputEventConfigurationDialog::_get_device_string(int p_device) const {
void InputEventConfigurationDialog::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ event_listener->grab_focus();
+ } break;
+
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
input_list_search->set_right_icon(input_list_search->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index dc84c08506..b4737976d8 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -128,14 +128,11 @@ void AnimationPlayerEditor::_notification(int p_what) {
{
Ref<Image> autoplay_img = autoplay_icon->get_image();
Ref<Image> reset_img = reset_icon->get_image();
- Ref<Image> autoplay_reset_img;
Size2 icon_size = autoplay_img->get_size();
- autoplay_reset_img.instantiate();
- autoplay_reset_img->create(icon_size.x * 2, icon_size.y, false, autoplay_img->get_format());
+ Ref<Image> autoplay_reset_img = Image::create_empty(icon_size.x * 2, icon_size.y, false, autoplay_img->get_format());
autoplay_reset_img->blit_rect(autoplay_img, Rect2i(Point2i(), icon_size), Point2i());
autoplay_reset_img->blit_rect(reset_img, Rect2i(Point2i(), icon_size), Point2i(icon_size.x, 0));
- autoplay_reset_icon.instantiate();
- autoplay_reset_icon->set_image(autoplay_reset_img);
+ autoplay_reset_icon = ImageTexture::create_from_image(autoplay_reset_img);
}
stop->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
@@ -302,6 +299,8 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
AnimationPlayerEditor::get_singleton()->get_track_editor()->update_keying();
_animation_key_editor_seek(timeline_position, false);
+
+ emit_signal("animation_selected", current);
}
void AnimationPlayerEditor::_animation_new() {
@@ -720,7 +719,18 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) {
if (p_state.has("player")) {
Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]);
if (Object::cast_to<AnimationPlayer>(n) && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
+ if (player) {
+ if (player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) {
+ player->disconnect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated));
+ }
+ }
player = Object::cast_to<AnimationPlayer>(n);
+ if (player) {
+ if (!player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) {
+ player->connect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated));
+ }
+ }
+
_update_player();
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
set_process(true);
@@ -982,9 +992,18 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
if (player && pin->is_pressed()) {
return; // Ignore, pinned.
}
+
+ if (player) {
+ if (player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) {
+ player->disconnect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated));
+ }
+ }
player = p_player;
if (player) {
+ if (!player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) {
+ player->connect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated));
+ }
_update_player();
if (onion.enabled) {
@@ -1151,6 +1170,10 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) {
}
}
+void AnimationPlayerEditor::_animation_libraries_updated() {
+ _animation_player_changed(player);
+}
+
void AnimationPlayerEditor::_list_changed() {
if (is_visible_in_tree()) {
_update_player();
@@ -1545,6 +1568,7 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_animation_edit"), &AnimationPlayerEditor::_animation_edit);
ClassDB::bind_method(D_METHOD("_animation_resource_edit"), &AnimationPlayerEditor::_animation_resource_edit);
ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed);
+ ClassDB::bind_method(D_METHOD("_animation_libraries_updated"), &AnimationPlayerEditor::_animation_libraries_updated);
ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed);
ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate);
@@ -1552,6 +1576,8 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2);
ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning);
ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning);
+
+ ADD_SIGNAL(MethodInfo("animation_selected", PropertyInfo(Variant::STRING, "name")));
}
AnimationPlayerEditor *AnimationPlayerEditor::singleton = nullptr;
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 448a0639b1..ae570e53f3 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -195,6 +195,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _blend_edited();
void _animation_player_changed(Object *p_pl);
+ void _animation_libraries_updated();
void _animation_key_editor_seek(float p_pos, bool p_drag, bool p_timeline_only = false);
void _animation_key_editor_anim_len_changed(float p_len);
diff --git a/editor/plugins/bone_map_editor_plugin.h b/editor/plugins/bone_map_editor_plugin.h
index 55261ab477..16e5403978 100644
--- a/editor/plugins/bone_map_editor_plugin.h
+++ b/editor/plugins/bone_map_editor_plugin.h
@@ -206,7 +206,6 @@ class BoneMapEditor : public VBoxContainer {
BoneMapper *bone_mapper = nullptr;
void fetch_objects();
- void clear_editors();
void create_editors();
protected:
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 6e108a9a72..fe33a91a41 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -5060,6 +5060,7 @@ CanvasItemEditor::CanvasItemEditor() {
zoom_widget = memnew(EditorZoomWidget);
controls_vb->add_child(zoom_widget);
zoom_widget->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT, Control::PRESET_MODE_MINSIZE, 2 * EDSCALE);
+ zoom_widget->set_shortcut_context(this);
zoom_widget->connect("zoom_changed", callable_mp(this, &CanvasItemEditor::_update_zoom));
panner.instantiate();
@@ -5316,7 +5317,7 @@ CanvasItemEditor::CanvasItemEditor() {
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KeyModifierMask::SHIFT | Key::F), VIEW_FRAME_TO_SELECTION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/clear_guides", TTR("Clear Guides")), CLEAR_GUIDES);
p->add_separator();
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL | Key::P), PREVIEW_CANVAS_SCALE);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale")), PREVIEW_CANVAS_SCALE);
main_menu_hbox->add_child(memnew(VSeparator));
@@ -5454,6 +5455,15 @@ void CanvasItemEditorPlugin::set_state(const Dictionary &p_state) {
canvas_item_editor->set_state(p_state);
}
+void CanvasItemEditorPlugin::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ connect("scene_changed", callable_mp((CanvasItem *)canvas_item_editor->get_viewport_control(), &CanvasItem::queue_redraw).unbind(1));
+ connect("scene_closed", callable_mp((CanvasItem *)canvas_item_editor->get_viewport_control(), &CanvasItem::queue_redraw).unbind(1));
+ } break;
+ }
+}
+
CanvasItemEditorPlugin::CanvasItemEditorPlugin() {
canvas_item_editor = memnew(CanvasItemEditor);
canvas_item_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index b731d3cc7d..3ade048e4b 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -563,6 +563,9 @@ class CanvasItemEditorPlugin : public EditorPlugin {
CanvasItemEditor *canvas_item_editor = nullptr;
+protected:
+ void _notification(int p_what);
+
public:
virtual String get_name() const override { return "2D"; }
bool has_main_screen() const override { return true; }
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 8d1df0b32c..434e6a92e3 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -805,7 +805,7 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons
img_ref.instantiate();
Image &im = **img_ref;
- im.create(thumbnail_size, thumbnail_size / 2, false, Image::FORMAT_RGBA8);
+ im.initialize_data(thumbnail_size, thumbnail_size / 2, false, Image::FORMAT_RGBA8);
Color bg_color(0.1, 0.1, 0.1, 1.0);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 59b8f31720..836f76ac4f 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -210,9 +210,7 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const Ref<Resource> &p_from,
}
}
- Ref<Image> img;
- img.instantiate();
- img->create(bm->get_size().width, bm->get_size().height, false, Image::FORMAT_L8, data);
+ Ref<Image> img = Image::create_from_data(bm->get_size().width, bm->get_size().height, false, Image::FORMAT_L8, data);
if (img->is_compressed()) {
if (img->decompress() != OK) {
@@ -483,10 +481,8 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from,
int line = 0;
int col = 0;
- Ref<Image> img;
- img.instantiate();
int thumbnail_size = MAX(p_size.x, p_size.y);
- img->create(thumbnail_size, thumbnail_size, false, Image::FORMAT_RGBA8);
+ Ref<Image> img = Image::create_empty(thumbnail_size, thumbnail_size, false, Image::FORMAT_RGBA8);
Color bg_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/background_color");
Color keyword_color = EditorSettings::get_singleton()->get("text_editor/theme/highlighting/keyword_color");
@@ -660,9 +656,7 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const Ref<Resource> &p_f
//post_process_preview(img);
- Ref<Image> image;
- image.instantiate();
- image->create(w, h, false, Image::FORMAT_RGB8, img);
+ Ref<Image> image = Image::create_from_data(w, h, false, Image::FORMAT_RGB8, img);
return ImageTexture::create_from_image(image);
}
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 1b2afe2151..891b9efa4f 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -299,7 +299,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
}
img.instantiate();
- img->create(w, h, false, Image::FORMAT_RGF, texdata);
+ img->set_data(w, h, false, Image::FORMAT_RGF, texdata);
pm->set_emission_point_texture(ImageTexture::create_from_image(img));
pm->set_emission_point_count(vpc);
@@ -315,7 +315,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
}
img.instantiate();
- img->create(w, h, false, Image::FORMAT_RGBA8, colordata);
+ img->set_data(w, h, false, Image::FORMAT_RGBA8, colordata);
pm->set_emission_color_texture(ImageTexture::create_from_image(img));
}
@@ -335,7 +335,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
}
img.instantiate();
- img->create(w, h, false, Image::FORMAT_RGF, normdata);
+ img->set_data(w, h, false, Image::FORMAT_RGF, normdata);
pm->set_emission_normal_texture(ImageTexture::create_from_image(img));
} else {
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 7194cd9d27..26af5e3f2d 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -4751,9 +4751,9 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (err == OK) {
Vector<Vector3> points2;
points2.resize(md.edges.size() * 2);
- for (int i = 0; i < md.edges.size(); i++) {
- points2.write[i * 2 + 0] = md.vertices[md.edges[i].a];
- points2.write[i * 2 + 1] = md.vertices[md.edges[i].b];
+ for (uint32_t i = 0; i < md.edges.size(); i++) {
+ points2.write[i * 2 + 0] = md.vertices[md.edges[i].vertex_a];
+ points2.write[i * 2 + 1] = md.vertices[md.edges[i].vertex_b];
}
p_gizmo->add_lines(points2, material);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 4430877b8a..421e8debed 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2400,6 +2400,9 @@ void Node3DEditorViewport::_project_settings_changed() {
const bool use_taa = GLOBAL_GET("rendering/anti_aliasing/quality/use_taa");
viewport->set_use_taa(use_taa);
+ const bool transparent_background = GLOBAL_GET("rendering/transparent_background");
+ viewport->set_transparent_background(transparent_background);
+
const bool use_debanding = GLOBAL_GET("rendering/anti_aliasing/quality/use_debanding");
viewport->set_use_debanding(use_debanding);
@@ -2432,6 +2435,7 @@ void Node3DEditorViewport::_notification(int p_what) {
bool vp_visible = is_visible_in_tree();
set_process(vp_visible);
+ set_physics_process(vp_visible);
if (vp_visible) {
orthogonal = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_ORTHOGONAL));
@@ -2655,6 +2659,21 @@ void Node3DEditorViewport::_notification(int p_what) {
}
} break;
+ case NOTIFICATION_PHYSICS_PROCESS: {
+ if (!update_preview_node) {
+ return;
+ }
+ if (preview_node->is_inside_tree()) {
+ preview_node_pos = _get_instance_position(preview_node_viewport_pos);
+ Transform3D preview_gl_transform = Transform3D(Basis(), preview_node_pos);
+ preview_node->set_global_transform(preview_gl_transform);
+ if (!preview_node->is_visible()) {
+ preview_node->show();
+ }
+ }
+ update_preview_node = false;
+ } break;
+
case NOTIFICATION_ENTER_TREE: {
surface->connect("draw", callable_mp(this, &Node3DEditorViewport::_draw));
surface->connect("gui_input", callable_mp(this, &Node3DEditorViewport::_sinput));
@@ -4026,7 +4045,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
gl_transform = parent_node3d->get_global_gizmo_transform();
}
- gl_transform.origin = spatial_editor->snap_point(_get_instance_position(p_point));
+ gl_transform.origin = spatial_editor->snap_point(preview_node_pos);
gl_transform.basis *= node3d->get_transform().basis;
editor_data->get_undo_redo()->add_do_method(instantiated_scene, "set_global_transform", gl_transform);
@@ -4090,7 +4109,9 @@ void Node3DEditorViewport::_perform_drop_data() {
}
}
-bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
+bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
+ preview_node_viewport_pos = p_point;
+
bool can_instantiate = false;
if (!preview_node->is_inside_tree() && spatial_editor->get_preview_material().is_null()) {
@@ -4154,6 +4175,7 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
}
if (can_instantiate) {
_create_preview_node(files);
+ preview_node->hide();
}
}
} else {
@@ -4163,8 +4185,7 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
}
if (can_instantiate) {
- Transform3D gl_transform = Transform3D(Basis(), _get_instance_position(p_point));
- preview_node->set_global_transform(gl_transform);
+ update_preview_node = true;
return true;
}
@@ -4773,10 +4794,9 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
view_menu->get_popup()->connect("id_pressed", callable_mp(this, &Node3DEditorViewport::_menu_option));
display_submenu->connect("id_pressed", callable_mp(this, &Node3DEditorViewport::_menu_option));
view_menu->set_disable_shortcuts(true);
-#ifndef _MSC_VER
-#warning this needs to be fixed
-#endif
- //if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) {
+
+ // TODO: Re-evaluate with new OpenGL3 renderer, and implement.
+ //if (OS::get_singleton()->get_current_video_driver() == OS::RENDERING_DRIVER_OPENGL3) {
if (false) {
// Alternate display modes only work when using the Vulkan renderer; make this explicit.
const int normal_idx = view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL);
@@ -6930,6 +6950,10 @@ HashSet<RID> _get_physics_bodies_rid(Node *node) {
}
void Node3DEditor::snap_selected_nodes_to_floor() {
+ do_snap_selected_nodes_to_floor = true;
+}
+
+void Node3DEditor::_snap_selected_nodes_to_floor() {
const List<Node *> &selection = editor_selection->get_selected_node_list();
Dictionary snap_data;
@@ -7227,6 +7251,13 @@ void Node3DEditor::_notification(int p_what) {
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_pressed(false);
}
} break;
+
+ case NOTIFICATION_PHYSICS_PROCESS: {
+ if (do_snap_selected_nodes_to_floor) {
+ _snap_selected_nodes_to_floor();
+ do_snap_selected_nodes_to_floor = false;
+ }
+ }
}
}
@@ -8347,10 +8378,12 @@ void Node3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
spatial_editor->show();
spatial_editor->set_process(true);
+ spatial_editor->set_physics_process(true);
} else {
spatial_editor->hide();
spatial_editor->set_process(false);
+ spatial_editor->set_physics_process(false);
}
}
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index c76f534c22..6ff0fa3afe 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -193,6 +193,9 @@ private:
void _menu_option(int p_option);
void _set_auto_orthogonal();
Node3D *preview_node = nullptr;
+ bool update_preview_node = false;
+ Point2 preview_node_viewport_pos;
+ Vector3 preview_node_pos;
AABB *preview_bounds = nullptr;
Vector<String> selected_files;
AcceptDialog *accept = nullptr;
@@ -413,7 +416,7 @@ private:
bool _create_instance(Node *parent, String &path, const Point2 &p_point);
void _perform_drop_data();
- bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
+ bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
void _project_settings_changed();
@@ -720,6 +723,9 @@ private:
void _selection_changed();
void _refresh_menu_icons();
+ bool do_snap_selected_nodes_to_floor = false;
+ void _snap_selected_nodes_to_floor();
+
// Preview Sun and Environment
uint32_t world_env_count = 0;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 58a0160010..8607f98a90 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1978,18 +1978,6 @@ void ScriptTextEditor::_enable_code_editor() {
add_child(connection_info_dialog);
- edit_hb->add_child(search_menu);
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
- search_menu->get_popup()->add_separator();
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
- search_menu->get_popup()->add_separator();
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL);
- search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
-
edit_hb->add_child(edit_menu);
edit_menu->connect("about_to_popup", callable_mp(this, &ScriptTextEditor::_prepare_edit_menu));
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO);
@@ -2000,38 +1988,73 @@ void ScriptTextEditor::_enable_code_editor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_paste"), EDIT_PASTE);
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_select_all"), EDIT_SELECT_ALL);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_selection"), EDIT_DUPLICATE_SELECTION);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_all_lines"), EDIT_FOLD_ALL_LINES);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES);
+ {
+ PopupMenu *sub_menu = memnew(PopupMenu);
+ sub_menu->set_name("line_menu");
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent"), EDIT_INDENT);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unindent"), EDIT_UNINDENT);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
+ sub_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
+ edit_menu->get_popup()->add_child(sub_menu);
+ edit_menu->get_popup()->add_submenu_item(TTR("Line"), "line_menu");
+ }
+ {
+ PopupMenu *sub_menu = memnew(PopupMenu);
+ sub_menu->set_name("folding_menu");
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_all_lines"), EDIT_FOLD_ALL_LINES);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES);
+ sub_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
+ edit_menu->get_popup()->add_child(sub_menu);
+ edit_menu->get_popup()->add_submenu_item(TTR("Folding"), "folding_menu");
+ }
edit_menu->get_popup()->add_separator();
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_selection"), EDIT_DUPLICATE_SELECTION);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_completion_query"), EDIT_COMPLETE);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
- edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT);
+ {
+ PopupMenu *sub_menu = memnew(PopupMenu);
+ sub_menu->set_name("indent_menu");
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
+ sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT);
+ sub_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
+ edit_menu->get_popup()->add_child(sub_menu);
+ edit_menu->get_popup()->add_submenu_item(TTR("Indentation"), "indent_menu");
+ }
edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_separator();
-
- edit_menu->get_popup()->add_child(convert_case);
- edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KeyModifierMask::SHIFT | Key::F4), EDIT_TO_UPPERCASE);
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KeyModifierMask::SHIFT | Key::F5), EDIT_TO_LOWERCASE);
- convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KeyModifierMask::SHIFT | Key::F6), EDIT_CAPITALIZE);
- convert_case->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
-
+ {
+ PopupMenu *sub_menu = memnew(PopupMenu);
+ sub_menu->set_name("convert_case");
+ sub_menu->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KeyModifierMask::SHIFT | Key::F4), EDIT_TO_UPPERCASE);
+ sub_menu->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KeyModifierMask::SHIFT | Key::F5), EDIT_TO_LOWERCASE);
+ sub_menu->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KeyModifierMask::SHIFT | Key::F6), EDIT_CAPITALIZE);
+ sub_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
+ edit_menu->get_popup()->add_child(sub_menu);
+ edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
+ }
edit_menu->get_popup()->add_child(highlighter_menu);
edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu");
highlighter_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_change_syntax_highlighter));
+ edit_hb->add_child(search_menu);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
+ search_menu->get_popup()->add_separator();
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
+ search_menu->get_popup()->add_separator();
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL);
+ search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
+
_load_theme_settings();
edit_hb->add_child(goto_menu);
@@ -2106,9 +2129,6 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->set_switch_on_hover(true);
edit_menu->set_shortcut_context(this);
- convert_case = memnew(PopupMenu);
- convert_case->set_name("convert_case");
-
highlighter_menu = memnew(PopupMenu);
highlighter_menu->set_name("highlighter_menu");
@@ -2153,7 +2173,6 @@ ScriptTextEditor::~ScriptTextEditor() {
memdelete(color_panel);
memdelete(edit_hb);
memdelete(edit_menu);
- memdelete(convert_case);
memdelete(highlighter_menu);
memdelete(search_menu);
memdelete(goto_menu);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index fb02e5c7c4..c165295a8e 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -79,7 +79,6 @@ class ScriptTextEditor : public ScriptEditorBase {
PopupMenu *breakpoints_menu = nullptr;
PopupMenu *highlighter_menu = nullptr;
PopupMenu *context_menu = nullptr;
- PopupMenu *convert_case = nullptr;
GotoLineDialog *goto_line_dialog = nullptr;
ScriptEditorQuickOpen *quick_open = nullptr;
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index cfece173d6..5dac66d3e1 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -414,16 +414,16 @@ void SpriteFramesEditor::_notification(int p_what) {
load_sheet->set_icon(get_theme_icon(SNAME("SpriteSheet"), SNAME("EditorIcons")));
copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
paste->set_icon(get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")));
- empty->set_icon(get_theme_icon(SNAME("InsertBefore"), SNAME("EditorIcons")));
- empty2->set_icon(get_theme_icon(SNAME("InsertAfter"), SNAME("EditorIcons")));
+ empty_before->set_icon(get_theme_icon(SNAME("InsertBefore"), SNAME("EditorIcons")));
+ empty_after->set_icon(get_theme_icon(SNAME("InsertAfter"), SNAME("EditorIcons")));
move_up->set_icon(get_theme_icon(SNAME("MoveLeft"), SNAME("EditorIcons")));
move_down->set_icon(get_theme_icon(SNAME("MoveRight"), SNAME("EditorIcons")));
- _delete->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
+ delete_frame->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
zoom_out->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons")));
zoom_reset->set_icon(get_theme_icon(SNAME("ZoomReset"), SNAME("EditorIcons")));
zoom_in->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons")));
- new_anim->set_icon(get_theme_icon(SNAME("New"), SNAME("EditorIcons")));
- remove_anim->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
+ add_anim->set_icon(get_theme_icon(SNAME("New"), SNAME("EditorIcons")));
+ delete_anim->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
anim_search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
split_sheet_zoom_out->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons")));
split_sheet_zoom_reset->set_icon(get_theme_icon(SNAME("ZoomReset"), SNAME("EditorIcons")));
@@ -1016,19 +1016,19 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
hide();
}
- new_anim->set_disabled(read_only);
- remove_anim->set_disabled(read_only);
+ add_anim->set_disabled(read_only);
+ delete_anim->set_disabled(read_only);
anim_speed->set_editable(!read_only);
anim_loop->set_disabled(read_only);
load->set_disabled(read_only);
load_sheet->set_disabled(read_only);
copy->set_disabled(read_only);
paste->set_disabled(read_only);
- empty->set_disabled(read_only);
- empty2->set_disabled(read_only);
+ empty_before->set_disabled(read_only);
+ empty_after->set_disabled(read_only);
move_up->set_disabled(read_only);
move_down->set_disabled(read_only);
- _delete->set_disabled(read_only);
+ delete_frame->set_disabled(read_only);
}
void SpriteFramesEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
@@ -1187,18 +1187,16 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *hbc_animlist = memnew(HBoxContainer);
sub_vb->add_child(hbc_animlist);
- new_anim = memnew(Button);
- new_anim->set_flat(true);
- new_anim->set_tooltip_text(TTR("New Animation"));
- hbc_animlist->add_child(new_anim);
- new_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add));
+ add_anim = memnew(Button);
+ add_anim->set_flat(true);
+ hbc_animlist->add_child(add_anim);
+ add_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add));
- remove_anim = memnew(Button);
- remove_anim->set_flat(true);
- remove_anim->set_tooltip_text(TTR("Remove Animation"));
- hbc_animlist->add_child(remove_anim);
- remove_anim->set_disabled(true);
- remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
+ delete_anim = memnew(Button);
+ delete_anim->set_flat(true);
+ hbc_animlist->add_child(delete_anim);
+ delete_anim->set_disabled(true);
+ delete_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
anim_search_box = memnew(LineEdit);
hbc_animlist->add_child(anim_search_box);
@@ -1215,6 +1213,11 @@ SpriteFramesEditor::SpriteFramesEditor() {
animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited));
animations->set_allow_reselect(true);
+ add_anim->set_shortcut_context(animations);
+ add_anim->set_shortcut(ED_SHORTCUT("sprite_frames/new_animation", TTR("Add Animation"), KeyModifierMask::CMD_OR_CTRL | Key::N));
+ delete_anim->set_shortcut_context(animations);
+ delete_anim->set_shortcut(ED_SHORTCUT("sprite_frames/delete_animation", TTR("Delete Animation"), Key::KEY_DELETE));
+
HBoxContainer *hbc_anim_speed = memnew(HBoxContainer);
hbc_anim_speed->add_child(memnew(Label(TTR("Speed:"))));
vbc_animlist->add_child(hbc_anim_speed);
@@ -1244,54 +1247,45 @@ SpriteFramesEditor::SpriteFramesEditor() {
load = memnew(Button);
load->set_flat(true);
- load->set_tooltip_text(TTR("Add a Texture from File"));
hbc->add_child(load);
load_sheet = memnew(Button);
load_sheet->set_flat(true);
- load_sheet->set_tooltip_text(TTR("Add Frames from a Sprite Sheet"));
hbc->add_child(load_sheet);
hbc->add_child(memnew(VSeparator));
copy = memnew(Button);
copy->set_flat(true);
- copy->set_tooltip_text(TTR("Copy"));
hbc->add_child(copy);
paste = memnew(Button);
paste->set_flat(true);
- paste->set_tooltip_text(TTR("Paste"));
hbc->add_child(paste);
hbc->add_child(memnew(VSeparator));
- empty = memnew(Button);
- empty->set_flat(true);
- empty->set_tooltip_text(TTR("Insert Empty (Before)"));
- hbc->add_child(empty);
+ empty_before = memnew(Button);
+ empty_before->set_flat(true);
+ hbc->add_child(empty_before);
- empty2 = memnew(Button);
- empty2->set_flat(true);
- empty2->set_tooltip_text(TTR("Insert Empty (After)"));
- hbc->add_child(empty2);
+ empty_after = memnew(Button);
+ empty_after->set_flat(true);
+ hbc->add_child(empty_after);
hbc->add_child(memnew(VSeparator));
move_up = memnew(Button);
move_up->set_flat(true);
- move_up->set_tooltip_text(TTR("Move (Before)"));
hbc->add_child(move_up);
move_down = memnew(Button);
move_down->set_flat(true);
- move_down->set_tooltip_text(TTR("Move (After)"));
hbc->add_child(move_down);
- _delete = memnew(Button);
- _delete->set_flat(true);
- _delete->set_tooltip_text(TTR("Delete"));
- hbc->add_child(_delete);
+ delete_frame = memnew(Button);
+ delete_frame->set_flat(true);
+ hbc->add_child(delete_frame);
hbc->add_spacer();
@@ -1333,13 +1327,40 @@ SpriteFramesEditor::SpriteFramesEditor() {
load->connect("pressed", callable_mp(this, &SpriteFramesEditor::_load_pressed));
load_sheet->connect("pressed", callable_mp(this, &SpriteFramesEditor::_open_sprite_sheet));
- _delete->connect("pressed", callable_mp(this, &SpriteFramesEditor::_delete_pressed));
+ delete_frame->connect("pressed", callable_mp(this, &SpriteFramesEditor::_delete_pressed));
copy->connect("pressed", callable_mp(this, &SpriteFramesEditor::_copy_pressed));
paste->connect("pressed", callable_mp(this, &SpriteFramesEditor::_paste_pressed));
- empty->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty_pressed));
- empty2->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty2_pressed));
+ empty_before->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty_pressed));
+ empty_after->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty2_pressed));
move_up->connect("pressed", callable_mp(this, &SpriteFramesEditor::_up_pressed));
move_down->connect("pressed", callable_mp(this, &SpriteFramesEditor::_down_pressed));
+
+ load->set_shortcut_context(tree);
+ load->set_shortcut(ED_SHORTCUT("sprite_frames/load_from_file", TTR("Add frame from file"), KeyModifierMask::CMD_OR_CTRL | Key::O));
+ load_sheet->set_shortcut_context(tree);
+ load_sheet->set_shortcut(ED_SHORTCUT("sprite_frames/load_from_sheet", TTR("Add frames from sprite sheet"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::O));
+ delete_frame->set_shortcut_context(tree);
+ delete_frame->set_shortcut(ED_SHORTCUT("sprite_frames/delete", TTR("Delete Frame"), Key::KEY_DELETE));
+ copy->set_shortcut_context(tree);
+ copy->set_shortcut(ED_SHORTCUT("sprite_frames/copy", TTR("Copy Frame"), KeyModifierMask::CMD_OR_CTRL | Key::C));
+ paste->set_shortcut_context(tree);
+ paste->set_shortcut(ED_SHORTCUT("sprite_frames/paste", TTR("Paste Frame"), KeyModifierMask::CMD_OR_CTRL | Key::V));
+ empty_before->set_shortcut_context(tree);
+ empty_before->set_shortcut(ED_SHORTCUT("sprite_frames/empty_before", TTR("Insert Empty (Before Selected)"), KeyModifierMask::ALT | Key::LEFT));
+ empty_after->set_shortcut_context(tree);
+ empty_after->set_shortcut(ED_SHORTCUT("sprite_frames/empty_after", TTR("Insert Empty (After Selected)"), KeyModifierMask::ALT | Key::RIGHT));
+ move_up->set_shortcut_context(tree);
+ move_up->set_shortcut(ED_SHORTCUT("sprite_frames/move_left", TTR("Move Frame Left"), KeyModifierMask::CMD_OR_CTRL | Key::LEFT));
+ move_down->set_shortcut_context(tree);
+ move_down->set_shortcut(ED_SHORTCUT("sprite_frames/move_right", TTR("Move Frame Right"), KeyModifierMask::CMD_OR_CTRL | Key::RIGHT));
+
+ zoom_out->set_shortcut_context(tree);
+ zoom_out->set_shortcut(ED_SHORTCUT_ARRAY("sprite_frames/zoom_out", TTR("Zoom Out"),
+ { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::MINUS), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_SUBTRACT) }));
+ zoom_in->set_shortcut_context(tree);
+ zoom_in->set_shortcut(ED_SHORTCUT_ARRAY("sprite_frames/zoom_in", TTR("Zoom In"),
+ { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::EQUAL), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_ADD) }));
+
file->connect("files_selected", callable_mp(this, &SpriteFramesEditor::_file_load_request).bind(-1));
loading_scene = false;
sel = -1;
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index 092f556c63..5fc3fe4481 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -61,11 +61,11 @@ class SpriteFramesEditor : public HSplitContainer {
Button *load = nullptr;
Button *load_sheet = nullptr;
- Button *_delete = nullptr;
+ Button *delete_frame = nullptr;
Button *copy = nullptr;
Button *paste = nullptr;
- Button *empty = nullptr;
- Button *empty2 = nullptr;
+ Button *empty_before = nullptr;
+ Button *empty_after = nullptr;
Button *move_up = nullptr;
Button *move_down = nullptr;
Button *zoom_out = nullptr;
@@ -75,8 +75,8 @@ class SpriteFramesEditor : public HSplitContainer {
bool loading_scene;
int sel;
- Button *new_anim = nullptr;
- Button *remove_anim = nullptr;
+ Button *add_anim = nullptr;
+ Button *delete_anim = nullptr;
LineEdit *anim_search_box = nullptr;
Tree *animations = nullptr;
diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp
index d7e08db954..167c6d169b 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.cpp
+++ b/editor/plugins/tiles/atlas_merging_dialog.cpp
@@ -47,9 +47,7 @@ void AtlasMergingDialog::_generate_merged(Vector<Ref<TileSetAtlasSource>> p_atla
merged_mapping.clear();
if (p_atlas_sources.size() >= 2) {
- Ref<Image> output_image;
- output_image.instantiate();
- output_image->create(1, 1, false, Image::FORMAT_RGBA8);
+ Ref<Image> output_image = Image::create_empty(1, 1, false, Image::FORMAT_RGBA8);
// Compute the new texture region size.
Vector2i new_texture_region_size;
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index c823487279..502c34459a 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -533,11 +533,11 @@ TileAtlasView::TileAtlasView() {
panel->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(panel);
- // Scrollingsc
zoom_widget = memnew(EditorZoomWidget);
add_child(zoom_widget);
zoom_widget->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT, Control::PRESET_MODE_MINSIZE, 2 * EDSCALE);
zoom_widget->connect("zoom_changed", callable_mp(this, &TileAtlasView::_zoom_widget_changed).unbind(1));
+ zoom_widget->set_shortcut_context(this);
button_center_view = memnew(Button);
button_center_view->set_icon(get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons")));
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 73ca8b6176..17b9035121 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -831,6 +831,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
editor_zoom_widget = memnew(EditorZoomWidget);
editor_zoom_widget->set_position(Vector2(5, 5));
editor_zoom_widget->connect("zoom_changed", callable_mp(this, &GenericTilePolygonEditor::_zoom_changed).unbind(1));
+ editor_zoom_widget->set_shortcut_context(this);
root->add_child(editor_zoom_widget);
button_center_view = memnew(Button);
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 7cc29dbfad..cbc95ef6d6 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -460,7 +460,7 @@ void TileMapEditorTilesPlugin::_update_theme() {
source_sort_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Sort"), SNAME("EditorIcons")));
select_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
paint_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
- line_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons")));
+ line_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Line"), SNAME("EditorIcons")));
rect_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Rectangle"), SNAME("EditorIcons")));
bucket_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Bucket"), SNAME("EditorIcons")));
@@ -2002,6 +2002,7 @@ void TileMapEditorTilesPlugin::_set_source_sort(int p_sort) {
}
TilesEditorPlugin::get_singleton()->set_sorting_option(p_sort);
_update_tile_set_sources_list();
+ EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "tile_source_sort", p_sort);
}
void TileMapEditorTilesPlugin::_bind_methods() {
@@ -3276,7 +3277,7 @@ void TileMapEditorTerrainsPlugin::_update_tiles_list() {
void TileMapEditorTerrainsPlugin::_update_theme() {
paint_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
- line_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons")));
+ line_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Line"), SNAME("EditorIcons")));
rect_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Rectangle"), SNAME("EditorIcons")));
bucket_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Bucket"), SNAME("EditorIcons")));
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp
index 68bc4389a2..6fdc9a80e8 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.cpp
+++ b/editor/plugins/tiles/tiles_editor_plugin.cpp
@@ -66,7 +66,9 @@ void TilesEditorPlugin::_thread() {
pattern_preview_sem.wait();
pattern_preview_mutex.lock();
- if (pattern_preview_queue.size()) {
+ if (pattern_preview_queue.size() == 0) {
+ pattern_preview_mutex.unlock();
+ } else {
QueueItem item = pattern_preview_queue.front()->get();
pattern_preview_queue.pop_front();
pattern_preview_mutex.unlock();
@@ -130,8 +132,6 @@ void TilesEditorPlugin::_thread() {
item.callback.callp(args_ptr, 2, r, error);
viewport->queue_delete();
- } else {
- pattern_preview_mutex.unlock();
}
}
}
@@ -268,8 +268,8 @@ List<int> TilesEditorPlugin::get_sorted_sources(const Ref<TileSet> p_tile_set) c
SourceNameComparator::tile_set = p_tile_set;
List<int> source_ids;
- for (int i = 0; i < tile_set->get_source_count(); i++) {
- source_ids.push_back(tile_set->get_source_id(i));
+ for (int i = 0; i < p_tile_set->get_source_count(); i++) {
+ source_ids.push_back(p_tile_set->get_source_id(i));
}
switch (source_sort) {
diff --git a/editor/plugins/tiles/tiles_editor_plugin.h b/editor/plugins/tiles/tiles_editor_plugin.h
index b1fe6f8df6..bdada9ec90 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.h
+++ b/editor/plugins/tiles/tiles_editor_plugin.h
@@ -122,7 +122,7 @@ public:
// Sorting.
void set_sorting_option(int p_option);
- List<int> get_sorted_sources(const Ref<TileSet> tile_set) const;
+ List<int> get_sorted_sources(const Ref<TileSet> p_tile_set) const;
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index d87513bfe1..8355f64fe5 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -3707,7 +3707,7 @@ void VisualShaderEditor::_notification(int p_what) {
[[fallthrough]];
}
case NOTIFICATION_THEME_CHANGED: {
- highend_label->set_modulate(get_theme_color(SNAME("vulkan_color"), SNAME("Editor")));
+ highend_label->set_modulate(get_theme_color(SNAME("highend_color"), SNAME("Editor")));
node_filter->set_right_icon(Control::get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index e702ba7020..78f3b4de0e 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -302,6 +302,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_cull_mask_bit", "get_cull_mask_value" }, // Camera3D
{ "get_cursor_position", "get_caret_column" }, // LineEdit
{ "get_d", "get_distance" }, // LineShape2D
+ { "get_depth_bias_enable", "get_depth_bias_enabled" }, // RDPipelineRasterizationState
{ "get_drag_data", "_get_drag_data" }, // Control
{ "get_drag_data_fw", "_get_drag_data_fw" }, // ScriptEditor
{ "get_editor_viewport", "get_editor_main_screen" }, // EditorPlugin
@@ -310,6 +311,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_error_string", "get_error_message" }, // JSON
{ "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
{ "get_focus_neighbour", "get_focus_neighbor" }, // Control
+ { "get_follow_smoothing", "get_position_smoothing_speed" }, // Camera2D
{ "get_font_types", "get_font_type_list" }, // Theme
{ "get_frame_color", "get_color" }, // ColorRect
{ "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer
@@ -358,6 +360,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_render_targetsize", "get_render_target_size" }, // XRInterface
{ "get_resource_type", "_get_resource_type" }, // ResourceFormatLoader
{ "get_result", "get_data" }, //JSON
+ { "get_reverb_bus", "set_reverb_bus_name" }, // Area3D
{ "get_rpc_sender_id", "get_remote_sender_id" }, // Multiplayer API
{ "get_save_extension", "_get_save_extension" }, // EditorImportPlugin
{ "get_scancode", "get_keycode" }, // InputEventKey
@@ -417,6 +420,7 @@ static const char *gdscript_function_renames[][2] = {
{ "is_commiting_action", "is_committing_action" }, // UndoRedo
{ "is_doubleclick", "is_double_click" }, // InputEventMouseButton
{ "is_draw_red", "is_draw_warning" }, // EditorProperty
+ { "is_follow_smoothing_enabled", "is_position_smoothing_enabled" }, // Camera2D
{ "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D
{ "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
{ "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D
@@ -495,13 +499,16 @@ static const char *gdscript_function_renames[][2] = {
{ "set_cull_mask_bit", "set_cull_mask_value" }, // Camera3D
{ "set_cursor_position", "set_caret_column" }, // LineEdit
{ "set_d", "set_distance" }, // WorldMarginShape2D
+ { "set_depth_bias_enable", "set_depth_bias_enabled" }, // RDPipelineRasterizationState
{ "set_doubleclick", "set_double_click" }, // InputEventMouseButton
{ "set_draw_red", "set_draw_warning" }, // EditorProperty
+ { "set_enable_follow_smoothing", "set_position_smoothing_enabled" }, // Camera2D
{ "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton
{ "set_endian_swap", "set_big_endian" }, // File
{ "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit
{ "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
{ "set_focus_neighbour", "set_focus_neighbor" }, // Control
+ { "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D
{ "set_frame_color", "set_color" }, // ColorRect
{ "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer
{ "set_gravity_distance_scale", "set_gravity_point_distance_scale" }, // Area2D
@@ -525,9 +532,11 @@ static const char *gdscript_function_renames[][2] = {
{ "set_oneshot", "set_one_shot" }, // AnimatedTexture
{ "set_pause_mode", "set_process_mode" }, // Node
{ "set_physical_scancode", "set_physical_keycode" }, // InputEventKey
+ { "set_proximity_fade", "set_proximity_fade_enabled" }, // Material
{ "set_refuse_new_network_connections", "set_refuse_new_connections" }, // Multiplayer API
{ "set_region", "set_region_enabled" }, // Sprite2D, Sprite broke AtlasTexture
{ "set_region_filter_clip", "set_region_filter_clip_enabled" }, // Sprite2D
+ { "set_reverb_bus", "set_reverb_bus_name" }, // Area3D
{ "set_rotate", "set_rotates" }, // PathFollow2D
{ "set_scancode", "set_keycode" }, // InputEventKey
{ "set_shift", "set_shift_pressed" }, // InputEventWithModifiers
@@ -741,12 +750,14 @@ static const char *csharp_function_renames[][2] = {
{ "GetCullMaskBit", "GetCullMaskValue" }, // Camera3D
{ "GetCursorPosition", "GetCaretColumn" }, // LineEdit
{ "GetD", "GetDistance" }, // LineShape2D
+ { "GetDepthBiasEnable", "GetDepthBiasEnabled" }, // RDPipelineRasterizationState
{ "GetDragDataFw", "_GetDragDataFw" }, // ScriptEditor
{ "GetEditorViewport", "GetViewport" }, // EditorPlugin
{ "GetEnabledFocusMode", "GetFocusMode" }, // BaseButton
{ "GetEndianSwap", "IsBigEndian" }, // File
{ "GetErrorString", "GetErrorMessage" }, // JSON
{ "GetFocusNeighbour", "GetFocusNeighbor" }, // Control
+ { "GetFollowSmoothing", "GetFollowSmoothingSpeed" }, // Camera2D
{ "GetFontTypes", "GetFontTypeList" }, // Theme
{ "GetFrameColor", "GetColor" }, // ColorRect
{ "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer
@@ -794,6 +805,7 @@ static const char *csharp_function_renames[][2] = {
{ "GetRenderTargetsize", "GetRenderTargetSize" }, // XRInterface
{ "GetResourceType", "_GetResourceType" }, // ResourceFormatLoader
{ "GetResult", "GetData" }, //JSON
+ { "GetReverbBus", "GetReverbBusName" }, // Area3D
{ "GetRpcSenderId", "GetRemoteSenderId" }, // Multiplayer API
{ "GetSaveExtension", "_GetSaveExtension" }, // EditorImportPlugin
{ "GetScancode", "GetKeycode" }, // InputEventKey
@@ -851,6 +863,7 @@ static const char *csharp_function_renames[][2] = {
{ "IsAParentOf", "IsAncestorOf" }, // Node
{ "IsCommitingAction", "IsCommittingAction" }, // UndoRedo
{ "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton
+ { "IsFollowSmoothingEnabled", "IsPositionSmoothingEnabled" }, // Camera2D
{ "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D
{ "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
{ "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node
@@ -925,11 +938,14 @@ static const char *csharp_function_renames[][2] = {
{ "SetCullMaskBit", "SetCullMaskValue" }, // Camera3D
{ "SetCursorPosition", "SetCaretColumn" }, // LineEdit
{ "SetD", "SetDistance" }, // WorldMarginShape2D
+ { "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState
{ "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton
+ { "SetEnableFollowSmoothing", "SetFollowSmoothingEnabled" }, // Camera2D
{ "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton
{ "SetEndianSwap", "SetBigEndian" }, // File
{ "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit
{ "SetFocusNeighbour", "SetFocusNeighbor" }, // Control
+ { "SetFollowSmoothing", "SetFollowSmoothingSpeed" }, // Camera2D
{ "SetFrameColor", "SetColor" }, // ColorRect
{ "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer
{ "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D
@@ -951,9 +967,11 @@ static const char *csharp_function_renames[][2] = {
{ "SetNetworkPeer", "SetMultiplayerPeer" }, // Multiplayer API
{ "SetOneshot", "SetOneShot" }, // AnimatedTexture
{ "SetPhysicalScancode", "SetPhysicalKeycode" }, // InputEventKey
+ { "SetProximityFade", "SetProximityFadeEnabled" }, // Material
{ "SetRefuseNewNetworkConnections", "SetRefuseNewConnections" }, // Multiplayer API
{ "SetRegion", "SetRegionEnabled" }, // Sprite2D, Sprite broke AtlasTexture
{ "SetRegionFilterClip", "SetRegionFilterClipEnabled" }, // Sprite2D
+ { "SetReverbBus", "SetReverbBusName" }, // Area3D
{ "SetRotate", "SetRotates" }, // PathFollow2D
{ "SetScancode", "SetKeycode" }, // InputEventKey
{ "SetShift", "SetShiftPressed" }, // InputEventWithModifiers
@@ -1071,6 +1089,7 @@ static const char *gdscript_properties_renames[][2] = {
{ "close_v_ofs", "close_v_offset" }, // Theme
{ "commentfocus", "comment_focus" }, // Theme
{ "contacts_reported", "max_contacts_reported" }, // RigidBody
+ { "depth_bias_enable", "depth_bias_enabled" }, // RDPipelineRasterizationState
{ "drag_margin_bottom", "drag_bottom_margin" }, // Camera2D
{ "drag_margin_h_enabled", "drag_horizontal_enabled" }, // Camera2D
{ "drag_margin_left", "drag_left_margin" }, // Camera2D
@@ -1113,6 +1132,7 @@ static const char *gdscript_properties_renames[][2] = {
{ "pause_mode", "process_mode" }, // Node
{ "physical_scancode", "physical_keycode" }, // InputEventKey
{ "popup_exclusive", "exclusive" }, // Window
+ { "proximity_fade_enable", "proximity_fade_enabled" }, // Material
{ "rect_position", "position" }, // Control
{ "rect_global_position", "global_position" }, // Control
{ "rect_size", "size" }, // Control
@@ -1123,9 +1143,12 @@ static const char *gdscript_properties_renames[][2] = {
{ "rect_clip_content", "clip_contents" }, // Control
{ "refuse_new_network_connections", "refuse_new_connections" }, // MultiplayerAPI
{ "region_filter_clip", "region_filter_clip_enabled" }, // Sprite2D
+ { "reverb_bus_enable", "reverb_bus_enabled" }, // Area3D
{ "selectedframe", "selected_frame" }, // Theme
{ "size_override_stretch", "size_2d_override_stretch" }, // SubViewport
{ "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D
+ { "smoothing_enabled", "follow_smoothing_enabled" }, // Camera2D
+ { "smoothing_speed", "position_smoothing_speed" }, // Camera2D
{ "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment
{ "ss_reflections_enabled", "ssr_enabled" }, // Environment
{ "ss_reflections_fade_in", "ssr_fade_in" }, // Environment
@@ -1177,6 +1200,7 @@ static const char *csharp_properties_renames[][2] = {
{ "CloseHOfs", "CloseHOffset" }, // Theme
{ "CloseVOfs", "CloseVOffset" }, // Theme
{ "Commentfocus", "CommentFocus" }, // Theme
+ { "DepthBiasEnable", "DepthBiasEnabled" }, // RDPipelineRasterizationState
{ "DragMarginBottom", "DragBottomMargin" }, // Camera2D
{ "DragMarginHEnabled", "DragHorizontalEnabled" }, // Camera2D
{ "DragMarginLeft", "DragLeftMargin" }, // Camera2D
@@ -1212,11 +1236,15 @@ static const char *csharp_properties_renames[][2] = {
{ "PauseMode", "ProcessMode" }, // Node
{ "PhysicalScancode", "PhysicalKeycode" }, // InputEventKey
{ "PopupExclusive", "Exclusive" }, // Window
+ { "ProximityFadeEnable", "ProximityFadeEnabled" }, // Material
{ "RefuseNewNetworkConnections", "RefuseNewConnections" }, // MultiplayerAPI
{ "RegionFilterClip", "RegionFilterClipEnabled" }, // Sprite2D
+ { "ReverbBusEnable", "ReverbBusEnabled" }, // Area3D
{ "Selectedframe", "SelectedFrame" }, // Theme
{ "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport
{ "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D
+ { "SmoothingEnabled", "FollowSmoothingEnabled" }, // Camera2D
+ { "SmoothingSpeed", "FollowSmoothingSpeed" }, // Camera2D
{ "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment
{ "SsReflectionsEnabled", "SsrEnabled" }, // Environment
{ "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 05015528c6..5a1eedd8a2 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -143,7 +143,11 @@ private:
install_status_rect->set_texture(new_icon);
}
- set_size(Size2(500, 0) * EDSCALE);
+ Size2i window_size = get_size();
+ Size2 contents_min_size = get_contents_minimum_size();
+ if (window_size.x < contents_min_size.x || window_size.y < contents_min_size.y) {
+ set_size(window_size.max(contents_min_size));
+ }
}
String _test_path() {
@@ -2594,6 +2598,12 @@ ProjectManager::ProjectManager() {
EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
+ int swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons");
+ if (swap_cancel_ok != 0) { // 0 is auto, set in register_scene based on DisplayServer.
+ // Swap on means OK first.
+ AcceptDialog::set_swap_cancel_ok(swap_cancel_ok == 2);
+ }
+
set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
set_theme(create_custom_theme());
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index acaa4ec3c9..ee358a8064 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2176,11 +2176,15 @@ void SceneTreeDock::_selection_changed() {
void SceneTreeDock::_do_create(Node *p_parent) {
Variant c = create_dialog->instance_selected();
-
- ERR_FAIL_COND(!c);
Node *child = Object::cast_to<Node>(c);
ERR_FAIL_COND(!child);
+ String new_name = p_parent->validate_child_name(child);
+ if (GLOBAL_GET("editor/node_naming/name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
+ new_name = adjust_name_casing(new_name);
+ }
+ child->set_name(new_name);
+
editor_data->get_undo_redo()->create_action_for_history(TTR("Create Node"), editor_data->get_current_edited_scene_history_id());
if (edited_scene) {
@@ -2191,7 +2195,6 @@ void SceneTreeDock::_do_create(Node *p_parent) {
editor_data->get_undo_redo()->add_do_reference(child);
editor_data->get_undo_redo()->add_undo_method(p_parent, "remove_child", child);
- String new_name = p_parent->validate_child_name(child);
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
editor_data->get_undo_redo()->add_do_method(ed, "live_debug_create_node", edited_scene->get_path_to(p_parent), child->get_class(), new_name);
editor_data->get_undo_redo()->add_undo_method(ed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(p_parent)).path_join(new_name)));