State machine - possible to control Blend duration from Blend Graph?

When using custom “Blend Logic” in the state machine, is there some way how to control the Blend Duration from the Blend Graph itself?

For example, let’s say I use custom transition animation for the blend and I would like the Blend Duration to match the animation duration. Something along the line “get animation duration, then send it to Blend Duration time” in the transition would be very useful.

Maintaining correct blend times for animations which can change slightly during the project could be tedious and error prone.

Hey ,

when you click on a transition icon you can chose in the detail panel under ‘Transition’ ‘Blend Logic’'.

If you choose ‘Custom’ scroll down to the ‘BlendSettings’ and click on ‘Edit BlendGraph’.

Hi,

thanks but maybe you misunderstood my question or I wasn’t clear enough because I’m already using “Custom” blend logic and I’m asking for a way to control it’s duration from within the custom blend graph.

Your right, I misread the question.

However, it looks like this could be possible with a heavy workaround only. You would need an extra float variable only for this transition and change it over time based on some logic in your anim event graph.

Furthermore you could retrieve the animation length with this here: Get Length | Unreal Engine Documentation or pre-set it with another float.

This could be especially tricky if you would want to change the animation.

For this reason I created a AnimDataComponent for my characters which holds AnimSequences Data for all of my needed animation. Then I supply my animation graph with this anim data and have a more swapable state machine.

Hope it helps. How are you currently working around it?

Currently I’m not working on that particular feature, but I was setting up the transition time manually.

Blending doesn’t work from within state machine in 4.10, you will either need to code your own or figure out some other work around.

Hehe, I come from the future with UE 5.5, and here is my work around,

I create a custom AnimInstance in C++, and inside NativeThreadSafeUpdateAnimation() function, call these following lines of code:

inline static FAnimationTransitionBetweenStates* GetTransitionInfo(const FAnimNode_StateMachine* stateMachine, const FName& srcStateName, const FName& destStateName)
{
	auto srcState = (FBakedAnimationState*)&stateMachine->GetStateInfo(stateMachine->GetStateIndex(srcStateName));
	auto& transitions = srcState->Transitions;
	for (auto& t : transitions)
	{
		auto transitionInfo = (FAnimationTransitionBetweenStates*)&stateMachine->GetTransitionInfo(t.TransitionIndex);
		auto destInfo = (FBakedAnimationState*)&stateMachine->GetStateInfo(transitionInfo->NextState);
		if (destInfo->StateName == destStateName)
		{
			return transitionInfo;
		}
	}
	
	return nullptr;
}

auto info = GetTransitionInfo(m_bodyStateMachine, "Move", "Idle");

// change it here :D
info->CrossfadeDuration = 1.0f;

Hope it help someone!