From 3b393ef4db27e2ccb629ba006646be973ba2fe0a Mon Sep 17 00:00:00 2001 From: Nils Hausfeld Date: Mon, 25 Sep 2023 21:58:05 +0200 Subject: [PATCH] Groups now get filtered by box type when added after the context menu was opened --- Source/Editor/Surface/ContextMenu/VisjectCM.cs | 5 +++++ .../Editor/Surface/ContextMenu/VisjectCMItem.cs | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index 1cec9554b..04130fc1e 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -288,6 +288,10 @@ namespace FlaxEditor.Surface.ContextMenu OnSearchFilterChanged(); } } + else + { + group.EvaluateVisibilityWithBox(_selectedBox); + } Profiler.EndEvent(); } @@ -321,6 +325,7 @@ namespace FlaxEditor.Surface.ContextMenu Parent = group }; } + group.EvaluateVisibilityWithBox(_selectedBox); group.SortChildren(); group.Parent = _groupsPanel; _groups.Add(group); diff --git a/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs b/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs index 4030017a7..00854ef5a 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs @@ -117,10 +117,23 @@ namespace FlaxEditor.Surface.ContextMenu public bool CanConnectTo(Box startBox) { if (startBox == null) - return true; + { + Visible = true; + return true; + } + + if (_archetype.Title == "GetChild") + { + Debug.Log(""); + Debug.Log(_archetype.Create == null); + Debug.Log(_archetype.Create.GetType() == typeof(FlaxEditor.Surface.Archetypes.Function.MethodOverrideNode)); + } - if(_archetype?.Elements == null) + if (_archetype?.Elements == null) + { + Visible = false; return false; + } bool isCompatible = false; foreach (NodeElementArchetype element in _archetype.Elements)