Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/AnimNodes/AnimNode_ModifyCurve.h
Thomas Sarkanen 502797ca50 Animation Curve Runtime & Editor Improvements
Runtime notes:
- Removes 'smart name' usage across the animation systems.
- Changed curve blending from a uniform array (sized per skeleton) to a sparse array of sorted named values. Blends and other combiners are performed using a dual iteration 'tape merge'.
- Skeleton curves are no longer guaranteed to cover all curve names that can be found at runtime.

Editor notes:
- Curve metadata (flags, bone links etc.) is still present on the skeleton, but can also now exist on a skeletal mesh
- Curve metadata (for morph targets) is still populated on import
- Curves can now be used arbitrarily at runtime

New features:
- New Find/Replace dialog that allows for batch-replacing curves and notifies across all of a project's assets
- New curve debugger tab in various Persona editors that allows for viewing curve values live. This also now allows viewing curves for specific pose watches.
- Pose watches now output curve tracks to the Rewind Debugger

#rb Jurre.deBaare,Nicholas.Frechette,Sara.Schvartzman,Helge.Mathee,Kiaran.Ritchie,Jaime.Cifuentes,Martin.Wilson,Keith.Yerex,Andrean.Franc (and more!)
#jira UE-167776
#jira UE-173716
#jira UE-110407
#preflight 63fc98c81206d91a2bc3ab90
#preflight 63f3ad4f81646f1f24c240c2

[CL 24421496 by Thomas Sarkanen in ue5-main branch]
2023-02-27 07:20:58 -05:00

89 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Animation/AnimNodeBase.h"
#include "AnimNode_ModifyCurve.generated.h"
UENUM()
enum class EModifyCurveApplyMode : uint8
{
/** Add new value to input curve value */
Add,
/** Scale input value by new value */
Scale,
/** Blend input with new curve value, using Alpha setting on the node */
Blend,
/** Blend the new curve value with the last curve value using Alpha to determine the weighting (.5 is a moving average, higher values react to new values faster, lower slower) */
WeightedMovingAverage,
/** Remaps the new curve value between the CurveValues entry and 1.0 (.5 in CurveValues makes 0.51 map to 0.02) */
RemapCurve
};
/** Easy way to modify curve values on a pose */
USTRUCT(BlueprintInternalUseOnly)
struct ANIMGRAPHRUNTIME_API FAnimNode_ModifyCurve : public FAnimNode_Base
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, EditFixedSize, BlueprintReadWrite, Category = Links)
FPoseLink SourcePose;
UPROPERTY(EditAnywhere, BlueprintReadWrite, editfixedsize, Category = ModifyCurve, meta = (PinHiddenByDefault))
TMap<FName, float> CurveMap;
UPROPERTY(EditAnywhere, BlueprintReadWrite, editfixedsize, Category = ModifyCurve, meta = (BlueprintCompilerGeneratedDefaults, PinShownByDefault))
TArray<float> CurveValues;
UPROPERTY(meta = (BlueprintCompilerGeneratedDefaults))
TArray<FName> CurveNames;
UE_DEPRECATED(5.3, "LastCurveValues is no longer used.")
TArray<float> LastCurveValues;
UE_DEPRECATED(5.3, "LastCurveMapValues is no longer used.")
TMap<FName, float> LastCurveMapValues;
UE_DEPRECATED(5.3, "bInitializeLastValuesMap is no longer used.")
bool bInitializeLastValuesMap;
FBlendedHeapCurve LastCurve;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ModifyCurve, meta = (PinShownByDefault))
float Alpha;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ModifyCurve)
EModifyCurveApplyMode ApplyMode;
FAnimNode_ModifyCurve();
PRAGMA_DISABLE_DEPRECATION_WARNINGS
FAnimNode_ModifyCurve(const FAnimNode_ModifyCurve&) = default;
FAnimNode_ModifyCurve& operator=(const FAnimNode_ModifyCurve&) = default;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
// FAnimNode_Base interface
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
virtual void Evaluate_AnyThread(FPoseContext& Output) override;
virtual void Update_AnyThread(const FAnimationUpdateContext& Context) override;
// End of FAnimNode_Base interface
#if WITH_EDITOR
/** Add new curve being modified */
void AddCurve(const FName& InName, float InValue);
/** Remove a curve from being modified */
void RemoveCurve(int32 PoseIndex);
#endif // WITH_EDITOR
private:
float ProcessCurveOperation(float CurrentValue, float NewValue) const;
float ProcessCurveWMAOperation(float CurrentValue, float LastValue) const;
};