summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-30 10:05:28 +0100
committerGitHub <noreply@github.com>2019-10-30 10:05:28 +0100
commit88143b6146664223c4ad854c348d87e9b2e9d157 (patch)
tree33d3b566835c869be24bf17f4cd02eb745b02a0a
parente17cf5049b1f2de40244b3485df067d67fdf57d0 (diff)
parentbee6b94b77649bf75c4f91d1ea8c73d890e77860 (diff)
Merge pull request #33164 from volzhs/set-main-scene
Add "Set as main scene" on context menu in FileSystem panel
-rw-r--r--editor/filesystem_dock.cpp14
-rw-r--r--editor/filesystem_dock.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index be05183f92..fa171ddb0c 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -115,6 +115,10 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
file_item->select(0);
file_item->set_as_cursor(0);
}
+ String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
+ if (main_scene == file_metadata) {
+ file_item->set_custom_color(0, get_color("accent_color", "Editor"));
+ }
Array udata;
udata.push_back(tree_update_id);
udata.push_back(file_item);
@@ -1565,6 +1569,15 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
+ case FILE_MAIN_SCENE: {
+ // Set as main scene with selected scene file.
+ if (p_selected.size() == 1) {
+ ProjectSettings::get_singleton()->set("application/run/main_scene", p_selected[0]);
+ ProjectSettings::get_singleton()->save();
+ _update_tree(_compute_uncollapsed_paths());
+ }
+ } break;
+
case FILE_INSTANCE: {
// Instance all selected scenes.
Vector<String> paths;
@@ -2138,6 +2151,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (filenames.size() == 1) {
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scene"), FILE_OPEN);
p_popup->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("New Inherited Scene"), FILE_INHERIT);
+ p_popup->add_item(TTR("Set As Main Scene"), FILE_MAIN_SCENE);
} else {
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scenes"), FILE_OPEN);
}
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 49eb31e330..099f4ad273 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -74,6 +74,7 @@ private:
enum FileMenu {
FILE_OPEN,
FILE_INHERIT,
+ FILE_MAIN_SCENE,
FILE_INSTANCE,
FILE_ADD_FAVORITE,
FILE_REMOVE_FAVORITE,