当前位置: 首页>>代码示例>>C++>>正文


C++ FAnimationUpdateContext::GetDeltaTime方法代码示例

本文整理汇总了C++中FAnimationUpdateContext::GetDeltaTime方法的典型用法代码示例。如果您正苦于以下问题:C++ FAnimationUpdateContext::GetDeltaTime方法的具体用法?C++ FAnimationUpdateContext::GetDeltaTime怎么用?C++ FAnimationUpdateContext::GetDeltaTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FAnimationUpdateContext的用法示例。


在下文中一共展示了FAnimationUpdateContext::GetDeltaTime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
		}
	}
}
开发者ID:zpzsoft,项目名称:zpzsoft.github.io,代码行数:58,代码来源:AnimNode_AbilityAnimPlayer.cpp

示例2: 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);
		}
	}
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:54,代码来源:AnimNode_StateMachine.cpp

示例3: 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);
		}

	}
}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:25,代码来源:AnimNode_StateMachine.cpp

示例4: 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();
}
开发者ID:johndpope,项目名称:UE4,代码行数:12,代码来源:AnimNode_SpringBone.cpp

示例5: Update

void FAnimNode_Trail::Update(const FAnimationUpdateContext& Context)
{
	FAnimNode_SkeletalControlBase::Update(Context);

	ThisTimstep = Context.GetDeltaTime();
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:6,代码来源:AnimNode_Trail.cpp

示例6: Update

void FAnimNode_LookAt::Update(const FAnimationUpdateContext& Context)
{
	FAnimNode_SkeletalControlBase::Update(Context);

	AccumulatedInterpoolationTime = FMath::Clamp(AccumulatedInterpoolationTime+Context.GetDeltaTime(), 0.f, InterpolationTime);;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:6,代码来源:AnimNode_LookAt.cpp

示例7: UpdateInternal

void FAnimNode_AnimDynamics::UpdateInternal(const FAnimationUpdateContext& Context)
{
	FAnimNode_SkeletalControlBase::UpdateInternal(Context);

	NextTimeStep = Context.GetDeltaTime();
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:6,代码来源:AnimNode_AnimDynamics.cpp

示例8: Update

void FAnimNode_BlendListBase::Update(const FAnimationUpdateContext& Context)
{
	EvaluateGraphExposedInputs.Execute(Context);

	const int NumPoses = BlendPose.Num();
	checkSlow((BlendTime.Num() == NumPoses) && (BlendWeights.Num() == NumPoses));

	if (NumPoses > 0)
	{
		// Handle a change in the active child index; adjusting the target weights
		const int32 ChildIndex = GetActiveChildIndex();

		if (ChildIndex != LastActiveChildIndex)
		{
			bool LastChildIndexIsInvalid = (LastActiveChildIndex == INDEX_NONE);
			LastActiveChildIndex = ChildIndex;

			const float CurrentWeight = BlendWeights[ChildIndex];
			const float DesiredWeight = 1.0f;
			const float WeightDifference = FMath::Clamp<float>(FMath::Abs<float>(DesiredWeight - CurrentWeight), 0.0f, 1.0f);

			// scale by the weight difference since we want always consistency:
			// - if you're moving from 0 to full weight 1, it will use the normal blend time
			// - if you're moving from 0.5 to full weight 1, it will get there in half the time
			const float RemainingBlendTime = LastChildIndexIsInvalid ? 0.0f : ( BlendTime[ChildIndex] * WeightDifference );

			for (int32 i = 0; i < RemainingBlendTimes.Num(); ++i)
			{
				RemainingBlendTimes[i] = RemainingBlendTime;
			}
		}

		// Advance the weights
		//@TODO: This means we advance even in a frame where the target weights/times just got modified; is that desirable?
		float SumWeight = 0.0f;
		for (int32 i = 0; i < RemainingBlendTimes.Num(); ++i)
		{
			float& RemainingBlendTime = RemainingBlendTimes[i];
			float& BlendWeight = BlendWeights[i];

			const float DesiredWeight = (i == ChildIndex) ? 1.0f : 0.0f;

			FAnimationRuntime::TickBlendWeight(Context.GetDeltaTime(), DesiredWeight, BlendWeight, RemainingBlendTime);

			SumWeight += BlendWeight;
		}

		// Renormalize the weights
		if ((SumWeight > ZERO_ANIMWEIGHT_THRESH) && (FMath::Abs<float>(SumWeight - 1.0f) > ZERO_ANIMWEIGHT_THRESH))
		{
			float ReciprocalSum = 1.0f / SumWeight;
			for (int32 i = 0; i < BlendWeights.Num(); ++i)
			{
				BlendWeights[i] *= ReciprocalSum;
			}
		}

		// Update our active children
		for (int32 i = 0; i < BlendPose.Num(); ++i)
		{
			const float BlendWeight = BlendWeights[i];
			if (BlendWeight > ZERO_ANIMWEIGHT_THRESH)
			{
				BlendPose[i].Update(Context.FractionalWeight(BlendWeight));
			}
		}
	}
}
开发者ID:johndpope,项目名称:UE4,代码行数:68,代码来源:AnimNode_BlendListBase.cpp


注:本文中的FAnimationUpdateContext::GetDeltaTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。