Add SortScore to Visject node archetypes and use it to favor method overrides in Visual Script
This commit is contained in:
@@ -2470,6 +2470,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Title = string.Empty,
|
||||
Description = "Overrides the base class method with custom implementation",
|
||||
Flags = NodeFlags.VisualScriptGraph | NodeFlags.NoSpawnViaGUI | NodeFlags.NoSpawnViaPaste,
|
||||
SortScore = 10,
|
||||
IsInputCompatible = MethodOverrideNode.IsInputCompatible,
|
||||
IsOutputCompatible = MethodOverrideNode.IsOutputCompatible,
|
||||
Size = new Float2(240, 60),
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
if (!Visible)
|
||||
return;
|
||||
|
||||
SortScore += _archetype.SortScore;
|
||||
if (selectedBox != null && CanConnectTo(selectedBox))
|
||||
SortScore += 1;
|
||||
if (Data != null)
|
||||
|
||||
@@ -149,6 +149,11 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public object Tag;
|
||||
|
||||
/// <summary>
|
||||
/// Custom score value to use when sorting node archetypes in Editor. If positive (eg. 1, 2) can be used to add more importance for a specific node type.
|
||||
/// </summary>
|
||||
public float SortScore;
|
||||
|
||||
/// <summary>
|
||||
/// Default node values. This array supports types: bool, int, float, Vector2, Vector3, Vector4, Color, Rectangle, Guid, string, Matrix and byte[].
|
||||
/// </summary>
|
||||
@@ -204,14 +209,17 @@ namespace FlaxEditor.Surface
|
||||
Size = Size,
|
||||
Flags = Flags,
|
||||
Title = Title,
|
||||
Description = Title,
|
||||
SubTitle = SubTitle,
|
||||
Description = Description,
|
||||
AlternativeTitles = (string[])AlternativeTitles?.Clone(),
|
||||
Tag = Tag,
|
||||
SortScore = SortScore,
|
||||
DefaultValues = (object[])DefaultValues?.Clone(),
|
||||
DefaultType = DefaultType,
|
||||
ConnectionsHints = ConnectionsHints,
|
||||
IndependentBoxes = (int[])IndependentBoxes?.Clone(),
|
||||
DependentBoxes = (int[])DependentBoxes?.Clone(),
|
||||
DependentBoxFilter = DependentBoxFilter,
|
||||
Elements = (NodeElementArchetype[])Elements?.Clone(),
|
||||
TryParseText = TryParseText,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user