diff --git a/Source/Editor/Surface/Archetypes/Comparisons.cs b/Source/Editor/Surface/Archetypes/Comparisons.cs index bcf0159d2..22adea949 100644 --- a/Source/Editor/Surface/Archetypes/Comparisons.cs +++ b/Source/Editor/Surface/Archetypes/Comparisons.cs @@ -20,6 +20,7 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = id, Title = title, + Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), Description = desc, Flags = NodeFlags.AllGraphs, AlternativeTitles = altTitles, @@ -44,6 +45,28 @@ namespace FlaxEditor.Surface.Archetypes }; } + private class ComparisonNode : SurfaceNode + { + public ComparisonNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) + : base(id, context, nodeArch, groupArch) + { + } + + public override void OnSurfaceLoaded(SurfaceNodeActions action) + { + base.OnSurfaceLoaded(action); + + ResizeAuto(); + } + + public override void ConnectionTick(Box box) + { + base.ConnectionTick(box); + + ResizeAuto(); + } + } + private class SwitchOnEnumNode : SurfaceNode { public SwitchOnEnumNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) @@ -181,6 +204,7 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = 7, Title = "Switch On Bool", + Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), AlternativeTitles = new[] { "if", "switch" }, Description = "Returns one of the input values based on the condition value", Flags = NodeFlags.AllGraphs,