BakeToControlRig assert

As a temporary workaround, we added another lookup so that the Find and Contains checks will work with original names

in URigHierarchyController::AddElement

if(!InDesiredName.IsNone() &&

!InElementToAdd->GetFName().IsEqual(DesiredName.GetFName(), ENameCase::CaseSensitive))

{

Hierarchy->SetNameMetadata(InElementToAdd->Key, URigHierarchy::DesiredNameMetadataName, DesiredName.GetFName());

Hierarchy->SetRigElementKeyMetadata(InElementToAdd->Key, URigHierarchy::DesiredKeyMetadataName, FRigElementKey(DesiredName.GetFName(), InElementToAdd->Key.Type));

// DIVERGENCE_START

FRigElementKey Key2(InDesiredName, InElementToAdd->GetType());

if (!Hierarchy->Contains(Key2))

{

Hierarchy->IndexLookup.Add(Key2, InElementToAdd->Index);

}

// DIVERGENCE_END

}

Please let us know if there is a better solution or another changelist we can preport.

Steps to Reproduce
Create level sequence

Add character

Add animation sequence

Right click -> BakeToControlRig

If a bone name is too long, it fails the ensure condition in this block in UAnimSequencerController::AddCurveControl, because the passed in name may be chopped as part of the GetSafeNewName logic.

HierarchyController->AddControl(CurveControlKey.Name, FRigElementKey(), Settings, FRigControlValue::Make(CurveElement->Get()), FTransform::Identity, FTransform::Identity, false);

const FRigControlElement* ControlElement = Hierarchy->FindChecked<FRigControlElement>(CurveControlKey);

ensure(ControlElement);

Hi, thanks for reporting this. Can you give me a bit more information about your setup. I’m guessing that the bone name in this case is over 100 characters? And is this a control rig that you’ve authored yourself, or are you baking to an FK Control Rig?

I managed to get a repro on a very similar issue, although not quite the same ensure that you mentioned. The root of the problem appears to be an assumption in UFKControlRig::GetControlName that the bone name can simply have _CONTROL or _CURVE_CONTROL appended. But with long bone names, that can break the requirements of URigHierarchy::SanitizeName which will truncate the names. So we need to be consistent in how we are generating the control names and what we’re doing in GetSafeNewName. A full fix for this needs a bit of thinking about, so I’ve created a JIRA that you can track here.

I tested the workaround that you provided, but in the case of the repro that I found, I still hit a check failure in UFKControlRig::GetControlName. So it may be that you’re hitting a slightly different issue (which is why I was curious if you’re baking to FK Control Rig), or possibly you’re not seeing that if you’re running a build where checks aren’t enabled.

The bone name is close enough to 100 characters, that when it trims it to 96 characters for the 4 character padding, it clips the end off.

We’re not baking to the FKControlRig, but our own control rig. Not sure if that’s the difference.

Hi, sorry for the delay follow up on this. I’ve been out at UE Fest for the last week or so. It looks likely that this is the same issue that I described previously. The dev team have started looking at the JIRA and it’s currently marked to be fixed for 5.7, although it’s always possible that could change. Since we have the JIRA to track the issue, I’m going to close out this thread. But if you want to discuss it further, feel free to reopen it.