1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Merge pull request #107652 from vaner-org/set-tab-as-main-scene

Add "Set as Main Scene" option to EditorSceneTabs context menu
This commit is contained in:
Thaddeus Crews
2025-11-17 10:56:29 -06:00
3 changed files with 27 additions and 1 deletions

View File

@@ -30,6 +30,7 @@
#include "editor_scene_tabs.h"
#include "core/config/project_settings.h"
#include "editor/docks/inspector_dock.h"
#include "editor/editor_main_screen.h"
#include "editor/editor_node.h"
@@ -195,11 +196,16 @@ void EditorSceneTabs::_update_context_menu() {
DISABLE_LAST_OPTION_IF(!can_save_all_scenes);
if (tab_id >= 0) {
const String scene_path = EditorNode::get_editor_data().get_scene_path(tab_id);
const String main_scene_path = GLOBAL_GET("application/run/main_scene");
scene_tabs_context_menu->add_separator();
scene_tabs_context_menu->add_item(TTR("Show in FileSystem"), SCENE_SHOW_IN_FILESYSTEM);
DISABLE_LAST_OPTION_IF(!ResourceLoader::exists(EditorNode::get_editor_data().get_scene_path(tab_id)));
DISABLE_LAST_OPTION_IF(!ResourceLoader::exists(scene_path));
scene_tabs_context_menu->add_item(TTR("Play This Scene"), SCENE_RUN);
DISABLE_LAST_OPTION_IF(no_root_node);
scene_tabs_context_menu->add_item(TTR("Set as Main Scene"), EditorNode::SCENE_SET_MAIN_SCENE);
DISABLE_LAST_OPTION_IF(no_root_node || (!main_scene_path.is_empty() && ResourceUID::ensure_path(main_scene_path) == scene_path));
scene_tabs_context_menu->add_separator();
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/close_scene"), EditorNode::SCENE_CLOSE);