summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp78
1 files changed, 25 insertions, 53 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 665255b9b2..95b3c30d1b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -94,7 +94,7 @@
#include "editor/editor_paths.h"
#include "editor/editor_properties.h"
#include "editor/editor_property_name_processor.h"
-#include "editor/editor_quick_open.h"
+#include "editor/editor_resource_picker.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
#include "editor/editor_run_native.h"
@@ -109,6 +109,7 @@
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_file_dialog.h"
+#include "editor/gui/editor_quick_open_dialog.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/gui/editor_scene_tabs.h"
#include "editor/gui/editor_title_bar.h"
@@ -1982,7 +1983,7 @@ void EditorNode::try_autosave() {
editor_data.save_editor_external_data();
}
-void EditorNode::restart_editor() {
+void EditorNode::restart_editor(bool p_goto_project_manager) {
exiting = true;
if (project_run_bar->is_playing()) {
@@ -1990,22 +1991,25 @@ void EditorNode::restart_editor() {
}
String to_reopen;
- if (get_tree()->get_edited_scene_root()) {
+ if (!p_goto_project_manager && get_tree()->get_edited_scene_root()) {
to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path();
}
_exit_editor(EXIT_SUCCESS);
List<String> args;
-
for (const String &a : Main::get_forwardable_cli_arguments(Main::CLI_SCOPE_TOOL)) {
args.push_back(a);
}
- args.push_back("--path");
- args.push_back(ProjectSettings::get_singleton()->get_resource_path());
+ if (p_goto_project_manager) {
+ args.push_back("--project-manager");
+ } else {
+ args.push_back("--path");
+ args.push_back(ProjectSettings::get_singleton()->get_resource_path());
- args.push_back("-e");
+ args.push_back("-e");
+ }
if (!to_reopen.is_empty()) {
args.push_back(to_reopen);
@@ -2386,7 +2390,7 @@ void EditorNode::hide_unused_editors(const Object *p_editing_owner) {
// This is to sweep properties that were removed from the inspector.
List<ObjectID> to_remove;
for (KeyValue<ObjectID, HashSet<EditorPlugin *>> &kv : active_plugins) {
- const Object *context = ObjectDB::get_instance(kv.key);
+ Object *context = ObjectDB::get_instance(kv.key);
if (context) {
// In case of self-owning plugins, they are disabled here if they can auto hide.
const EditorPlugin *self_owning = Object::cast_to<EditorPlugin>(context);
@@ -2395,7 +2399,7 @@ void EditorNode::hide_unused_editors(const Object *p_editing_owner) {
}
}
- if (!context) {
+ if (!context || context->call(SNAME("_should_stop_editing"))) {
to_remove.push_back(kv.key);
for (EditorPlugin *plugin : kv.value) {
if (plugin->can_auto_hide()) {
@@ -2669,19 +2673,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_QUICK_OPEN: {
- quick_open->popup_dialog("Resource", true);
- quick_open->set_title(TTR("Quick Open..."));
-
+ quick_open_dialog->popup_dialog({ "Resource" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_QUICK_OPEN_SCENE: {
- quick_open->popup_dialog("PackedScene", true);
- quick_open->set_title(TTR("Quick Open Scene..."));
-
+ quick_open_dialog->popup_dialog({ "PackedScene" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_QUICK_OPEN_SCRIPT: {
- quick_open->popup_dialog("Script", true);
- quick_open->set_title(TTR("Quick Open Script..."));
-
+ quick_open_dialog->popup_dialog({ "Script" }, callable_mp(this, &EditorNode::_quick_opened));
} break;
case FILE_OPEN_PREV: {
if (previous_scenes.is_empty()) {
@@ -3407,23 +3405,7 @@ void EditorNode::_discard_changes(const String &p_str) {
} break;
case RUN_PROJECT_MANAGER: {
- project_run_bar->stop_playing();
- _exit_editor(EXIT_SUCCESS);
- String exec = OS::get_singleton()->get_executable_path();
-
- List<String> args;
- for (const String &a : Main::get_forwardable_cli_arguments(Main::CLI_SCOPE_TOOL)) {
- args.push_back(a);
- }
-
- String exec_base_dir = exec.get_base_dir();
- if (!exec_base_dir.is_empty()) {
- args.push_back("--path");
- args.push_back(exec_base_dir);
- }
- args.push_back("--project-manager");
-
- OS::get_singleton()->set_restart_on_exit(true, args);
+ restart_editor(true);
} break;
case RELOAD_CURRENT_PROJECT: {
restart_editor();
@@ -4599,17 +4581,11 @@ void EditorNode::_update_recent_scenes() {
recent_scenes->reset_size();
}
-void EditorNode::_quick_opened() {
- Vector<String> files = quick_open->get_selected_files();
-
- bool open_scene_dialog = quick_open->get_base_type() == "PackedScene";
- for (int i = 0; i < files.size(); i++) {
- const String &res_path = files[i];
- if (open_scene_dialog || ClassDB::is_parent_class(ResourceLoader::get_resource_type(res_path), "PackedScene")) {
- open_request(res_path);
- } else {
- load_resource(res_path);
- }
+void EditorNode::_quick_opened(const String &p_file_path) {
+ if (ClassDB::is_parent_class(ResourceLoader::get_resource_type(p_file_path), "PackedScene")) {
+ open_request(p_file_path);
+ } else {
+ load_resource(p_file_path);
}
}
@@ -6761,10 +6737,6 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | Key::G);
ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::G);
- // Used in the GPUParticles/CPUParticles 2D/3D editor plugins.
- // The shortcut is Ctrl + R even on macOS, as Cmd + R is used to run the current scene on macOS.
- ED_SHORTCUT("particles/restart_emission", TTR("Restart Emission"), KeyModifierMask::CTRL | Key::R);
-
FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename"));
_update_vsync_mode();
@@ -7722,6 +7694,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(AnimationPlayerEditorPlugin));
add_editor_plugin(memnew(AnimationTrackKeyEditEditorPlugin));
+ add_editor_plugin(memnew(AnimationMarkerKeyEditEditorPlugin));
add_editor_plugin(memnew(CanvasItemEditorPlugin));
add_editor_plugin(memnew(Node3DEditorPlugin));
add_editor_plugin(memnew(ScriptEditorPlugin));
@@ -7847,9 +7820,8 @@ EditorNode::EditorNode() {
open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
gui_base->add_child(open_imported);
- quick_open = memnew(EditorQuickOpen);
- gui_base->add_child(quick_open);
- quick_open->connect("quick_open", callable_mp(this, &EditorNode::_quick_opened));
+ quick_open_dialog = memnew(EditorQuickOpenDialog);
+ gui_base->add_child(quick_open_dialog);
_update_recent_scenes();