summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp118
1 files changed, 75 insertions, 43 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b962ea6e3e..f09a6f678a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -31,7 +31,6 @@
#include "editor_node.h"
#include "core/config/project_settings.h"
-#include "core/core_bind.h"
#include "core/extension/native_extension_manager.h"
#include "core/input/input.h"
#include "core/io/config_file.h"
@@ -137,6 +136,7 @@
#include "editor/plugins/gpu_particles_3d_editor_plugin.h"
#include "editor/plugins/gpu_particles_collision_sdf_editor_plugin.h"
#include "editor/plugins/gradient_editor_plugin.h"
+#include "editor/plugins/input_event_editor_plugin.h"
#include "editor/plugins/item_list_editor_plugin.h"
#include "editor/plugins/light_occluder_2d_editor_plugin.h"
#include "editor/plugins/lightmap_gi_editor_plugin.h"
@@ -167,6 +167,7 @@
#include "editor/plugins/sprite_2d_editor_plugin.h"
#include "editor/plugins/sprite_frames_editor_plugin.h"
#include "editor/plugins/style_box_editor_plugin.h"
+#include "editor/plugins/sub_viewport_preview_editor_plugin.h"
#include "editor/plugins/text_editor.h"
#include "editor/plugins/texture_3d_editor_plugin.h"
#include "editor/plugins/texture_editor_plugin.h"
@@ -591,8 +592,7 @@ void EditorNode::_notification(int p_what) {
_initializing_addons = false;
}
- RenderingServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true);
- RenderingServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true);
+ RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true);
RenderingServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
feature_profile_manager->notify_changed();
@@ -709,6 +709,7 @@ void EditorNode::_notification(int p_what) {
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_REPORT_A_BUG), gui_base->get_theme_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_SUGGEST_A_FEATURE), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_SEND_DOCS_FEEDBACK), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons"));
@@ -2712,7 +2713,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
save_confirmation->get_ok_button()->set_text(TTR("Save & Quit"));
- save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes the following scene(s) before opening Project Manager?")) + unsaved_scenes);
+ save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes to the following scene(s) before opening Project Manager?")) + unsaved_scenes);
save_confirmation->popup_centered();
}
}
@@ -2796,6 +2797,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case HELP_REPORT_A_BUG: {
OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues");
} break;
+ case HELP_SUGGEST_A_FEATURE: {
+ OS::get_singleton()->shell_open("https://github.com/godotengine/godot-proposals#readme");
+ } break;
case HELP_SEND_DOCS_FEEDBACK: {
OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues");
} break;
@@ -3732,46 +3736,46 @@ void EditorNode::register_editor_types() {
ResourceLoader::set_timestamp_on_load(true);
ResourceSaver::set_timestamp_on_save(true);
- ClassDB::register_class<EditorPaths>();
- ClassDB::register_class<EditorPlugin>();
- ClassDB::register_class<EditorTranslationParserPlugin>();
- ClassDB::register_class<EditorImportPlugin>();
- ClassDB::register_class<EditorScript>();
- ClassDB::register_class<EditorSelection>();
- ClassDB::register_class<EditorFileDialog>();
- ClassDB::register_virtual_class<EditorSettings>();
- ClassDB::register_class<EditorNode3DGizmo>();
- ClassDB::register_class<EditorNode3DGizmoPlugin>();
- ClassDB::register_virtual_class<EditorResourcePreview>();
- ClassDB::register_class<EditorResourcePreviewGenerator>();
- ClassDB::register_virtual_class<EditorFileSystem>();
- ClassDB::register_class<EditorFileSystemDirectory>();
- ClassDB::register_class<EditorVCSInterface>();
- ClassDB::register_virtual_class<ScriptEditor>();
- ClassDB::register_virtual_class<ScriptEditorBase>();
- ClassDB::register_class<EditorSyntaxHighlighter>();
- ClassDB::register_virtual_class<EditorInterface>();
- ClassDB::register_class<EditorExportPlugin>();
- ClassDB::register_class<EditorResourceConversionPlugin>();
- ClassDB::register_class<EditorSceneImporter>();
- ClassDB::register_class<EditorInspector>();
- ClassDB::register_class<EditorInspectorPlugin>();
- ClassDB::register_class<EditorProperty>();
- ClassDB::register_class<AnimationTrackEditPlugin>();
- ClassDB::register_class<ScriptCreateDialog>();
- ClassDB::register_class<EditorFeatureProfile>();
- ClassDB::register_class<EditorSpinSlider>();
- ClassDB::register_class<EditorResourcePicker>();
- ClassDB::register_class<EditorScriptPicker>();
- ClassDB::register_class<EditorSceneImporterMesh>();
- ClassDB::register_class<EditorSceneImporterMeshNode3D>();
-
- ClassDB::register_virtual_class<FileSystemDock>();
+ GDREGISTER_CLASS(EditorPaths);
+ GDREGISTER_CLASS(EditorPlugin);
+ GDREGISTER_CLASS(EditorTranslationParserPlugin);
+ GDREGISTER_CLASS(EditorImportPlugin);
+ GDREGISTER_CLASS(EditorScript);
+ GDREGISTER_CLASS(EditorSelection);
+ GDREGISTER_CLASS(EditorFileDialog);
+ GDREGISTER_VIRTUAL_CLASS(EditorSettings);
+ GDREGISTER_CLASS(EditorNode3DGizmo);
+ GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
+ GDREGISTER_VIRTUAL_CLASS(EditorResourcePreview);
+ GDREGISTER_CLASS(EditorResourcePreviewGenerator);
+ GDREGISTER_VIRTUAL_CLASS(EditorFileSystem);
+ GDREGISTER_CLASS(EditorFileSystemDirectory);
+ GDREGISTER_CLASS(EditorVCSInterface);
+ GDREGISTER_VIRTUAL_CLASS(ScriptEditor);
+ GDREGISTER_VIRTUAL_CLASS(ScriptEditorBase);
+ GDREGISTER_CLASS(EditorSyntaxHighlighter);
+ GDREGISTER_VIRTUAL_CLASS(EditorInterface);
+ GDREGISTER_CLASS(EditorExportPlugin);
+ GDREGISTER_CLASS(EditorResourceConversionPlugin);
+ GDREGISTER_CLASS(EditorSceneImporter);
+ GDREGISTER_CLASS(EditorInspector);
+ GDREGISTER_CLASS(EditorInspectorPlugin);
+ GDREGISTER_CLASS(EditorProperty);
+ GDREGISTER_CLASS(AnimationTrackEditPlugin);
+ GDREGISTER_CLASS(ScriptCreateDialog);
+ GDREGISTER_CLASS(EditorFeatureProfile);
+ GDREGISTER_CLASS(EditorSpinSlider);
+ GDREGISTER_CLASS(EditorResourcePicker);
+ GDREGISTER_CLASS(EditorScriptPicker);
+ GDREGISTER_CLASS(EditorSceneImporterMesh);
+ GDREGISTER_CLASS(EditorSceneImporterMeshNode3D);
+
+ GDREGISTER_VIRTUAL_CLASS(FileSystemDock);
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
- ClassDB::register_class<EditorScenePostImport>();
+ GDREGISTER_CLASS(EditorScenePostImport);
//ClassDB::register_type<EditorImportExport>();
- ClassDB::register_class<EditorDebuggerPlugin>();
+ GDREGISTER_CLASS(EditorDebuggerPlugin);
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_EDITOR);
}
@@ -3871,6 +3875,21 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons
return nullptr;
}
+void EditorNode::_pick_main_scene_custom_action(const String &p_custom_action_name) {
+ if (p_custom_action_name == "select_current") {
+ Node *scene = editor_data.get_edited_scene_root();
+
+ if (!scene) {
+ show_accept(TTR("There is no defined scene to run."), TTR("OK"));
+ return;
+ }
+
+ pick_main_scene->hide();
+ current_option = SETTINGS_PICK_MAIN_SCENE;
+ _dialog_action(scene->get_filename());
+ }
+}
+
Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const {
ERR_FAIL_COND_V(!p_object || !gui_base, nullptr);
@@ -4665,6 +4684,14 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
current_option = -1;
pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category."));
pick_main_scene->popup_centered();
+
+ if (editor_data.get_edited_scene_root()) {
+ select_current_scene_button->set_disabled(false);
+ select_current_scene_button->grab_focus();
+ } else {
+ select_current_scene_button->set_disabled(true);
+ }
+
return false;
}
@@ -6112,9 +6139,9 @@ EditorNode::EditorNode() {
scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL);
scene_root = memnew(SubViewport);
- //scene_root->set_usage(Viewport::USAGE_2D); canvas BG mode prevents usage of this as 2D
+ scene_root->set_embed_subwindows_hint(true);
+ scene_root->set_disable_3d(true);
- RenderingServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true);
scene_root->set_disable_input(true);
scene_root->set_as_audio_listener_2d(true);
@@ -6361,6 +6388,7 @@ EditorNode::EditorNode() {
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Questions & Answers")), HELP_QA);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/report_a_bug", TTR("Report a Bug")), HELP_REPORT_A_BUG);
+ p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/suggest_a_feature", TTR("Suggest a Feature")), HELP_SUGGEST_A_FEATURE);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/send_docs_feedback", TTR("Send Docs Feedback")), HELP_SEND_DOCS_FEEDBACK);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY);
p->add_separator();
@@ -6812,6 +6840,8 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(MeshEditorPlugin(this)));
add_editor_plugin(memnew(MaterialEditorPlugin(this)));
add_editor_plugin(memnew(GPUParticlesCollisionSDFEditorPlugin(this)));
+ add_editor_plugin(memnew(InputEventEditorPlugin(this)));
+ add_editor_plugin(memnew(SubViewportPreviewEditorPlugin(this)));
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++) {
add_editor_plugin(EditorPlugins::create(i, this));
@@ -6940,6 +6970,8 @@ EditorNode::EditorNode() {
gui_base->add_child(pick_main_scene);
pick_main_scene->get_ok_button()->set_text(TTR("Select"));
pick_main_scene->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_PICK_MAIN_SCENE));
+ select_current_scene_button = pick_main_scene->add_button(TTR("Select Current"), true, "select_current");
+ pick_main_scene->connect("custom_action", callable_mp(this, &EditorNode::_pick_main_scene_custom_action));
for (int i = 0; i < _init_callbacks.size(); i++) {
_init_callbacks[i]();