void FAnimNode_StateMachine::EvaluateTransitionStandardBlend(FPoseContext& Output,FAnimationActiveTransitionEntry& Transition, bool bIntermediatePoseIsValid)
{	
	FPoseContext PreviouseStateResult(Output);
	FPoseContext NextStateResult(Output);

	if (bIntermediatePoseIsValid)
	{
		Output.AnimInstance->CopyPose(Output.Pose, PreviouseStateResult.Pose);
	}
	else
	{
		EvaluateState(Transition.PreviousState, PreviouseStateResult);
	}

	// evaluate the next state
	EvaluateState(Transition.NextState, NextStateResult);

	// Blend it in
	const ScalarRegister VPreviousWeight(1.0f - Transition.Alpha);
	const ScalarRegister VWeight(Transition.Alpha);
	for (FCompactPoseBoneIndex BoneIndex : Output.Pose.ForEachBoneIndex())
	{
		Output.Pose[BoneIndex] = PreviouseStateResult.Pose[BoneIndex] * VPreviousWeight;
		Output.Pose[BoneIndex].AccumulateWithShortestRotation(NextStateResult.Pose[BoneIndex], VWeight);
	}
}
Exemplo n.º 2
0
void FAnimNode_StateMachine::EvaluateTransitionStandardBlend(FPoseContext& Output,FAnimationActiveTransitionEntry& Transition, bool bIntermediatePoseIsValid)
{	
	FPoseContext PreviouseStateResult(Output);
	FPoseContext NextStateResult(Output);

	if (bIntermediatePoseIsValid)
	{
		Output.AnimInstance->CopyPose(Output.Pose, PreviouseStateResult.Pose);
	}
	else
	{
		EvaluateState(Transition.PreviousState, PreviouseStateResult);
	}

	// evaluate the next state
	EvaluateState(Transition.NextState, NextStateResult);

	// Blend it in
	const ScalarRegister VPreviousWeight(1.0f - Transition.Alpha);
	const ScalarRegister VWeight(Transition.Alpha);
	const TArray<FBoneIndexType> & RequiredBoneIndices = Output.AnimInstance->RequiredBones.GetBoneIndicesArray();
	for (int32 j = 0; j < RequiredBoneIndices.Num(); ++j)
	{
		const int32 BoneIndex = RequiredBoneIndices[j];
		Output.Pose.Bones[BoneIndex] = PreviouseStateResult.Pose.Bones[BoneIndex] * VPreviousWeight;
		Output.Pose.Bones[BoneIndex].AccumulateWithShortestRotation(NextStateResult.Pose.Bones[BoneIndex], VWeight);
	}
}