Fix custom actor options for prefab window
This commit is contained in:
@@ -44,6 +44,7 @@ namespace FlaxEditor.SceneGraph
|
||||
CustomNodesTypes.Add(typeof(SkyLight), typeof(SkyLightNode));
|
||||
CustomNodesTypes.Add(typeof(PostFxVolume), typeof(PostFxVolumeNode));
|
||||
CustomNodesTypes.Add(typeof(StaticModel), typeof(StaticModelNode));
|
||||
CustomNodesTypes.Add(typeof(AnimatedModel), typeof(AnimatedModelNode));
|
||||
CustomNodesTypes.Add(typeof(BoxBrush), typeof(BoxBrushNode));
|
||||
CustomNodesTypes.Add(typeof(TextRender), typeof(TextRenderNode));
|
||||
CustomNodesTypes.Add(typeof(AudioListener), typeof(AudioListenerNode));
|
||||
|
||||
@@ -143,7 +143,23 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
|
||||
// Custom options
|
||||
|
||||
bool showCustomNodeOptions = Editor.SceneEditing.Selection.Count == 1;
|
||||
if (!showCustomNodeOptions && Editor.SceneEditing.Selection.Count != 0)
|
||||
{
|
||||
showCustomNodeOptions = true;
|
||||
for (int i = 1; i < Editor.SceneEditing.Selection.Count; i++)
|
||||
{
|
||||
if (Editor.SceneEditing.Selection[0].GetType() != Editor.SceneEditing.Selection[i].GetType())
|
||||
{
|
||||
showCustomNodeOptions = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showCustomNodeOptions)
|
||||
{
|
||||
Editor.SceneEditing.Selection[0].OnContextMenu(contextMenu);
|
||||
}
|
||||
ContextMenuShow?.Invoke(contextMenu);
|
||||
|
||||
return contextMenu;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace FlaxEditor.Windows
|
||||
b = contextMenu.AddButton("Duplicate", Editor.SceneEditing.Duplicate);
|
||||
b.Enabled = hasSthSelected;
|
||||
|
||||
if (Editor.SceneEditing.SelectionCount == 1)
|
||||
if (isSingleActorSelected)
|
||||
{
|
||||
var convertMenu = contextMenu.AddChildMenu("Convert");
|
||||
var convertActorCm = convertMenu.ContextMenu;
|
||||
@@ -100,7 +100,7 @@ namespace FlaxEditor.Windows
|
||||
|
||||
b = contextMenu.AddButton("Create Prefab", Editor.Prefabs.CreatePrefab);
|
||||
b.Enabled = isSingleActorSelected &&
|
||||
(Editor.SceneEditing.Selection[0] as ActorNode).CanCreatePrefab &&
|
||||
((ActorNode)Editor.SceneEditing.Selection[0]).CanCreatePrefab &&
|
||||
Editor.Windows.ContentWin.CurrentViewFolder.CanHaveAssets;
|
||||
|
||||
bool hasPrefabLink = canEditScene && isSingleActorSelected && (Editor.SceneEditing.Selection[0] as ActorNode).HasPrefabLink;
|
||||
|
||||
Reference in New Issue
Block a user