diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 97 | ||||
-rw-r--r-- | editor/code_editor.h | 2 | ||||
-rw-r--r-- | editor/connections_dialog.cpp | 72 | ||||
-rw-r--r-- | editor/connections_dialog.h | 1 | ||||
-rw-r--r-- | editor/debugger/debug_adapter/debug_adapter_protocol.cpp | 2 | ||||
-rw-r--r-- | editor/editor_build_profile.cpp | 3 | ||||
-rw-r--r-- | editor/editor_node.cpp | 9 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 3 | ||||
-rw-r--r-- | editor/groups_editor.cpp | 144 | ||||
-rw-r--r-- | editor/groups_editor.h | 11 | ||||
-rw-r--r-- | editor/icons/BoneMapHumanBody.svg | 27 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 16 | ||||
-rw-r--r-- | editor/project_manager.cpp | 6 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 9 |
15 files changed, 286 insertions, 119 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..2105a101d8 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -160,6 +160,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 +208,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 +413,7 @@ void ConnectDialog::popup_dialog(const String &p_for_signal) { first_popup = false; _advanced_pressed(); } + popup_centered(); } @@ -743,43 +786,17 @@ bool ConnectionsDock::_is_item_signal(TreeItem &p_item) { 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")); @@ -1187,6 +1204,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..16a60306aa 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; 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/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_node.cpp b/editor/editor_node.cpp index 7aca8fde6f..460dc7e3bb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6181,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); 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/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/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 7a21397910..70489f0841 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); diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index e702ba7020..1a2c670aef 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 @@ -358,6 +359,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 @@ -495,6 +497,7 @@ 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_enabled_focus_mode", "set_focus_mode" }, // BaseButton @@ -525,9 +528,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,6 +746,7 @@ 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 @@ -794,6 +800,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 @@ -925,6 +932,7 @@ static const char *csharp_function_renames[][2] = { { "SetCullMaskBit", "SetCullMaskValue" }, // Camera3D { "SetCursorPosition", "SetCaretColumn" }, // LineEdit { "SetD", "SetDistance" }, // WorldMarginShape2D + { "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState { "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton { "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton { "SetEndianSwap", "SetBigEndian" }, // File @@ -951,9 +959,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 +1081,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 +1124,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,6 +1135,7 @@ 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 @@ -1177,6 +1190,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,8 +1226,10 @@ 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 diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 05015528c6..c6fcdc890c 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2594,6 +2594,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))); |