本文整理汇总了C++中FAnimationUpdateContext类的典型用法代码示例。如果您正苦于以下问题:C++ FAnimationUpdateContext类的具体用法?C++ FAnimationUpdateContext怎么用?C++ FAnimationUpdateContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FAnimationUpdateContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void FAnimationNode_TwoWayBlend::Update(const FAnimationUpdateContext& Context)
{
EvaluateGraphExposedInputs.Execute(Context);
const float ActualAlpha = AlphaScaleBias.ApplyTo(Alpha);
if (ActualAlpha > ZERO_ANIMWEIGHT_THRESH)
{
if (ActualAlpha < 1.0f - ZERO_ANIMWEIGHT_THRESH)
{
// Blend A and B together
A.Update(Context.FractionalWeight(1.0f - ActualAlpha));
B.Update(Context.FractionalWeight(ActualAlpha));
}
else
{
// Take all of B
B.Update(Context);
}
}
else
{
// Take all of A
A.Update(Context);
}
}
示例2: UpdateAssetPlayer
void FAnimNode_AbilityAnimPlayer::UpdateAssetPlayer(const FAnimationUpdateContext& Context)
{
EvaluateGraphExposedInputs.Execute(Context);
if (m_SequenceToPlay && m_SequenceToPlay->SequenceLength - InternalTimeAccumulator < KINDA_SMALL_NUMBER)
{
if (m_NextSequence)
{
SwapToNextSequence();
}
else
{
m_SequenceToPlay = nullptr;
}
}
if (m_SequenceToPlay && Context.AnimInstanceProxy->IsSkeletonCompatible(m_SequenceToPlay->GetSkeleton()))
{
if (m_NextSequence && m_NextSequenceBlendIn.IsComplete())
{
SwapToNextSequence();
}
InternalTimeAccumulator = FMath::Clamp(InternalTimeAccumulator, 0.f, m_SequenceToPlay->SequenceLength);
if (m_NextSequence)
{
m_NextSequenceBlendIn.Update(Context.GetDeltaTime());
m_NextSequenceInternalTimeAccumulator += Context.GetDeltaTime();
m_NextSequenceInternalTimeAccumulator = FMath::Clamp(m_NextSequenceInternalTimeAccumulator, 0.0f, m_NextSequence->SequenceLength);
}
if (FAnimInstanceProxy* Proxy = Context.AnimInstanceProxy)
{
FAnimGroupInstance* SyncGroup;
FAnimTickRecord& SequenceTickRecord = Proxy->CreateUninitializedTickRecord(NAME_None, SyncGroup);
float CurrentBlendValue = m_NextSequenceBlendIn.GetBlendedValue();
float SequenceBlendRate = m_NextSequence ? 1.0f - CurrentBlendValue : 1.0f;
Proxy->MakeSequenceTickRecord(SequenceTickRecord, const_cast<UAnimSequence*>(m_SequenceToPlay), false, m_PlayRate, SequenceBlendRate, InternalTimeAccumulator, MarkerTickRecord);
if (m_NextSequence)
{
FAnimTickRecord& NextSequenceTickRecord = Proxy->CreateUninitializedTickRecord(NAME_None, SyncGroup);
Proxy->MakeSequenceTickRecord(NextSequenceTickRecord, const_cast<UAnimSequence*>(m_NextSequence), false, m_NextPlayRate, CurrentBlendValue, m_NextSequenceInternalTimeAccumulator, m_NextSequenceMarkerTickRecord);
}
}
//CreateTickRecordForNode(Context, const_cast<UAnimSequence*>(m_SequenceToPlay), false, m_PlayRate);
}
else if (m_CachedOutputSequence && Context.AnimInstanceProxy->IsSkeletonCompatible(m_CachedOutputSequence->GetSkeleton()))
{
InternalTimeAccumulator = FMath::Clamp(InternalTimeAccumulator, 0.0f, m_CachedOutputSequence->SequenceLength);
if (FAnimInstanceProxy* Proxy = Context.AnimInstanceProxy)
{
FAnimGroupInstance* SyncGroup;
FAnimTickRecord& SequenceTickRecord = Proxy->CreateUninitializedTickRecord(NAME_None, SyncGroup);
Proxy->MakeSequenceTickRecord(SequenceTickRecord, const_cast<UAnimSequence*>(m_CachedOutputSequence), false, m_PlayRate, 1.0, InternalTimeAccumulator, MarkerTickRecord);
}
}
}
示例3: Update
void FAnimationActiveTransitionEntry::Update(const FAnimationUpdateContext& Context, int32 CurrentStateIndex, bool& bOutFinished)
{
bOutFinished = false;
// Advance time
if (bActive)
{
ElapsedTime += Context.GetDeltaTime();
Blend.Update(Context.GetDeltaTime());
float QueryAlpha = 1.0f;
// If non-zero, calculate the query alpha
if (CrossfadeDuration > 0.0f)
{
QueryAlpha = ElapsedTime / CrossfadeDuration;
}
Alpha = FAlphaBlend::AlphaToBlendOption(QueryAlpha, Blend.GetBlendOption(), Blend.GetCustomCurve());
if(Blend.IsComplete())
{
bActive = false;
bOutFinished = true;
}
// Update state blend data (only when we're using per-bone)
if(BlendProfile)
{
for(int32 Idx = 0 ; Idx < 2 ; ++Idx)
{
bool bForwards = Idx == 0;
FBlendSampleData& CurrentData = StateBlendData[Idx];
CurrentData.TotalWeight = (bForwards) ? Alpha : 1.0f - Alpha;
for(int32 PerBoneIndex = 0 ; PerBoneIndex < CurrentData.PerBoneBlendData.Num() ; ++PerBoneIndex)
{
float& BoneBlend = CurrentData.PerBoneBlendData[PerBoneIndex];
float WeightScale = BlendProfile->GetEntryBlendScale(PerBoneIndex);
if(!bForwards)
{
WeightScale = 1.0f / WeightScale;
}
BoneBlend = CurrentData.TotalWeight * WeightScale;
}
}
FBlendSampleData::NormalizeDataWeight(StateBlendData);
}
}
}
示例4: UpdateAssetPlayer
void FAnimNode_SequencePlayer::UpdateAssetPlayer(const FAnimationUpdateContext& Context)
{
EvaluateGraphExposedInputs.Execute(Context);
if ((Sequence != NULL) && (Context.AnimInstance->CurrentSkeleton->IsCompatible(Sequence->GetSkeleton())))
{
const float FinalBlendWeight = Context.GetFinalBlendWeight();
// Create a tick record and fill it out
FAnimGroupInstance* SyncGroup;
FAnimTickRecord& TickRecord = Context.AnimInstance->CreateUninitializedTickRecord(GroupIndex, /*out*/ SyncGroup);
if (InternalTimeAccumulator > Sequence->SequenceLength)
{
InternalTimeAccumulator = 0.f;
}
Context.AnimInstance->MakeSequenceTickRecord(TickRecord, Sequence, bLoopAnimation, PlayRate, FinalBlendWeight, /*inout*/ InternalTimeAccumulator);
// Update the sync group if it exists
if (SyncGroup != NULL)
{
SyncGroup->TestTickRecordForLeadership(GroupRole);
}
}
}
示例5: Update
void FAnimationActiveTransitionEntry::Update(const FAnimationUpdateContext& Context, int32 CurrentStateIndex, bool& bOutFinished)
{
bOutFinished = false;
// Advance time
if (bActive)
{
ElapsedTime += Context.GetDeltaTime();
if (ElapsedTime >= CrossfadeDuration)
{
bActive = false;
bOutFinished = true;
}
if(CrossfadeDuration <= 0.0f)
{
Alpha = 1.0f;
}
else
{
Alpha = CalculateAlpha(ElapsedTime / CrossfadeDuration);
}
}
}
示例6: Update
void FAnimNode_SpringBone::Update(const FAnimationUpdateContext& Context)
{
FAnimNode_SkeletalControlBase::Update(Context);
RemainingTime += Context.GetDeltaTime();
const USkeletalMeshComponent* SkelComp = Context.AnimInstance->GetSkelMeshComponent();
const UWorld* World = SkelComp->GetWorld();
check(World->GetWorldSettings());
// Fixed step simulation at 120hz
FixedTimeStep = (1.f / 120.f) * World->GetWorldSettings()->GetEffectiveTimeDilation();
}
示例7: UpdateTransitionStates
void FAnimNode_StateMachine::UpdateTransitionStates(const FAnimationUpdateContext& Context, FAnimationActiveTransitionEntry& Transition)
{
if (Transition.bActive)
{
switch (Transition.LogicType)
{
case ETransitionLogicType::TLT_StandardBlend:
{
// update both states
UpdateState(Transition.PreviousState, Context.FractionalWeight(1.0f - Transition.Alpha));
UpdateState(Transition.NextState, Context.FractionalWeight(Transition.Alpha));
}
break;
case ETransitionLogicType::TLT_Custom:
{
if (Transition.CustomTransitionGraph.LinkID != INDEX_NONE)
{
Transition.CustomTransitionGraph.Update(Context);
for (TArray<FAnimNode_TransitionPoseEvaluator*>::TIterator PoseEvaluatorListIt = Transition.PoseEvaluators.CreateIterator(); PoseEvaluatorListIt; ++PoseEvaluatorListIt)
{
FAnimNode_TransitionPoseEvaluator* Evaluator = *PoseEvaluatorListIt;
if (Evaluator->InputNodeNeedsUpdate())
{
const bool bUsePreviousState = (Evaluator->DataSource == EEvaluatorDataSource::EDS_SourcePose);
const int32 EffectiveStateIndex = bUsePreviousState ? Transition.PreviousState : Transition.NextState;
UpdateState(EffectiveStateIndex, Context);
}
}
}
}
break;
default:
break;
}
}
}
示例8: InitializeCustomGraphLinks
void FAnimationActiveTransitionEntry::InitializeCustomGraphLinks(const FAnimationUpdateContext& Context, const FBakedStateExitTransition& TransitionRule)
{
if (TransitionRule.CustomResultNodeIndex != INDEX_NONE)
{
const UAnimBlueprintGeneratedClass* AnimBlueprintClass = Context.GetAnimBlueprintClass();
CustomTransitionGraph.LinkID = AnimBlueprintClass->AnimNodeProperties.Num() - 1 - TransitionRule.CustomResultNodeIndex; //@TODO: Crazysauce
FAnimationInitializeContext InitContext(Context.AnimInstance);
CustomTransitionGraph.Initialize(InitContext);
for (int32 Index = 0; Index < TransitionRule.PoseEvaluatorLinks.Num(); ++Index)
{
FAnimNode_TransitionPoseEvaluator* PoseEvaluator = GetNodeFromPropertyIndex<FAnimNode_TransitionPoseEvaluator>(Context.AnimInstance, AnimBlueprintClass, TransitionRule.PoseEvaluatorLinks[Index]);
PoseEvaluators.Add(PoseEvaluator);
}
}
}
示例9: Update
void FAnimNode_ApplyMeshSpaceAdditive::Update(const FAnimationUpdateContext& Context)
{
Base.Update(Context);
ActualAlpha = 0.f;
if (IsLODEnabled(Context.AnimInstanceProxy, LODThreshold))
{
// @note: If you derive this class, and if you have input that you rely on for base
// this is not going to work
EvaluateGraphExposedInputs.Execute(Context);
ActualAlpha = AlphaScaleBias.ApplyTo(Alpha);
if (FAnimWeight::IsRelevant(ActualAlpha))
{
Additive.Update(Context.FractionalWeight(ActualAlpha));
}
}
}
示例10: Update
void FPoseLinkBase::Update(const FAnimationUpdateContext& Context)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FPoseLinkBase_Update);
#if DO_CHECK
checkf( !bProcessed, TEXT( "Update already in progress, circular link for AnimInstance [%s] Blueprint [%s]" ), \
*Context.AnimInstanceProxy->GetAnimInstanceName(), *GetFullNameSafe(IAnimClassInterface::GetActualAnimClass(Context.AnimInstanceProxy->GetAnimClassInterface())));
TGuardValue<bool> CircularGuard(bProcessed, true);
#endif
#if WITH_EDITOR
if (GIsEditor)
{
if (LinkedNode == NULL)
{
//@TODO: Should only do this when playing back
AttemptRelink(Context);
}
// Record the node line activation
if (LinkedNode != NULL)
{
if (Context.AnimInstanceProxy->IsBeingDebugged())
{
Context.AnimInstanceProxy->RecordNodeVisit(LinkID, SourceLinkID, Context.GetFinalBlendWeight());
}
}
}
#endif
#if ENABLE_ANIMGRAPH_TRAVERSAL_DEBUG
checkf(InitializationCounter.IsSynchronizedWith(Context.AnimInstanceProxy->GetInitializationCounter()), TEXT("Calling Update without initialization!"));
UpdateCounter.SynchronizeWith(Context.AnimInstanceProxy->GetUpdateCounter());
#endif
if (LinkedNode != NULL)
{
LinkedNode->Update(Context);
}
}
示例11: Update
void FAnimNode_QueuedSequencePlayer::Update(const FAnimationUpdateContext& Context)
{
EvaluateGraphExposedInputs.Execute(Context);
if (CurrentSequence == nullptr ||
(NextSequence != nullptr && (InternalTimeAccumulator + SMALL_NUMBER >= CurrentSequence->SequenceLength || LastInternalTimeAccumulator > InternalTimeAccumulator)))
{
CurrentSequence = NextSequence;
InternalTimeAccumulator = 0;
}
if ((CurrentSequence != NULL) && (Context.AnimInstanceProxy->GetSkeleton()->IsCompatible(CurrentSequence->GetSkeleton())))
{
const float fTriggerTime = FMath::Max(0.f, CurrentSequence->SequenceLength - EndOfPlayEventTime);
if (LastInternalTimeAccumulator < fTriggerTime && InternalTimeAccumulator >= fTriggerTime)
{
UAnimInstance* Instance = Context.AnimInstanceProxy->GetSkelMeshComponent()->GetAnimInstance();
UFunction* EOPFunc = Instance->FindFunction(EndOfPlayEvent);
if (EOPFunc != nullptr)
{
Instance->ProcessEvent(EOPFunc, nullptr);
}
}
const float FinalBlendWeight = Context.GetFinalBlendWeight();
// Create a tick record and fill it out
UAnimInstance* Instance = Context.AnimInstanceProxy->GetSkelMeshComponent()->GetAnimInstance();
FAnimGroupInstance* SyncGroup;
FAnimTickRecord& TickRecord = Context.AnimInstanceProxy->CreateUninitializedTickRecord(INDEX_NONE, /*out*/ SyncGroup);
Context.AnimInstanceProxy->MakeSequenceTickRecord(TickRecord, CurrentSequence, false, 1.0, FinalBlendWeight, /*inout*/ InternalTimeAccumulator, *TickRecord.MarkerTickRecord);
}
LastInternalTimeAccumulator = InternalTimeAccumulator;
}
示例12: InitializeCustomGraphLinks
void FAnimationActiveTransitionEntry::InitializeCustomGraphLinks(const FAnimationUpdateContext& Context, const FBakedStateExitTransition& TransitionRule)
{
if (TransitionRule.CustomResultNodeIndex != INDEX_NONE)
{
const IAnimClassInterface* AnimBlueprintClass = Context.GetAnimClass();
CustomTransitionGraph.LinkID = AnimBlueprintClass->GetAnimNodeProperties().Num() - 1 - TransitionRule.CustomResultNodeIndex; //@TODO: Crazysauce
FAnimationInitializeContext InitContext(Context.AnimInstanceProxy);
CustomTransitionGraph.Initialize(InitContext);
for (int32 Index = 0; Index < TransitionRule.PoseEvaluatorLinks.Num(); ++Index)
{
FAnimNode_TransitionPoseEvaluator* PoseEvaluator = GetNodeFromPropertyIndex<FAnimNode_TransitionPoseEvaluator>(Context.AnimInstanceProxy->GetAnimInstanceObject(), AnimBlueprintClass, TransitionRule.PoseEvaluatorLinks[Index]);
PoseEvaluators.Add(PoseEvaluator);
}
}
// Initialize blend data if necessary
if(BlendProfile)
{
StateBlendData.AddZeroed(2);
StateBlendData[0].PerBoneBlendData.AddZeroed(BlendProfile->GetNumBlendEntries());
StateBlendData[1].PerBoneBlendData.AddZeroed(BlendProfile->GetNumBlendEntries());
}
}
示例13: UpdateInternal
void FAnimNode_BlendSpacePlayer::UpdateInternal(const FAnimationUpdateContext& Context)
{
if ((BlendSpace != NULL) && (Context.AnimInstanceProxy->IsSkeletonCompatible(BlendSpace->GetSkeleton())))
{
// Create a tick record and fill it out
FAnimGroupInstance* SyncGroup;
FAnimTickRecord& TickRecord = Context.AnimInstanceProxy->CreateUninitializedTickRecord(GroupIndex, /*out*/ SyncGroup);
const FVector BlendInput(X, Y, Z);
if (PreviousBlendSpace != BlendSpace)
{
Reinitialize();
}
Context.AnimInstanceProxy->MakeBlendSpaceTickRecord(TickRecord, BlendSpace, BlendInput, BlendSampleDataCache, BlendFilter, bLoop, PlayRate, Context.GetFinalBlendWeight(), /*inout*/ InternalTimeAccumulator, MarkerTickRecord);
// Update the sync group if it exists
if (SyncGroup != NULL)
{
SyncGroup->TestTickRecordForLeadership(GroupRole);
}
PreviousBlendSpace = BlendSpace;
}
}
示例14: Update
void FAnimNode_Trail::Update(const FAnimationUpdateContext& Context)
{
FAnimNode_SkeletalControlBase::Update(Context);
ThisTimstep = Context.GetDeltaTime();
}
示例15: Update
void FAnimNode_LookAt::Update(const FAnimationUpdateContext& Context)
{
FAnimNode_SkeletalControlBase::Update(Context);
AccumulatedInterpoolationTime = FMath::Clamp(AccumulatedInterpoolationTime+Context.GetDeltaTime(), 0.f, InterpolationTime);;
}