You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Moved TypeIndex from int32 to typedef for easier debugging * Implemented Dispatch Factory * Factories stored under registry * FindFunction to invoke dispatch * Runtime Type checking on the memory handle * Implemented dispatch rigvm node * Unit testing for numeric add test both for low level + controller layer #rb sara.schvartzman #jira UE-157794 #preflight https://horde.devtools.epicgames.com/job/62c4541b2f31b87c6c89360a [CL 20942948 by Helge Mathee in ue5-main branch]
174 lines
4.0 KiB
C++
174 lines
4.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "RigVMModel/Nodes/RigVMDispatchNode.h"
|
|
#include "RigVMUserWorkflowRegistry.h"
|
|
|
|
FString URigVMDispatchNode::GetNodeTitle() const
|
|
{
|
|
if (const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetNodeTitle(GetFilteredTypes());
|
|
}
|
|
return Super::GetNodeTitle();
|
|
}
|
|
|
|
FText URigVMDispatchNode::GetToolTipText() const
|
|
{
|
|
if (const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetNodeTooltip(GetFilteredTypes());
|
|
}
|
|
return URigVMNode::GetToolTipText();
|
|
}
|
|
|
|
FLinearColor URigVMDispatchNode::GetNodeColor() const
|
|
{
|
|
if (const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetNodeColor();
|
|
}
|
|
return URigVMNode::GetNodeColor();
|
|
}
|
|
|
|
bool URigVMDispatchNode::IsDefinedAsConstant() const
|
|
{
|
|
if (const UScriptStruct* Struct = GetFactoryStruct())
|
|
{
|
|
return Struct->HasMetaData(FRigVMStruct::ConstantMetaName);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool URigVMDispatchNode::IsDefinedAsVarying() const
|
|
{
|
|
if (const UScriptStruct* Struct = GetFactoryStruct())
|
|
{
|
|
return Struct->HasMetaData(FRigVMStruct::VaryingMetaName);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
FText URigVMDispatchNode::GetToolTipTextForPin(const URigVMPin* InPin) const
|
|
{
|
|
if (const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
const URigVMPin* RootPin = InPin->GetRootPin();
|
|
return Factory->GetArgumentTooltip(RootPin->GetFName(), RootPin->GetTypeIndex());
|
|
}
|
|
return URigVMNode::GetToolTipTextForPin(InPin);
|
|
}
|
|
|
|
bool URigVMDispatchNode::IsDeprecated() const
|
|
{
|
|
return !GetDeprecatedMetadata().IsEmpty();
|
|
}
|
|
|
|
FString URigVMDispatchNode::GetDeprecatedMetadata() const
|
|
{
|
|
if (const UScriptStruct* Struct = GetFactoryStruct())
|
|
{
|
|
FString DeprecatedMetadata;
|
|
if(Struct->GetStringMetaDataHierarchical(FRigVMStruct::DeprecatedMetaName, &DeprecatedMetadata))
|
|
{
|
|
return DeprecatedMetadata;
|
|
}
|
|
}
|
|
return FString();
|
|
}
|
|
|
|
TArray<URigVMPin*> URigVMDispatchNode::GetAggregateInputs() const
|
|
{
|
|
TArray<URigVMPin*> AggregateInputs;
|
|
#if UE_RIGVM_AGGREGATE_NODES_ENABLED
|
|
if(const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
const TArray<FName> ArgumentNames = Factory->GetAggregateInputArguments();
|
|
for(const FName& ArgumentName : ArgumentNames)
|
|
{
|
|
AggregateInputs.Add(FindPin(ArgumentName.ToString()));
|
|
}
|
|
}
|
|
#endif
|
|
return AggregateInputs;
|
|
}
|
|
|
|
TArray<URigVMPin*> URigVMDispatchNode::GetAggregateOutputs() const
|
|
{
|
|
TArray<URigVMPin*> AggregateOutputs;
|
|
#if UE_RIGVM_AGGREGATE_NODES_ENABLED
|
|
if(const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
const TArray<FName> ArgumentNames = Factory->GetAggregateOutputArguments();
|
|
for(const FName& ArgumentName : ArgumentNames)
|
|
{
|
|
AggregateOutputs.Add(FindPin(ArgumentName.ToString()));
|
|
}
|
|
}
|
|
#endif
|
|
return AggregateOutputs;
|
|
}
|
|
|
|
FName URigVMDispatchNode::GetNextAggregateName(const FName& InLastAggregatePinName) const
|
|
{
|
|
#if UE_RIGVM_AGGREGATE_NODES_ENABLED
|
|
if(const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetNextAggregateName(InLastAggregatePinName);
|
|
}
|
|
#endif
|
|
return FName();
|
|
}
|
|
|
|
const FRigVMDispatchFactory* URigVMDispatchNode::GetFactory() const
|
|
{
|
|
if(CachedFactory)
|
|
{
|
|
return CachedFactory;
|
|
}
|
|
|
|
if(const FRigVMTemplate* Template = GetTemplate())
|
|
{
|
|
CachedFactory = Template->GetDispatchFactory();
|
|
return CachedFactory;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
const UScriptStruct* URigVMDispatchNode::GetFactoryStruct() const
|
|
{
|
|
if(const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetScriptStruct();
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
const FRigVMTemplateTypeMap& URigVMDispatchNode::GetFilteredTypes() const
|
|
{
|
|
const TArray<int32> PermutationIndices = GetFilteredPermutationsIndices();
|
|
if(PermutationIndices.Num() == 1)
|
|
{
|
|
TypesFromPins = GetTypesForPermutation(PermutationIndices[0]);
|
|
}
|
|
else
|
|
{
|
|
TypesFromPins.Reset();
|
|
}
|
|
return TypesFromPins;
|
|
}
|
|
|
|
void URigVMDispatchNode::InvalidateCache()
|
|
{
|
|
Super::InvalidateCache();
|
|
CachedFactory = nullptr;
|
|
}
|
|
|
|
FRigVMStructUpgradeInfo URigVMDispatchNode::GetUpgradeInfo() const
|
|
{
|
|
if(const FRigVMDispatchFactory* Factory = GetFactory())
|
|
{
|
|
return Factory->GetUpgradeInfo(GetFilteredTypes());
|
|
}
|
|
return FRigVMStructUpgradeInfo();
|
|
}
|