本文整理汇总了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();
}
}
}