Fix some prefabs issues

This commit is contained in:
Wojtek Figat
2021-02-04 23:34:44 +01:00
parent db55f5ea3f
commit 3661b19d6c
3 changed files with 45 additions and 35 deletions

View File

@@ -69,6 +69,7 @@ namespace FlaxEditor.Windows.Assets
bool hasSthSelected = Selection.Count > 0;
bool isSingleActorSelected = Selection.Count == 1 && Selection[0] is ActorNode;
bool isRootSelected = isSingleActorSelected && Selection[0] == Graph.Main;
bool hasPrefabLink = isSingleActorSelected && (Selection[0] as ActorNode).HasPrefabLink;
// Create popup
@@ -97,7 +98,7 @@ namespace FlaxEditor.Windows.Assets
b.Enabled = hasSthSelected && !isRootSelected;
b = contextMenu.AddButton("Set Root", SetRoot);
b.Enabled = isSingleActorSelected && !isRootSelected;
b.Enabled = isSingleActorSelected && !isRootSelected && hasPrefabLink;
// Prefab options
@@ -108,8 +109,6 @@ namespace FlaxEditor.Windows.Assets
(Selection[0] as ActorNode).CanCreatePrefab &&
Editor.Windows.ContentWin.CurrentViewFolder.CanHaveAssets;
bool hasPrefabLink = isSingleActorSelected && (Selection[0] as ActorNode).HasPrefabLink;
b = contextMenu.AddButton("Select Prefab", Editor.Prefabs.SelectPrefab);
b.Enabled = hasPrefabLink;