FBoneContainer::GetPoseBoneIndexForBoneName() crashed in UnrealEditor

Hello, Unreal pros,

I’m trying to do some bone control in AnimInstance instead of AnimBlueprint to simplify the pipeline.
I use following code in a function to retrieve the bone index details:

FAnimInstanceProxy *curAnimInstProxy = &GetProxyOnAnyThread<FAnimInstanceProxy>();
FComponentSpacePoseContext compSpacePoseContext = FComponentSpacePoseContext( curAnimInstProxy );
const FBoneContainer& boneContainer = compSpacePoseContext.Pose.GetPose().GetBoneContainer();
FBoneReference rootBone;
rootBone.BoneIndex = boneContainer.GetPoseBoneIndexForBoneName( rootBoneName );

But it will crash instantly when I try it in Editor.
The GetPoseBoneIndexForBoneName() cause Segmentation Fault, while the input name is checked and valid.
Is there any misunderstanding about those API? Do you know how to retrieve this info correctly?

Thank you.

Do you have a working blueprint sample? I’d have a better understanding of the code with it.

Hi,
Thank you for reaching out first.
It’s a test drive so I put it into EventGraph of AnimBlueprint like this:


Feel free to ask more details if it might help.

Thanks.

I think you might have misunderstood?

I was asking if you had the above coded in blueprint instead which is working.

Hi,
Sorry that I don’t have above code in working blueprint.
The closest thing is FABRIK node in AnimGraph.
But here, I want to retrieve the pose and bone information by FAnimInstanceProxy.

Thank you.

I’ll see if I can get it working.

1 Like
const FBoneContainer& BoneContainer = GetRequiredBonesOnAnyThread();
const int32 Index = BoneContainer.GetPoseBoneIndexForBoneName(BoneName);

This appears to work.

Thank you. DanM
I’m busy with alternative approach. I will revisit this approach later.
Consider it closed.

Privacy & Terms