From efebb29ac0479dfdea2e307687fbbdad3be3cc57 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 16 Dec 2023 12:49:39 +0100 Subject: [PATCH] Minor tweak for #2003 --- Source/Editor/Content/Proxy/SceneProxy.cs | 6 +++++- Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs | 2 +- Source/Engine/Level/Level.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Content/Proxy/SceneProxy.cs b/Source/Editor/Content/Proxy/SceneProxy.cs index a232c672b..d959b524a 100644 --- a/Source/Editor/Content/Proxy/SceneProxy.cs +++ b/Source/Editor/Content/Proxy/SceneProxy.cs @@ -73,7 +73,11 @@ namespace FlaxEditor.Content /// public override void OnContentWindowContextMenu(ContextMenu menu, ContentItem item) { - menu.AddButton("Open additionally", () => { Editor.Instance.Scene.OpenScene(((SceneItem)item).ID, true); }); + var id = ((SceneItem)item).ID; + if (Level.FindScene(id) == null) + { + menu.AddButton("Open (additive)", () => { Editor.Instance.Scene.OpenScene(id, true); }); + } } } } diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs index 8b5318190..0c8e0f283 100644 --- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs +++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs @@ -158,7 +158,7 @@ namespace FlaxEditor.Windows if (unloadedScenes.Count > 0) { contextMenu.AddSeparator(); - var childCM = contextMenu.GetOrAddChildMenu("Add Scene"); + var childCM = contextMenu.GetOrAddChildMenu("Open Scene"); foreach (var sceneGuid in unloadedScenes) { if (FlaxEngine.Content.GetAssetInfo(sceneGuid, out var unloadedScene)) diff --git a/Source/Engine/Level/Level.cpp b/Source/Engine/Level/Level.cpp index cc91e48ca..41033876d 100644 --- a/Source/Engine/Level/Level.cpp +++ b/Source/Engine/Level/Level.cpp @@ -439,7 +439,7 @@ public: bool Do() const override { - auto scene = Scripting::FindObject(TargetScene); + auto scene = Level::FindScene(TargetScene); if (!scene) return true; return unloadScene(scene);