From f38df259a7df762fc270a68b8a1a385205a9ef52 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 18 Jun 2024 21:10:42 -0500 Subject: [PATCH] Dont show Select prefab, Edit prefab, and view changes buttons when editing actor in the prefab. --- .../CustomEditors/Dedicated/ActorEditor.cs | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs index b88aeb7ad..27e2849bd 100644 --- a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs @@ -67,32 +67,35 @@ namespace FlaxEditor.CustomEditors.Dedicated // Use default prefab instance as a reference for the editor Values.SetReferenceValue(prefabInstance); - // Add some UI - var panel = layout.CustomContainer(); - panel.CustomControl.Height = 20.0f; - panel.CustomControl.SlotsVertically = 1; - panel.CustomControl.SlotsHorizontally = 3; - - // Selecting actor prefab asset - var selectPrefab = panel.Button("Select Prefab"); - selectPrefab.Button.Clicked += () => + if (Presenter == Editor.Instance.Windows.PropertiesWin.Presenter) { - Editor.Instance.Windows.ContentWin.ClearItemsSearch(); - Editor.Instance.Windows.ContentWin.Select(prefab); - }; + // Add some UI + var panel = layout.CustomContainer(); + panel.CustomControl.Height = 20.0f; + panel.CustomControl.SlotsVertically = 1; + panel.CustomControl.SlotsHorizontally = 3; + + // Selecting actor prefab asset + var selectPrefab = panel.Button("Select Prefab"); + selectPrefab.Button.Clicked += () => + { + Editor.Instance.Windows.ContentWin.ClearItemsSearch(); + Editor.Instance.Windows.ContentWin.Select(prefab); + }; - // Edit selected prefab asset - var editPrefab = panel.Button("Edit Prefab"); - editPrefab.Button.Clicked += () => - { - Editor.Instance.Windows.ContentWin.ClearItemsSearch(); - Editor.Instance.Windows.ContentWin.Select(prefab); - Editor.Instance.Windows.ContentWin.Open(Editor.Instance.Windows.ContentWin.View.Selection[0]); - }; + // Edit selected prefab asset + var editPrefab = panel.Button("Edit Prefab"); + editPrefab.Button.Clicked += () => + { + Editor.Instance.Windows.ContentWin.ClearItemsSearch(); + Editor.Instance.Windows.ContentWin.Select(prefab); + Editor.Instance.Windows.ContentWin.Open(Editor.Instance.Windows.ContentWin.View.Selection[0]); + }; - // Viewing changes applied to this actor - var viewChanges = panel.Button("View Changes"); - viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Float2(0.0f, 20.0f)); + // Viewing changes applied to this actor + var viewChanges = panel.Button("View Changes"); + viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Float2(0.0f, 20.0f)); + } // Link event to update editor on prefab apply _linkedPrefabId = prefab.ID;