70 lines
2.6 KiB
C++
70 lines
2.6 KiB
C++
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "BoneContainer.h"
|
|
#include "BonePose.h"
|
|
#include "BoneControllers/AnimNode_ModifyBone.h"
|
|
#include "Misc/EngineVersionComparison.h"
|
|
|
|
#include "AnimNode_VrmConstraint.generated.h"
|
|
|
|
class UVrmMetaObject;
|
|
class UVrmAssetListObject;
|
|
|
|
/**
|
|
* Simple controller that replaces or adds to the translation/rotation of a single bone.
|
|
*/
|
|
USTRUCT(BlueprintInternalUseOnly)
|
|
struct VRM4U_API FAnimNode_VrmConstraint : public FAnimNode_SkeletalControlBase
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Skeleton, meta = (PinHiddenByDefault))
|
|
bool EnableAutoSearchMetaData = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Skeleton, meta=(PinHiddenByDefault))
|
|
const UVrmMetaObject *VrmMetaObject = nullptr;
|
|
|
|
#if UE_VERSION_OLDER_THAN(5,0,0)
|
|
TAssetPtr<UVrmMetaObject> VrmMetaObject_Internal = nullptr;
|
|
TAssetPtr<UVrmAssetListObject> VrmAssetListObject_Internal = nullptr;
|
|
#else
|
|
TSoftObjectPtr<UVrmMetaObject> VrmMetaObject_Internal = nullptr;
|
|
TSoftObjectPtr<UVrmAssetListObject> VrmAssetListObject_Internal = nullptr;
|
|
#endif
|
|
|
|
|
|
bool bCallInitialized = false;
|
|
|
|
bool bCallByAnimInstance = false;
|
|
|
|
FAnimNode_VrmConstraint();
|
|
|
|
void UpdateCache(FComponentSpacePoseContext& Output);
|
|
|
|
// FAnimNode_Base interface
|
|
virtual void GatherDebugData(FNodeDebugData& DebugData) override;
|
|
// End of FAnimNode_Base interface
|
|
|
|
// FAnimNode_SkeletalControlBase interface
|
|
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
|
|
virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
|
|
// virtual void Update_AnyThread(const FAnimationUpdateContext& Context) override;
|
|
virtual void EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms) override;
|
|
virtual void EvaluateComponentPose_AnyThread(FComponentSpacePoseContext& Output) override;
|
|
virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) override;
|
|
|
|
virtual void UpdateInternal(const FAnimationUpdateContext& Context)override;
|
|
// End of FAnimNode_SkeletalControlBase interface
|
|
|
|
virtual void ConditionalDebugDraw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent* PreviewSkelMeshComp, bool bPreviewForeground = false) const;
|
|
|
|
private:
|
|
// FAnimNode_SkeletalControlBase interface
|
|
virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones) override;
|
|
// End of FAnimNode_SkeletalControlBase interface
|
|
};
|