From e17b6d16259ff31bb959263b196aef4c7dfe1438 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Fri, 3 Dec 2021 15:35:23 +0100 Subject: [PATCH] Hide enum/structure nodes from state machine surface context menu --- Source/Editor/Surface/AnimGraphSurface.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/Editor/Surface/AnimGraphSurface.cs b/Source/Editor/Surface/AnimGraphSurface.cs index be359d8a7..c2339e515 100644 --- a/Source/Editor/Surface/AnimGraphSurface.cs +++ b/Source/Editor/Surface/AnimGraphSurface.cs @@ -360,13 +360,21 @@ namespace FlaxEditor.Surface /// protected override void OnShowPrimaryMenu(VisjectCM activeCM, Vector2 location, Box startBox) { - Profiler.BeginEvent("Setup Anim Graph Context Menu"); - NodesCache.Get(activeCM); - Profiler.EndEvent(); + // Check if show additional nodes in the current surface context + if (activeCM != _cmStateMachineMenu) + { + Profiler.BeginEvent("Setup Anim Graph Context Menu"); + NodesCache.Get(activeCM); + Profiler.EndEvent(); - base.OnShowPrimaryMenu(activeCM, location, startBox); + base.OnShowPrimaryMenu(activeCM, location, startBox); - activeCM.VisibleChanged += OnActiveContextMenuVisibleChanged; + activeCM.VisibleChanged += OnActiveContextMenuVisibleChanged; + } + else + { + base.OnShowPrimaryMenu(activeCM, location, startBox); + } } private void OnActiveContextMenuVisibleChanged(Control activeCM)