diff options
Diffstat (limited to 'editor')
44 files changed, 562 insertions, 292 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 1d13972458..5c4ef35f1c 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -6458,6 +6458,7 @@ void AnimationTrackEditor::_select_all_tracks_for_copy() { void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_animation_update", &AnimationTrackEditor::_animation_update); ClassDB::bind_method("_track_grab_focus", &AnimationTrackEditor::_track_grab_focus); + ClassDB::bind_method("_redraw_tracks", &AnimationTrackEditor::_redraw_tracks); ClassDB::bind_method("_clear_selection_for_anim", &AnimationTrackEditor::_clear_selection_for_anim); ClassDB::bind_method("_select_at_anim", &AnimationTrackEditor::_select_at_anim); ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection); 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/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/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_command_palette.h b/editor/editor_command_palette.h index b3e84771d0..15200552b4 100644 --- a/editor/editor_command_palette.h +++ b/editor/editor_command_palette.h @@ -66,7 +66,11 @@ class EditorCommandPalette : public ConfirmationDialog { struct CommandHistoryComparator { _FORCE_INLINE_ bool operator()(const CommandEntry &A, const CommandEntry &B) const { - return A.last_used > B.last_used; + if (A.last_used == B.last_used) { + return A.display_name < B.display_name; + } else { + return A.last_used > B.last_used; + } } }; 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 f83ff598c5..bf50efc4f9 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() { @@ -4678,8 +4682,7 @@ void EditorNode::_dock_move_left() { if (!current_ctl || !prev_ctl) { return; } - dock_slot[dock_popup_selected_idx]->move_child(current_ctl, prev_ctl->get_index()); - dock_slot[dock_popup_selected_idx]->set_current_tab(dock_slot[dock_popup_selected_idx]->get_current_tab() - 1); + dock_slot[dock_popup_selected_idx]->move_child(current_ctl, prev_ctl->get_index(false)); dock_select->queue_redraw(); _edit_current(); _save_docks(); @@ -4691,8 +4694,7 @@ void EditorNode::_dock_move_right() { if (!current_ctl || !next_ctl) { return; } - dock_slot[dock_popup_selected_idx]->move_child(next_ctl, current_ctl->get_index()); - dock_slot[dock_popup_selected_idx]->set_current_tab(dock_slot[dock_popup_selected_idx]->get_current_tab() + 1); + dock_slot[dock_popup_selected_idx]->move_child(next_ctl, current_ctl->get_index(false)); dock_select->queue_redraw(); _edit_current(); _save_docks(); @@ -5907,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"))); } } @@ -6179,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); @@ -7562,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 0ea1bb72df..155802d16c 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -37,6 +37,7 @@ #include "editor/editor_resource_preview.h" #include "editor/editor_scale.h" #include "editor/filesystem_dock.h" +#include "editor/project_settings_editor.h" #include "scene/2d/gpu_particles_2d.h" #include "scene/3d/fog_volume.h" #include "scene/3d/gpu_particles_3d.h" @@ -1252,26 +1253,41 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) { } void EditorPropertyLayers::set_layer_name(int p_index, const String &p_name) { - if (ProjectSettings::get_singleton()->has_setting(basename + vformat("/layer_%d", p_index + 1))) { - ProjectSettings::get_singleton()->set(basename + vformat("/layer_%d", p_index + 1), p_name); + const String property_name = basename + vformat("/layer_%d", p_index + 1); + if (ProjectSettings::get_singleton()->has_setting(property_name)) { + ProjectSettings::get_singleton()->set(property_name, p_name); ProjectSettings::get_singleton()->save(); } } +String EditorPropertyLayers::get_layer_name(int p_index) const { + const String property_name = basename + vformat("/layer_%d", p_index + 1); + if (ProjectSettings::get_singleton()->has_setting(property_name)) { + return ProjectSettings::get_singleton()->get(property_name); + } + return String(); +} + void EditorPropertyLayers::_button_pressed() { int layer_count = grid->layer_count; - int layer_group_size = grid->layer_group_size; - layers->clear(); for (int i = 0; i < layer_count; i++) { - if ((i != 0) && ((i % layer_group_size) == 0)) { - layers->add_separator(); + const String name = get_layer_name(i); + if (name.is_empty()) { + continue; } - layers->add_check_item(grid->names[i], i); + layers->add_check_item(name, i); int idx = layers->get_item_index(i); layers->set_item_checked(idx, grid->value & (1 << i)); } + if (layers->get_item_count() == 0) { + layers->add_item(TTR("No Named Layers")); + layers->set_item_disabled(0, true); + } + layers->add_separator(); + layers->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit Layer Names"), grid->layer_count); + Rect2 gp = button->get_screen_rect(); layers->reset_size(); Vector2 popup_pos = gp.position - Vector2(layers->get_contents_minimum_size().x, 0); @@ -1280,14 +1296,19 @@ void EditorPropertyLayers::_button_pressed() { } void EditorPropertyLayers::_menu_pressed(int p_menu) { - if (grid->value & (1 << p_menu)) { - grid->value &= ~(1 << p_menu); + if (p_menu == grid->layer_count) { + ProjectSettingsEditor::get_singleton()->popup_project_settings(); + ProjectSettingsEditor::get_singleton()->set_general_page(basename); } else { - grid->value |= (1 << p_menu); + if (grid->value & (1 << p_menu)) { + grid->value &= ~(1 << p_menu); + } else { + grid->value |= (1 << p_menu); + } + grid->queue_redraw(); + layers->set_item_checked(layers->get_item_index(p_menu), grid->value & (1 << p_menu)); + _grid_changed(grid->value); } - grid->queue_redraw(); - layers->set_item_checked(layers->get_item_index(p_menu), grid->value & (1 << p_menu)); - _grid_changed(grid->value); } void EditorPropertyLayers::_refresh_names() { diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 9ad4c02111..20b130f57f 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -357,6 +357,7 @@ protected: public: void setup(LayerType p_layer_type); void set_layer_name(int p_index, const String &p_name); + String get_layer_name(int p_index) const; virtual void update_property() override; EditorPropertyLayers(); }; diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index 94f4fec89a..ae47bbe864 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -151,7 +151,9 @@ void SectionedInspector::_section_selected() { void SectionedInspector::set_current_section(const String &p_section) { if (section_map.has(p_section)) { - section_map[p_section]->select(0); + TreeItem *item = section_map[p_section]; + item->select(0); + sections->scroll_to_item(item); } } 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_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/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/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 673ad1cb21..d37f2aab43 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2994,7 +2994,7 @@ void FileSystemDock::_bind_methods() { ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file"))); ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder"))); ADD_SIGNAL(MethodInfo("files_moved", PropertyInfo(Variant::STRING, "old_file"), PropertyInfo(Variant::STRING, "new_file"))); - ADD_SIGNAL(MethodInfo("folder_moved", PropertyInfo(Variant::STRING, "old_folder"), PropertyInfo(Variant::STRING, "new_file"))); + ADD_SIGNAL(MethodInfo("folder_moved", PropertyInfo(Variant::STRING, "old_folder"), PropertyInfo(Variant::STRING, "new_folder"))); ADD_SIGNAL(MethodInfo("display_mode_changed")); } 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/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/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index dc84c08506..a48990779b 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -302,6 +302,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 +722,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 +995,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 +1173,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 +1571,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 +1579,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..c59781390a 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)); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 4430877b8a..4d3ffdc12b 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); @@ -4773,10 +4776,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); 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..dd16d4ffea 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -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() { diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 68bc4389a2..364c3b7246 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -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 2e28367817..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 @@ -379,6 +382,7 @@ static const char *gdscript_function_renames[][2] = { { "get_theme_item_types", "get_theme_item_type_list" }, // Theme { "get_timer_process_mode", "get_timer_process_callback" }, // Timer { "get_translation", "get_position" }, // Node3D broke GLTFNode which is used rarely + { "get_unit_db", "get_volume_db" }, // AudioStreamPlayer3D { "get_unit_offset", "get_progress_ratio" }, // PathFollow2D, PathFollow3D { "get_use_in_baked_light", "is_baking_navigation" }, // GridMap { "get_used_cells_by_id", "get_used_cells" }, // TileMap @@ -416,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 @@ -494,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 @@ -524,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 @@ -544,6 +554,7 @@ static const char *gdscript_function_renames[][2] = { { "set_text_align", "set_text_alignment" }, // Button { "set_timer_process_mode", "set_timer_process_callback" }, // Timer { "set_translation", "set_position" }, // Node3D - this broke GLTFNode which is used rarely + { "set_unit_db", "set_volume_db" }, // AudioStreamPlayer3D { "set_unit_offset", "set_progress_ratio" }, // PathFollow2D, PathFollow3D { "set_uv2", "surface_set_uv2" }, // ImmediateMesh broke Surffacetool { "set_v_drag_enabled", "set_drag_vertical_enabled" }, // Camera2D @@ -739,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 @@ -792,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 @@ -812,6 +826,7 @@ static const char *csharp_function_renames[][2] = { { "GetThemeItemTypes", "GetThemeItemTypeList" }, // Theme { "GetTimerProcessMode", "GetTimerProcessCallback" }, // Timer { "GetTranslation", "GetPosition" }, // Node3D broke GLTFNode which is used rarely + { "GetUnitDb", "GetVolumeDb" }, // AudioStreamPlayer3D { "GetUnitOffset", "GetProgressRatio" }, // PathFollow2D, PathFollow3D { "GetUseInBakedLight", "IsBakingNavigation" }, // GridMap { "GetUsedCellsById", "GetUsedCells" }, // TileMap @@ -848,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 @@ -922,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 @@ -948,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 @@ -969,6 +990,7 @@ static const char *csharp_function_renames[][2] = { { "SetTimerProcessMode", "SetTimerProcessCallback" }, // Timer { "SetTonemapAutoExposure", "SetTonemapAutoExposureEnabled" }, // Environment { "SetTranslation", "SetPosition" }, // Node3D - this broke GLTFNode which is used rarely + { "SetUnitDb", "SetVolumeDb" }, // AudioStreamPlayer3D { "SetUnitOffset", "SetProgressRatio" }, // PathFollow2D, PathFollow3D { "SetUv2", "SurfaceSetUv2" }, // ImmediateMesh broke Surffacetool { "SetVDragEnabled", "SetDragVerticalEnabled" }, // Camera2D @@ -1067,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 @@ -1109,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 @@ -1119,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 @@ -1133,6 +1160,7 @@ static const char *gdscript_properties_renames[][2] = { { "table_hseparation", "table_h_separation" }, // Theme { "table_vseparation", "table_v_separation" }, // Theme { "translation", "position" }, // Node3D - broke GLTFNode + { "unit_db", "volume_db" }, // AudioStreamPlayer3D { "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D { "vseparation", "v_separation" }, // Theme @@ -1172,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 @@ -1207,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 @@ -1223,6 +1256,7 @@ static const char *csharp_properties_renames[][2] = { { "TableHseparation", "TableHSeparation" }, // Theme { "TableVseparation", "TableVSeparation" }, // Theme { "Translation", "Position" }, // Node3D - broke GLTFNode + { "UnitDb", "VolumeDb" }, // AudioStreamPlayer3D { "UnitOffset", "ProgressRatio" }, // PathFollow2D, PathFollow3D { "Vseparation", "VSeparation" }, // Theme 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/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 0f91760a84..8175f356c7 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -73,6 +73,11 @@ void ProjectSettingsEditor::set_plugins_page() { tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings)); } +void ProjectSettingsEditor::set_general_page(const String &p_category) { + tab_container->set_current_tab(tab_container->get_tab_idx_from_control(general_editor)); + general_settings_inspector->set_current_section(p_category); +} + void ProjectSettingsEditor::update_plugins() { plugin_settings->update_plugins(); } @@ -576,7 +581,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { tab_container->set_theme_type_variation("TabContainerOdd"); add_child(tab_container); - VBoxContainer *general_editor = memnew(VBoxContainer); + general_editor = memnew(VBoxContainer); general_editor->set_name(TTR("General")); general_editor->set_alignment(BoxContainer::ALIGNMENT_BEGIN); general_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h index 040d992e40..ec10c76cb7 100644 --- a/editor/project_settings_editor.h +++ b/editor/project_settings_editor.h @@ -53,6 +53,7 @@ class ProjectSettingsEditor : public AcceptDialog { Timer *timer = nullptr; TabContainer *tab_container = nullptr; + VBoxContainer *general_editor = nullptr; SectionedInspector *general_settings_inspector = nullptr; ActionMapEditor *action_map_editor = nullptr; LocalizationEditor *localization_editor = nullptr; @@ -116,6 +117,7 @@ public: static ProjectSettingsEditor *get_singleton() { return singleton; } void popup_project_settings(); void set_plugins_page(); + void set_general_page(const String &p_category); void update_plugins(); EditorAutoloadSettings *get_autoload_settings() { return autoload_settings; } 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))); |