Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Add play scene option to file system context menu

DexterFstoneaec303177907
diff --git a/editor/docks/filesystem_dock.cpp b/editor/docks/filesystem_dock.cpp
index 0374f8892d7..3f5e6c7e450 100644
--- a/editor/docks/filesystem_dock.cpp
+++ b/editor/docks/filesystem_dock.cpp
@@ -51,6 +51,7 @@
#include "editor/inspector/editor_resource_preview.h"
#include "editor/inspector/editor_resource_tooltip_plugins.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
+#include "editor/run/editor_run_bar.h"
#include "editor/scene/editor_scene_tabs.h"
#include "editor/scene/scene_create_dialog.h"
#include "editor/settings/editor_command_palette.h"
@@ -2622,6 +2623,12 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
+ case FILE_MENU_RUN_SCENE: {
+ if (p_selected.size() == 1) {
+ EditorRunBar::get_singleton()->play_custom_scene(p_selected[0]);
+ }
+ } break;
+
case EXTRA_FOCUS_PATH: {
focus_on_filter();
} break;
@@ -3310,6 +3317,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
if (all_files_scenes) {
if (filenames.size() == 1) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_MENU_OPEN);
+ p_popup->add_icon_item(get_editor_theme_icon(SNAME("Play")), TTRC("Play Scene"), FILE_MENU_RUN_SCENE);
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTRC("New Inherited Scene"), FILE_MENU_INHERIT);
if (ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")) != filenames[0]) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTRC("Set as Main Scene"), FILE_MENU_MAIN_SCENE);
diff --git a/editor/docks/filesystem_dock.h b/editor/docks/filesystem_dock.h
index 67f6e55b3c1..9a2ece0db3b 100644
--- a/editor/docks/filesystem_dock.h
+++ b/editor/docks/filesystem_dock.h
@@ -133,6 +133,7 @@ private:
FILE_MENU_NEW_SCRIPT,
FILE_MENU_NEW_SCENE,
FILE_MENU_RUN_SCRIPT,
+ FILE_MENU_RUN_SCENE,
FILE_MENU_MAX,
// Extra shortcuts that don't exist in the menu.
EXTRA_FOCUS_PATH,