diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/connections_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/create_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 2 | ||||
-rw-r--r-- | editor/editor_command_palette.cpp | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 2 | ||||
-rw-r--r-- | editor/groups_editor.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.h | 8 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 59 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/tiles/tiles_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/quick_open.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 4 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 1 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 2 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 4 |
18 files changed, 79 insertions, 31 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index bda558bb72..5bea793da8 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -1009,7 +1009,7 @@ void ConnectionsDock::update_tree() { PackedStringArray argnames; String filter_text = search_box->get_text(); - if (!filter_text.is_subsequence_ofi(signal_name)) { + if (!filter_text.is_subsequence_ofn(signal_name)) { continue; } diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index d0dfbc7c11..3d55f45dd6 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -178,7 +178,7 @@ void CreateDialog::_update_search() { // Filter all candidate results. Vector<String> candidates; for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) { - if (empty_search || search_text.is_subsequence_ofi(I->get())) { + if (empty_search || search_text.is_subsequence_ofn(I->get())) { candidates.push_back(I->get()); } } diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 29d0014b8a..41f4db541d 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -186,7 +186,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Apply filters. while (parent) { const bool had_siblings = item->get_prev() || item->get_next(); - if (filter.is_subsequence_ofi(item->get_text(0))) { + if (filter.is_subsequence_ofn(item->get_text(0))) { break; // Filter matches, must survive. } parent->remove_child(item); diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index 1724e87489..d13d1a6c68 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -72,7 +72,7 @@ void EditorCommandPalette::_update_command_search(const String &search_text) { r.shortcut_text = commands[r.key_name].shortcut; r.last_used = commands[r.key_name].last_used; - if (search_text.is_subsequence_ofi(r.display_name)) { + if (search_text.is_subsequence_ofn(r.display_name)) { if (!search_text.is_empty()) { r.score = _score_path(search_text, r.display_name.to_lower()); } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index a3538d3381..d19032da8b 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2595,7 +2595,7 @@ void EditorInspector::update_tree() { // Ignore properties that do not fit the filter. if (use_filter && !filter.is_empty()) { - if (!filter.is_subsequence_ofi(path) && !filter.is_subsequence_ofi(property_label_string) && property_prefix.to_lower().find(filter.to_lower()) == -1) { + if (!filter.is_subsequence_ofn(path) && !filter.is_subsequence_ofn(property_label_string) && property_prefix.to_lower().find(filter.to_lower()) == -1) { continue; } } diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 15455b759b..1644bb9dbe 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -71,13 +71,13 @@ void GroupDialog::_load_nodes(Node *p_current) { TreeItem *node = nullptr; NodePath path = scene_tree->get_edited_scene_root()->get_path_to(p_current); if (keep && p_current->is_in_group(selected_group)) { - if (remove_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) { + if (remove_filter->get_text().is_subsequence_ofn(String(p_current->get_name()))) { node = nodes_to_remove->create_item(remove_node_root); keep = true; } else { keep = false; } - } else if (keep && add_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) { + } else if (keep && add_filter->get_text().is_subsequence_ofn(String(p_current->get_name()))) { node = nodes_to_add->create_item(add_node_root); keep = true; } else { diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 94990636da..26ce6de0df 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -854,10 +854,10 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() { } to.y = from.y; - float len = MAX(0.0001, current_length); + double len = MAX(0.0001, current_length); - float pos = CLAMP(play_pos, 0, len); - float c = pos / len; + double pos = CLAMP(play_pos, 0, len); + double c = pos / len; Color fg = get_theme_color(SNAME("font_color"), SNAME("Label")); Color bg = fg; bg.a *= 0.3; diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h index 8970e3e062..d948e05472 100644 --- a/editor/plugins/animation_state_machine_editor.h +++ b/editor/plugins/animation_state_machine_editor.h @@ -159,11 +159,11 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin { StringName last_blend_from_node; StringName last_current_node; Vector<StringName> last_travel_path; - float last_play_pos; - float play_pos; - float current_length; + double last_play_pos; + double play_pos; + double current_length; - float error_time; + double error_time; String error_text; EditorFileDialog *open_file; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 1aae82f66f..3f7fd29e27 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -882,10 +882,39 @@ void CanvasItemEditor::_selection_menu_hide() { } void CanvasItemEditor::_add_node_pressed(int p_result) { - if (p_result == AddNodeOption::ADD_NODE) { - SceneTreeDock::get_singleton()->open_add_child_dialog(); - } else if (p_result == AddNodeOption::ADD_INSTANCE) { - SceneTreeDock::get_singleton()->open_instance_child_dialog(); + List<Node *> nodes_to_move; + + switch (p_result) { + case ADD_NODE: { + SceneTreeDock::get_singleton()->open_add_child_dialog(); + } break; + case ADD_INSTANCE: { + SceneTreeDock::get_singleton()->open_instance_child_dialog(); + } break; + case ADD_PASTE: { + nodes_to_move = SceneTreeDock::get_singleton()->paste_nodes(); + [[fallthrough]]; + } + case ADD_MOVE: { + if (p_result == ADD_MOVE) { + nodes_to_move = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list(); + } + if (nodes_to_move.is_empty()) { + return; + } + + undo_redo->create_action(TTR("Move Node(s) to Position")); + for (Node *node : nodes_to_move) { + CanvasItem *ci = Object::cast_to<CanvasItem>(node); + if (ci) { + Transform2D xform = ci->get_global_transform_with_canvas().affine_inverse() * ci->get_transform(); + undo_redo->add_do_method(ci, "_edit_set_position", xform.xform(node_create_position)); + undo_redo->add_undo_method(ci, "_edit_set_position", ci->_edit_get_position()); + } + } + undo_redo->commit_action(); + _reset_create_position(); + } break; } } @@ -2194,10 +2223,26 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { } if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) { + add_node_menu->clear(); + add_node_menu->add_icon_item(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), TTR("Add Node Here"), ADD_NODE); + add_node_menu->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instantiate Scene Here"), ADD_INSTANCE); + for (Node *node : SceneTreeDock::get_singleton()->get_node_clipboard()) { + if (Object::cast_to<CanvasItem>(node)) { + add_node_menu->add_icon_item(get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")), TTR("Paste Node(s) Here"), ADD_PASTE); + break; + } + } + for (Node *node : EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()) { + if (Object::cast_to<CanvasItem>(node)) { + add_node_menu->add_icon_item(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")), TTR("Move Node(s) Here"), ADD_MOVE); + break; + } + } + add_node_menu->reset_size(); - add_node_menu->set_position(get_screen_transform().xform(get_local_mouse_position())); + add_node_menu->set_position(get_screen_transform().xform(b->get_position())); add_node_menu->popup(); - node_create_position = transform.affine_inverse().xform((get_local_mouse_position())); + node_create_position = transform.affine_inverse().xform(b->get_position()); return true; } @@ -5548,8 +5593,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { add_node_menu = memnew(PopupMenu); add_child(add_node_menu); - add_node_menu->add_icon_item(SceneTreeDock::get_singleton()->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), TTR("Add Node Here")); - add_node_menu->add_icon_item(SceneTreeDock::get_singleton()->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instance Scene Here")); add_node_menu->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_add_node_pressed)); multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), Key::KP_MULTIPLY); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 1e8fc0670d..9fa44bfb25 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -84,6 +84,8 @@ public: enum AddNodeOption { ADD_NODE, ADD_INSTANCE, + ADD_PASTE, + ADD_MOVE, }; private: diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2fc4cda861..f307bbd9c6 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1878,7 +1878,7 @@ void ScriptEditor::_update_members_overview() { for (int i = 0; i < functions.size(); i++) { String filter = filter_methods->get_text(); String name = functions[i].get_slice(":", 0); - if (filter.is_empty() || filter.is_subsequence_ofi(name)) { + if (filter.is_empty() || filter.is_subsequence_ofn(name)) { members_overview->add_item(name); members_overview->set_item_metadata(members_overview->get_item_count() - 1, functions[i].get_slice(":", 1).to_int() - 1); } @@ -2128,7 +2128,7 @@ void ScriptEditor::_update_script_names() { Vector<_ScriptEditorItemData> sedata_filtered; for (int i = 0; i < sedata.size(); i++) { String filter = filter_scripts->get_text(); - if (filter.is_empty() || filter.is_subsequence_ofi(sedata[i].name)) { + if (filter.is_empty() || filter.is_subsequence_ofn(sedata[i].name)) { sedata_filtered.push_back(sedata[i]); } } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index f95b2b40b5..611f81db33 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -2076,7 +2076,7 @@ void ThemeTypeDialog::_update_add_type_options(const String &p_filter) { Vector<StringName> unique_names; for (const StringName &E : names) { // Filter out undesired values. - if (!p_filter.is_subsequence_ofi(String(E))) { + if (!p_filter.is_subsequence_ofn(String(E))) { continue; } diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 1aafab4713..4c644f33d4 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -166,8 +166,6 @@ void TilesEditorPlugin::_update_editors() { editor_node->hide_bottom_panel(); } } - tileset_editor_button->set_visible(tile_set.is_valid()); - tilemap_editor_button->set_visible(tile_map); } void TilesEditorPlugin::_notification(int p_what) { diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index 118c016c6d..2a8ca67fe6 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -84,7 +84,7 @@ void EditorQuickOpen::_update_search() { // Filter possible candidates. Vector<Entry> entries; for (int i = 0; i < files.size(); i++) { - if (empty_search || search_text.is_subsequence_ofi(files[i])) { + if (empty_search || search_text.is_subsequence_ofn(files[i])) { Entry r; r.path = files[i]; r.score = empty_search ? 0 : _score_path(search_text, files[i].to_lower()); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 125fcc02dc..cece787bf3 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -3060,6 +3060,10 @@ List<Node *> SceneTreeDock::paste_nodes() { return pasted_nodes; } +List<Node *> SceneTreeDock::get_node_clipboard() const { + return node_clipboard; +} + void SceneTreeDock::add_remote_tree_editor(Control *p_remote) { ERR_FAIL_COND(remote_tree != nullptr); add_child(p_remote); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index d73038ef36..3639e66233 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -315,6 +315,7 @@ public: void open_instance_child_dialog(); List<Node *> paste_nodes(); + List<Node *> get_node_clipboard() const; ScriptCreateDialog *get_script_create_dialog() { return script_create_dialog; } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 4a36462d65..c755bca64f 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -411,7 +411,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll item->set_as_cursor(0); } - bool keep = (filter.is_subsequence_ofi(String(p_node->get_name()))); + bool keep = (filter.is_subsequence_ofn(String(p_node->get_name()))); for (int i = 0; i < p_node->get_child_count(); i++) { bool child_keep = _add_nodes(p_node->get_child(i), item, p_scroll_to_selected); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 71edeefd10..c4d361bd49 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -379,7 +379,7 @@ void EditorSettingsDialog::_update_shortcuts() { // Join the text of the events with a delimiter so they can all be displayed in one cell. String events_display_string = event_strings.is_empty() ? "None" : String("; ").join(event_strings); - if (!shortcut_filter.is_subsequence_ofi(action_name) && (events_display_string == "None" || !shortcut_filter.is_subsequence_ofi(events_display_string))) { + if (!shortcut_filter.is_subsequence_ofn(action_name) && (events_display_string == "None" || !shortcut_filter.is_subsequence_ofn(events_display_string))) { continue; } @@ -428,7 +428,7 @@ void EditorSettingsDialog::_update_shortcuts() { // Shortcut Item - if (!shortcut_filter.is_subsequence_ofi(sc->get_name())) { + if (!shortcut_filter.is_subsequence_ofn(sc->get_name())) { continue; } |