Format more engine code
This commit is contained in:
@@ -86,7 +86,6 @@ API_ENUM() enum class AlphaBlendMode : byte
|
||||
class AlphaBlend
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Converts the input alpha value from a linear 0-1 value into the output alpha described by blend mode.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
struct NodeAnimationData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The target node name.
|
||||
/// </summary>
|
||||
@@ -34,7 +33,6 @@ public:
|
||||
LinearCurve<Float3> Scale;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeAnimationData"/> class.
|
||||
/// </summary>
|
||||
@@ -46,7 +44,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation transformation at the specified time (only for the curves with non-empty data).
|
||||
/// </summary>
|
||||
@@ -98,7 +95,6 @@ public:
|
||||
struct AnimationData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the animation (in frames).
|
||||
/// </summary>
|
||||
@@ -125,7 +121,6 @@ public:
|
||||
Array<NodeAnimationData> Channels;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the animation (in seconds).
|
||||
/// </summary>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
class AnimationsService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
AnimationsService()
|
||||
: EngineService(TEXT("Animations"), -10)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ class Asset;
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API Animations
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Animations);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Animations);
|
||||
|
||||
/// <summary>
|
||||
/// The system for Animations update.
|
||||
|
||||
@@ -286,15 +286,12 @@ template<class T, typename KeyFrame = LinearCurveKeyframe<T>>
|
||||
class CurveBase
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Span<KeyFrame> KeyFrameData;
|
||||
|
||||
protected:
|
||||
|
||||
T _default;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Curve"/> class.
|
||||
/// </summary>
|
||||
@@ -320,7 +317,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default value for the keyframes.
|
||||
/// </summary>
|
||||
@@ -338,7 +334,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation curve value at the specified time.
|
||||
/// </summary>
|
||||
@@ -466,7 +461,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pair of keys that can be used for interpolating to field the value at the provided time.
|
||||
/// </summary>
|
||||
@@ -507,16 +501,13 @@ template<class T, typename KeyFrame = LinearCurveKeyframe<T>>
|
||||
class Curve : public CurveBase<T, KeyFrame>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef CurveBase<T, KeyFrame> Base;
|
||||
using KeyFrameCollection = Array<KeyFrame>;
|
||||
|
||||
private:
|
||||
|
||||
KeyFrameCollection _keyframes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Curve"/> class.
|
||||
/// </summary>
|
||||
@@ -552,7 +543,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the animation curve, from time zero to last keyframe.
|
||||
/// </summary>
|
||||
@@ -627,7 +617,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the animation curve value at the specified time.
|
||||
/// </summary>
|
||||
@@ -745,7 +734,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE KeyFrame& operator[](int32 index)
|
||||
{
|
||||
return _keyframes[index];
|
||||
|
||||
@@ -135,21 +135,21 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
// Check if this node needs a state container
|
||||
switch (n->GroupID)
|
||||
{
|
||||
// Tools
|
||||
// Tools
|
||||
case 7:
|
||||
switch (n->TypeID)
|
||||
{
|
||||
// Time
|
||||
// Time
|
||||
case 5:
|
||||
ADD_BUCKET(AnimationBucketInit);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 9:
|
||||
switch (n->TypeID)
|
||||
{
|
||||
// Output
|
||||
// Output
|
||||
case 1:
|
||||
_rootNode = n;
|
||||
if (_rootNode->Values.Count() < 1)
|
||||
@@ -158,16 +158,16 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
_rootNode->Values[0] = (int32)RootMotionMode::NoExtraction;
|
||||
}
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 2:
|
||||
ADD_BUCKET(AnimationBucketInit);
|
||||
n->Assets[0] = (Asset*)Content::LoadAsync<Animation>((Guid)n->Values[0]);
|
||||
break;
|
||||
// Blend with Mask
|
||||
// Blend with Mask
|
||||
case 11:
|
||||
n->Assets[0] = (Asset*)Content::LoadAsync<SkeletonMask>((Guid)n->Values[1]);
|
||||
break;
|
||||
// Multi Blend 1D
|
||||
// Multi Blend 1D
|
||||
case 12:
|
||||
{
|
||||
ADD_BUCKET(MultiBlendBucketInit);
|
||||
@@ -183,7 +183,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
Sorting::SortArray(n->Data.MultiBlend1D.IndicesSorted, ANIM_GRAPH_MULTI_BLEND_MAX_ANIMS, &SortMultiBlend1D, n);
|
||||
break;
|
||||
}
|
||||
// Multi Blend 2D
|
||||
// Multi Blend 2D
|
||||
case 13:
|
||||
{
|
||||
ADD_BUCKET(MultiBlendBucketInit);
|
||||
@@ -239,13 +239,13 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Pose
|
||||
// Blend Pose
|
||||
case 14:
|
||||
{
|
||||
ADD_BUCKET(BlendPoseBucketInit);
|
||||
break;
|
||||
}
|
||||
// State Machine
|
||||
// State Machine
|
||||
case 18:
|
||||
{
|
||||
ADD_BUCKET(StateMachineBucketInit);
|
||||
@@ -261,7 +261,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// Entry
|
||||
// Entry
|
||||
case 19:
|
||||
{
|
||||
const auto entryTargetId = (int32)n->Values[0];
|
||||
@@ -273,7 +273,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
_rootNode = entryTarget;
|
||||
break;
|
||||
}
|
||||
// State
|
||||
// State
|
||||
case 20:
|
||||
{
|
||||
// Load the graph
|
||||
@@ -370,19 +370,19 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
|
||||
break;
|
||||
}
|
||||
// State Output
|
||||
// State Output
|
||||
case 21:
|
||||
{
|
||||
_rootNode = n;
|
||||
break;
|
||||
}
|
||||
// Rule Output
|
||||
// Rule Output
|
||||
case 22:
|
||||
{
|
||||
_rootNode = n;
|
||||
break;
|
||||
}
|
||||
// Animation Graph Function
|
||||
// Animation Graph Function
|
||||
case 24:
|
||||
{
|
||||
auto& data = n->Data.AnimationGraphFunction;
|
||||
@@ -401,9 +401,9 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
data.Graph = LoadSubGraph(graphData.Get(), graphData.Length(), TEXT("Animation Graph Function"));
|
||||
break;
|
||||
}
|
||||
// Transform Node (local/model space)
|
||||
// Get Node Transform (local/model space)
|
||||
// IK Aim, Two Bone IK
|
||||
// Transform Node (local/model space)
|
||||
// Get Node Transform (local/model space)
|
||||
// IK Aim, Two Bone IK
|
||||
case 25:
|
||||
case 26:
|
||||
case 28:
|
||||
@@ -418,7 +418,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
data.NodeIndex = -1;
|
||||
break;
|
||||
}
|
||||
// Copy Node
|
||||
// Copy Node
|
||||
case 27:
|
||||
{
|
||||
auto& data = n->Data.CopyNode;
|
||||
@@ -442,7 +442,7 @@ bool AnimGraphBase::onNodeLoaded(Node* n)
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Custom
|
||||
// Custom
|
||||
case 13:
|
||||
{
|
||||
// Clear data
|
||||
|
||||
@@ -167,7 +167,6 @@ enum class RootMotionMode
|
||||
class AnimGraphStateTransition
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The transition flag types.
|
||||
/// </summary>
|
||||
@@ -195,7 +194,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The destination state node.
|
||||
/// </summary>
|
||||
@@ -230,9 +228,8 @@ DECLARE_ENUM_OPERATORS(AnimGraphStateTransition::FlagTypes);
|
||||
/// <seealso cref="GraphParameter" />
|
||||
API_CLASS() class AnimGraphParameter : public VisjectGraphParameter
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(AnimGraphParameter, VisjectGraphParameter);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(AnimGraphParameter, VisjectGraphParameter);
|
||||
public:
|
||||
|
||||
AnimGraphParameter(const AnimGraphParameter& other)
|
||||
: AnimGraphParameter()
|
||||
{
|
||||
@@ -271,7 +268,6 @@ class FLAXENGINE_API AnimGraphInstanceData
|
||||
{
|
||||
friend AnimGraphExecutor;
|
||||
public:
|
||||
|
||||
// ---- Quick documentation ----
|
||||
// AnimGraphInstanceData holds a single animation graph instance playback data.
|
||||
// It has parameters (the same layout as graph) that can be modified per instance (eg. by game scripts).
|
||||
@@ -335,7 +331,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The instance data version number. Used to sync the Anim Graph data with the instance state. Handles Anim Graph reloads to ensure data is valid.
|
||||
/// </summary>
|
||||
@@ -392,7 +387,6 @@ public:
|
||||
Array<AnimGraphSlot, InlinedAllocation<4>> Slots;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Clears this container data.
|
||||
/// </summary>
|
||||
@@ -409,7 +403,6 @@ public:
|
||||
void Invalidate();
|
||||
|
||||
private:
|
||||
|
||||
struct Event
|
||||
{
|
||||
AnimEvent* Instance;
|
||||
@@ -433,7 +426,6 @@ struct AnimGraphTransitionData
|
||||
class AnimGraphBox : public VisjectGraphBox
|
||||
{
|
||||
public:
|
||||
|
||||
AnimGraphBox()
|
||||
{
|
||||
}
|
||||
@@ -452,7 +444,6 @@ public:
|
||||
class AnimGraphNode : public VisjectGraphNode<AnimGraphBox>
|
||||
{
|
||||
public:
|
||||
|
||||
struct MultiBlend1DData
|
||||
{
|
||||
/// <summary>
|
||||
@@ -575,7 +566,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation graph.
|
||||
/// </summary>
|
||||
@@ -592,13 +582,11 @@ public:
|
||||
AdditionalData Data;
|
||||
|
||||
public:
|
||||
|
||||
AnimGraphNode()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the per-node node transformations cache (cached).
|
||||
/// </summary>
|
||||
@@ -614,7 +602,6 @@ public:
|
||||
class AnimGraphBase : public VisjectGraph<AnimGraphNode, AnimGraphBox, AnimGraphParameter>
|
||||
{
|
||||
protected:
|
||||
|
||||
AnimGraph* _graph;
|
||||
Node* _rootNode = nullptr;
|
||||
|
||||
@@ -624,7 +611,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The sub graphs nested in this graph.
|
||||
/// </summary>
|
||||
@@ -651,7 +637,6 @@ public:
|
||||
int32 BucketsCountTotal;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="AnimGraphBase"/> class.
|
||||
/// </summary>
|
||||
@@ -661,7 +646,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root node of the graph (cache don load).
|
||||
/// </summary>
|
||||
@@ -680,7 +664,6 @@ public:
|
||||
AnimSubGraph* LoadSubGraph(const void* data, int32 dataLength, const Char* name);
|
||||
|
||||
public:
|
||||
|
||||
// [Graph]
|
||||
bool Load(ReadStream* stream, bool loadMeta) override;
|
||||
void Clear() override;
|
||||
@@ -689,7 +672,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [Graph]
|
||||
bool onNodeLoaded(Node* n) override;
|
||||
};
|
||||
@@ -707,7 +689,6 @@ class AnimSubGraph : public AnimGraphBase
|
||||
friend AnimGraphParameter;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnimSubGraph" /> class.
|
||||
/// </summary>
|
||||
@@ -730,7 +711,6 @@ class AnimGraph : public AnimGraphBase
|
||||
friend AnimGraphExecutor;
|
||||
|
||||
private:
|
||||
|
||||
typedef void (*InitBucketHandler)(AnimGraphInstanceData::Bucket&);
|
||||
|
||||
bool _isFunction, _isRegisteredForScriptingEvents;
|
||||
@@ -740,7 +720,6 @@ private:
|
||||
Asset* _owner;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnimGraph"/> class.
|
||||
/// </summary>
|
||||
@@ -758,7 +737,6 @@ public:
|
||||
~AnimGraph();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The Anim Graph data version number. Used to sync the Anim Graph data with the instances state. Handles Anim Graph reloads to ensure data is valid.
|
||||
/// </summary>
|
||||
@@ -773,7 +751,6 @@ public:
|
||||
AssetReference<SkinnedModel> BaseModel;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this graph is ready for the animation evaluation.
|
||||
/// </summary>
|
||||
@@ -787,7 +764,6 @@ public:
|
||||
bool CanUseWithSkeleton(SkinnedModel* other) const;
|
||||
|
||||
private:
|
||||
|
||||
void ClearCustomNode(Node* node);
|
||||
bool InitCustomNode(Node* node);
|
||||
|
||||
@@ -798,7 +774,6 @@ private:
|
||||
void OnScriptsLoaded();
|
||||
|
||||
public:
|
||||
|
||||
// [Graph]
|
||||
bool Load(ReadStream* stream, bool loadMeta) override;
|
||||
bool onParamCreated(Parameter* p) override;
|
||||
@@ -829,7 +804,6 @@ class AnimGraphExecutor : public VisjectExecutor
|
||||
{
|
||||
friend AnimGraphNode;
|
||||
private:
|
||||
|
||||
AnimGraph& _graph;
|
||||
RootMotionMode _rootMotionMode = RootMotionMode::NoExtraction;
|
||||
int32 _skeletonNodesCount = 0;
|
||||
@@ -838,7 +812,6 @@ private:
|
||||
static ThreadLocal<AnimGraphContext> Context;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the managed runtime calls.
|
||||
/// </summary>
|
||||
@@ -851,7 +824,6 @@ public:
|
||||
explicit AnimGraphExecutor(AnimGraph& graph);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the graph animation.
|
||||
/// </summary>
|
||||
@@ -891,7 +863,6 @@ public:
|
||||
void ResetBuckets(AnimGraphContext& context, AnimGraphBase* graph);
|
||||
|
||||
private:
|
||||
|
||||
Value eatBox(Node* caller, Box* box) override;
|
||||
Graph* GetCurrentGraph() const override;
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ void AnimGraphExecutor::ProcessGroupParameters(Box* box, Node* node, Value& valu
|
||||
auto& context = Context.Get();
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Get
|
||||
// Get
|
||||
case 1:
|
||||
{
|
||||
// Get parameter
|
||||
@@ -628,7 +628,7 @@ void AnimGraphExecutor::ProcessGroupTools(Box* box, Node* nodeBase, Value& value
|
||||
auto node = (AnimGraphNode*)nodeBase;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Time
|
||||
// Time
|
||||
case 5:
|
||||
{
|
||||
auto& bucket = context.Data->State[node->BucketIndex].Animation;
|
||||
@@ -655,11 +655,11 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
auto node = (AnimGraphNode*)nodeBase;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Animation Output
|
||||
// Animation Output
|
||||
case 1:
|
||||
value = tryGetValue(box, Value::Null);
|
||||
break;
|
||||
// Animation
|
||||
// Animation
|
||||
case 2:
|
||||
{
|
||||
const auto anim = node->Assets[0].As<Animation>();
|
||||
@@ -670,7 +670,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
switch (box->ID)
|
||||
{
|
||||
// Animation
|
||||
// Animation
|
||||
case 0:
|
||||
{
|
||||
const float length = anim ? anim->GetLength() : 0.0f;
|
||||
@@ -690,21 +690,21 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Normalized Time
|
||||
// Normalized Time
|
||||
case 1:
|
||||
value = startTimePos + bucket.TimePosition;
|
||||
if (anim && anim->IsLoaded())
|
||||
value.AsFloat /= anim->GetLength();
|
||||
break;
|
||||
// Time
|
||||
// Time
|
||||
case 2:
|
||||
value = startTimePos + bucket.TimePosition;
|
||||
break;
|
||||
// Length
|
||||
// Length
|
||||
case 3:
|
||||
value = anim ? anim->GetLength() : 0.0f;
|
||||
break;
|
||||
// Is Playing
|
||||
// Is Playing
|
||||
case 4:
|
||||
// If anim was updated during this or a previous frame
|
||||
value = bucket.LastUpdateFrame >= context.CurrentFrameIndex - 1;
|
||||
@@ -712,7 +712,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Transform Bone (local/model space)
|
||||
// Transform Bone (local/model space)
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
@@ -762,7 +762,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Local To Model
|
||||
// Local To Model
|
||||
case 5:
|
||||
{
|
||||
// [Deprecated on 15.05.2020, expires on 15.05.2021]
|
||||
@@ -794,7 +794,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = dst;*/
|
||||
break;
|
||||
}
|
||||
// Model To Local
|
||||
// Model To Local
|
||||
case 6:
|
||||
{
|
||||
// [Deprecated on 15.05.2020, expires on 15.05.2021]
|
||||
@@ -833,7 +833,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = dst;*/
|
||||
break;
|
||||
}
|
||||
// Copy Bone
|
||||
// Copy Bone
|
||||
case 7:
|
||||
{
|
||||
// [Deprecated on 13.05.2020, expires on 13.05.2021]
|
||||
@@ -885,7 +885,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Bone Transform
|
||||
// Get Bone Transform
|
||||
case 8:
|
||||
{
|
||||
// [Deprecated on 13.05.2020, expires on 13.05.2021]
|
||||
@@ -899,7 +899,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Blend
|
||||
// Blend
|
||||
case 9:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -909,12 +909,12 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Only B
|
||||
// Only B
|
||||
else if (Math::NearEqual(alpha, 1.0f, ANIM_GRAPH_BLEND_THRESHOLD))
|
||||
{
|
||||
value = tryGetValue(node->GetBox(2), Value::Null);
|
||||
}
|
||||
// Blend A and B
|
||||
// Blend A and B
|
||||
else
|
||||
{
|
||||
const auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -938,7 +938,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Additive
|
||||
// Blend Additive
|
||||
case 10:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -948,7 +948,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Blend A and B
|
||||
// Blend A and B
|
||||
else
|
||||
{
|
||||
const auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -985,7 +985,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend with Mask
|
||||
// Blend with Mask
|
||||
case 11:
|
||||
{
|
||||
const float alpha = Math::Saturate((float)tryGetValue(node->GetBox(3), node->Values[0]));
|
||||
@@ -996,7 +996,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
{
|
||||
value = tryGetValue(node->GetBox(1), Value::Null);
|
||||
}
|
||||
// Blend A and B with mask
|
||||
// Blend A and B with mask
|
||||
else
|
||||
{
|
||||
auto valueA = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1033,7 +1033,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Multi Blend 1D
|
||||
// Multi Blend 1D
|
||||
case 12:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1122,7 +1122,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Multi Blend 2D
|
||||
// Multi Blend 2D
|
||||
case 13:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1304,7 +1304,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Blend Pose
|
||||
// Blend Pose
|
||||
case 14:
|
||||
{
|
||||
ASSERT(box->ID == 0);
|
||||
@@ -1353,7 +1353,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Get Root Motion
|
||||
// Get Root Motion
|
||||
case 15:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(2), Value::Null);
|
||||
@@ -1384,7 +1384,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Set Root Motion
|
||||
// Set Root Motion
|
||||
case 16:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1402,7 +1402,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Add Root Motion
|
||||
// Add Root Motion
|
||||
case 17:
|
||||
{
|
||||
auto pose = tryGetValue(node->GetBox(1), Value::Null);
|
||||
@@ -1420,7 +1420,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// State Machine
|
||||
// State Machine
|
||||
case 18:
|
||||
{
|
||||
const int32 maxTransitionsPerUpdate = node->Values[2].AsInt;
|
||||
@@ -1581,51 +1581,51 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
|
||||
break;
|
||||
}
|
||||
// Entry
|
||||
// Entry
|
||||
case 19:
|
||||
{
|
||||
// Not used
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
// State
|
||||
// State
|
||||
case 20:
|
||||
{
|
||||
// Not used
|
||||
CRASH;
|
||||
break;
|
||||
}
|
||||
// State Output
|
||||
// State Output
|
||||
case 21:
|
||||
value = box->HasConnection() ? eatBox(nodeBase, box->FirstConnection()) : Value::Null;
|
||||
break;
|
||||
// Rule Output
|
||||
// Rule Output
|
||||
case 22:
|
||||
value = box->HasConnection() ? eatBox(nodeBase, box->FirstConnection()) : Value::Null;
|
||||
break;
|
||||
// Transition Source State Anim
|
||||
// Transition Source State Anim
|
||||
case 23:
|
||||
{
|
||||
const AnimGraphTransitionData& transitionsData = context.TransitionData;
|
||||
switch (box->ID)
|
||||
{
|
||||
// Length
|
||||
// Length
|
||||
case 0:
|
||||
value = transitionsData.Length;
|
||||
break;
|
||||
// Time
|
||||
// Time
|
||||
case 1:
|
||||
value = transitionsData.Position;
|
||||
break;
|
||||
// Normalized Time
|
||||
// Normalized Time
|
||||
case 2:
|
||||
value = transitionsData.Position / transitionsData.Length;
|
||||
break;
|
||||
// Remaining Time
|
||||
// Remaining Time
|
||||
case 3:
|
||||
value = transitionsData.Length - transitionsData.Position;
|
||||
break;
|
||||
// Remaining Normalized Time
|
||||
// Remaining Normalized Time
|
||||
case 4:
|
||||
value = 1.0f - (transitionsData.Position / transitionsData.Length);
|
||||
break;
|
||||
@@ -1634,7 +1634,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Animation Graph Function
|
||||
// Animation Graph Function
|
||||
case 24:
|
||||
{
|
||||
// Load function graph
|
||||
@@ -1683,7 +1683,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
context.GraphStack.Pop();
|
||||
break;
|
||||
}
|
||||
// Transform Bone (local/model space)
|
||||
// Transform Bone (local/model space)
|
||||
case 25:
|
||||
case 26:
|
||||
{
|
||||
@@ -1741,7 +1741,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Copy Node
|
||||
// Copy Node
|
||||
case 27:
|
||||
{
|
||||
// Get input
|
||||
@@ -1790,7 +1790,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Node Transform (model space)
|
||||
// Get Node Transform (model space)
|
||||
case 28:
|
||||
{
|
||||
// Get input
|
||||
@@ -1802,7 +1802,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Aim IK
|
||||
// Aim IK
|
||||
case 29:
|
||||
{
|
||||
// Get input
|
||||
@@ -1847,7 +1847,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = nodes;
|
||||
break;
|
||||
}
|
||||
// Get Node Transform (local space)
|
||||
// Get Node Transform (local space)
|
||||
case 30:
|
||||
{
|
||||
// Get input
|
||||
@@ -1859,7 +1859,7 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
|
||||
value = Variant(Transform::Identity);
|
||||
break;
|
||||
}
|
||||
// Two Bone IK
|
||||
// Two Bone IK
|
||||
case 31:
|
||||
{
|
||||
// Get input
|
||||
@@ -2023,7 +2023,7 @@ void AnimGraphExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value& va
|
||||
return;
|
||||
switch (node->TypeID)
|
||||
{
|
||||
// Function Input
|
||||
// Function Input
|
||||
case 1:
|
||||
{
|
||||
// Find the function call
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
class FLAXENGINE_API InverseKinematics
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Rotates a node so it aims at a target. Solves the transformation (rotation) that needs to be applied to the node such that a provided forward vector (in node local space) aims at the target position (in skeleton model space).
|
||||
/// </summary>
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SceneAnimation final : public BinaryAsset
|
||||
{
|
||||
DECLARE_BINARY_ASSET_HEADER(SceneAnimation, 1);
|
||||
DECLARE_BINARY_ASSET_HEADER(SceneAnimation, 1);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The animation timeline track data.
|
||||
/// </summary>
|
||||
@@ -412,12 +411,10 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
BytesContainer _data;
|
||||
MemoryWriteStream _runtimeData;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The frames amount per second of the timeline animation.
|
||||
/// </summary>
|
||||
@@ -439,14 +436,12 @@ public:
|
||||
int32 TrackStatesCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the animation duration (in seconds).
|
||||
/// </summary>
|
||||
API_PROPERTY() float GetDuration() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the serialized timeline data.
|
||||
/// </summary>
|
||||
@@ -466,14 +461,12 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// [BinaryAsset]
|
||||
#if USE_EDITOR
|
||||
void GetReferences(Array<Guid>& output) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// [SceneAnimationBase]
|
||||
LoadResult load() override;
|
||||
void unload(bool isReloading) override;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/// </summary>
|
||||
API_CLASS() class FLAXENGINE_API SceneAnimationPlayer : public Actor, public IPostFxSettingsProvider
|
||||
{
|
||||
DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
|
||||
/// <summary>
|
||||
/// Describes the scene animation updates frequency.
|
||||
@@ -32,7 +32,6 @@ DECLARE_SCENE_OBJECT(SceneAnimationPlayer);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
enum class PlayState
|
||||
{
|
||||
Stopped,
|
||||
@@ -74,7 +73,6 @@ private:
|
||||
} _postFxSettings;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The scene animation to play.
|
||||
/// </summary>
|
||||
@@ -136,7 +134,6 @@ public:
|
||||
bool UsePrefabObjects = false;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value that determines whether the scene animation is playing.
|
||||
/// </summary>
|
||||
@@ -209,7 +206,6 @@ public:
|
||||
API_FUNCTION() void MapTrack(const StringView& from, const Guid& to);
|
||||
|
||||
private:
|
||||
|
||||
void Restore(SceneAnimation* anim, int32 stateIndexOffset);
|
||||
bool TickPropertyTrack(int32 trackIndex, int32 stateIndexOffset, SceneAnimation* anim, float time, const SceneAnimation::Track& track, TrackInstance& state, void* target);
|
||||
typedef Array<SceneAnimation*, FixedAllocation<8>> CallStack;
|
||||
@@ -219,7 +215,6 @@ private:
|
||||
void ResetState();
|
||||
|
||||
public:
|
||||
|
||||
// [Actor]
|
||||
bool HasContentLoaded() const override;
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
@@ -237,7 +232,6 @@ public:
|
||||
void Blend(PostProcessSettings& other, float weight) override;
|
||||
|
||||
protected:
|
||||
|
||||
// [Actor]
|
||||
void BeginPlay(SceneBeginData* data) override;
|
||||
void EndPlay() override;
|
||||
|
||||
Reference in New Issue
Block a user