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


C++ USkeletalMeshComponent::RefreshBoneTransforms方法代码示例

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


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

示例1: Update

void FFaceFXAnimationTrackInstance::Update(EMovieSceneUpdateData& UpdateData, const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, class IMovieScenePlayer& Player, FMovieSceneSequenceInstance& SequenceInstance)
{
	check(AnimationTrack);

	//Find the section to update
	UFaceFXAnimationSection* AnimSection = Cast<UFaceFXAnimationSection>(AnimationTrack->GetSectionAtTime(UpdateData.Position));
	if (!AnimSection || !AnimSection->IsActive())
	{
		StopAllPlayback(RuntimeObjects);
		CurrentActiveSection = nullptr;
		return;
	}

	const float PlaybackLocation = CalcPlaybackLocation(UpdateData.Position, AnimSection);

	//update the current anim section within this track
	const bool IsNewAnimSection = CurrentActiveSection != AnimSection;
	CurrentActiveSection = AnimSection;
	
	//update the assigned runtime objects for this track
	for (int32 i = 0; i < RuntimeObjects.Num(); ++i)
	{
		UObject* RuntimeObject = RuntimeObjects[i].Get();
		UFaceFXComponent* FaceFXComponent = GetFaceFXComponent(RuntimeObject);
		if (!FaceFXComponent)
		{
			continue;
		}

		//may be null if the skel mesh component id is unset and there is no character setup on the component
		USkeletalMeshComponent* SkelMeshTarget = FaceFXComponent->GetSkelMeshTarget(AnimSection->GetComponent());

		//Always stop when we switch track keys to prevent playing animations when switching backward after the end of another track animation
		//Thats because we don't check here how long the animation actually plays and rely on the JumpTo/Play functionality alone to determine that
		if (IsNewAnimSection)
		{
			FaceFXComponent->Stop(SkelMeshTarget);
		}

		const EMovieScenePlayerStatus::Type State = Player.GetPlaybackStatus();

		const bool bScrub = State != EMovieScenePlayerStatus::Playing;
		const bool bPaused = State == EMovieScenePlayerStatus::Stopped && UpdateData.Position == UpdateData.LastPosition;

		//playing backwards or jumping
		const FFaceFXAnimId& AnimId = AnimSection->GetAnimationId();

		bool UpdateAnimation = true;

		if (State == EMovieScenePlayerStatus::Playing)
		{
			//Playback mode
			if (!IsNewAnimSection && FaceFXComponent->IsPlaying(SkelMeshTarget, RuntimeObject))
			{
				//No need to updating the FaceFXComponent
				UpdateAnimation = false;
			}
		}

		if (UpdateAnimation)
		{
			bool JumpSucceeded = false;
			if (bPaused)
			{
				FaceFXComponent->Pause(SkelMeshTarget);
			}
			else
			{
				//jump if not stopping
				if (AnimId.IsValid())
				{
					//play by animation id
					JumpSucceeded = FaceFXComponent->JumpToById(PlaybackLocation, bScrub, AnimId.Group, AnimId.Name, false, SkelMeshTarget, RuntimeObject);
				}
				else if (UFaceFXAnim* FaceFXAnim = AnimSection->GetAnimation(FaceFXComponent))
				{
					//play by animation
					JumpSucceeded = FaceFXComponent->JumpTo(PlaybackLocation, bScrub, FaceFXAnim, false, SkelMeshTarget, RuntimeObject);
				}

				if (!JumpSucceeded)
				{
					//jump to failed -> i.e. out of range on non looping animation
					FaceFXComponent->Stop(SkelMeshTarget);
				}
			}
		}

		if (SkelMeshTarget)
		{
			//enforce an update on the bones to trigger blend nodes
			SkelMeshTarget->RefreshBoneTransforms();
		}
	}
}
开发者ID:jcredmond,项目名称:FaceFX-UE4,代码行数:95,代码来源:FaceFXAnimationTrackInstance.cpp


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