Control Rig: Refactor variable binding

#jira na
#rb helge.mathee
#preflight 61a4c443be6d0d4512c093f6

#ROBOMERGE-AUTHOR: sara.schvartzman
#ROBOMERGE-SOURCE: CL 18310323 in //UE5/Release-5.0/... via CL 18310628
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 18310747 by sara schvartzman in ue5-release-engine-test branch]
This commit is contained in:
sara schvartzman
2021-11-29 11:26:01 -05:00
parent d0607ca4bb
commit f0a942f45e
16 changed files with 777 additions and 561 deletions

View File

@@ -447,6 +447,7 @@ void UControlRigBlueprint::PostLoad()
PatchFunctionReferencesOnLoad();
PatchVariableNodesOnLoad();
PatchRigElementKeyCacheOnLoad();
PatchBoundVariables();
#if WITH_EDITOR
@@ -2067,7 +2068,7 @@ TArray<UStruct*> UControlRigBlueprint::GetAvailableRigUnits()
FName UControlRigBlueprint::AddMemberVariable(const FName& InName, const FString& InCPPType, bool bIsPublic, bool bIsReadOnly, FString InDefaultValue)
{
FRigVMExternalVariable Variable = RigVMTypeUtils::ExternalVariableFromCPPType(InName, InCPPType, bIsPublic, bIsReadOnly);
FRigVMExternalVariable Variable = RigVMTypeUtils::ExternalVariableFromCPPTypePath(InName, InCPPType, bIsPublic, bIsReadOnly);
FName Result = AddCRMemberVariableFromExternal(Variable, InDefaultValue);
if (!Result.IsNone())
{
@@ -3510,6 +3511,39 @@ void UControlRigBlueprint::PatchRigElementKeyCacheOnLoad()
}
}
void UControlRigBlueprint::PatchBoundVariables()
{
if (GetLinkerCustomVersion(FControlRigObjectVersion::GUID) < FControlRigObjectVersion::BoundVariableWithInjectionNode)
{
TGuardValue<bool> GuardNotifsSelf(bSuspendModelNotificationsForSelf, true);
for (URigVMGraph* Graph : GetAllModels())
{
URigVMController* Controller = GetOrCreateController(Graph);
TArray<URigVMNode*> Nodes = Graph->GetNodes();
for (URigVMNode* Node : Nodes)
{
for (URigVMPin* Pin : Node->GetPins())
{
for (URigVMInjectionInfo* Info : Pin->GetInjectedNodes())
{
Info->Node = Info->UnitNode_DEPRECATED;
Info->UnitNode_DEPRECATED = nullptr;
bDirtyDuringLoad = true;
}
if (!Pin->BoundVariablePath_DEPRECATED.IsEmpty())
{
Controller->BindPinToVariable(Pin->GetPinPath(), Pin->BoundVariablePath_DEPRECATED, false);
Pin->BoundVariablePath_DEPRECATED = FString();
bDirtyDuringLoad = true;
}
}
}
}
}
}
void UControlRigBlueprint::PropagatePoseFromInstanceToBP(UControlRig* InControlRig)
{
check(InControlRig);

View File

@@ -296,7 +296,7 @@ void UControlRigGraph::HandleModifiedEvent(ERigVMGraphNotifType InNotifType, URi
{
UEdGraphNode* EdNode = FindNodeForModelNodeName(ParentModelNode->GetFName());
if (EdNode)
{
{
if (UControlRigGraphNode* RigNode = Cast<UControlRigGraphNode>(EdNode))
{
RigNode->ReconstructNode_Internal(true);

View File

@@ -538,6 +538,7 @@ private:
void PatchFunctionReferencesOnLoad();
void PatchVariableNodesOnLoad();
void PatchRigElementKeyCacheOnLoad();
void PatchBoundVariables();
TMap<FName, int32> AddedMemberVariableMap;
TArray<FBPVariableDescription> LastNewVariables;