// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
using FlaxEditor.Surface.Archetypes;
using FlaxEngine;
namespace FlaxEditor.Surface
{
///
/// The Visject Surface implementation for the animation graph functions editor.
///
///
///
[HideInEditor]
public class AnimationGraphFunctionSurface : AnimGraphSurface, Function.IFunctionSurface
{
private static readonly Type[] AnimationGraphFunctionTypes =
{
typeof(bool),
typeof(int),
typeof(float),
typeof(Vector2),
typeof(Vector3),
typeof(Vector4),
typeof(void),
};
///
public AnimationGraphFunctionSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
: base(owner, onSave, undo)
{
}
///
public override bool CanUseNodeType(NodeArchetype nodeArchetype)
{
if (nodeArchetype.Title == "Function Input")
return true;
// Allow to use Function Output only in the root graph (not in state machine sub-graphs)
if (Context == RootContext && nodeArchetype.Title == "Function Output")
return true;
return base.CanUseNodeType(nodeArchetype);
}
///
public Type[] FunctionTypes => AnimationGraphFunctionTypes;
}
}