2019-12-27 09:26:59 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2018-04-12 16:57:51 -04:00
2019-01-08 11:38:48 -05:00
# include "Graph/ControlRigGraphNode.h"
2018-04-12 16:57:51 -04:00
# include "EdGraph/EdGraphPin.h"
2019-01-08 11:38:48 -05:00
# include "Graph/ControlRigGraph.h"
# include "Graph/ControlRigGraphSchema.h"
2018-04-12 16:57:51 -04:00
# include "Kismet2/BlueprintEditorUtils.h"
2022-01-13 10:27:28 -05:00
# include "Kismet2/KismetDebugUtilities.h"
# include "Kismet2/WatchedPin.h"
2018-04-12 16:57:51 -04:00
# include "KismetCompiler.h"
# include "BlueprintNodeSpawner.h"
# include "EditorCategoryUtils.h"
# include "BlueprintActionDatabaseRegistrar.h"
# include "ControlRig.h"
# include "Textures/SlateIcon.h"
# include "Units/RigUnit.h"
# include "ControlRigBlueprint.h"
# include "PropertyPathHelpers.h"
# include "Kismet2/Kismet2NameValidators.h"
# include "ScopedTransaction.h"
# include "StructReference.h"
# include "UObject/PropertyPortFlags.h"
# include "ControlRigBlueprintUtils.h"
2019-04-17 22:11:57 -04:00
# include "Curves/CurveFloat.h"
2020-01-22 17:58:55 -05:00
# include "RigVMCore/RigVMExecuteContext.h"
# include "ControlRigDeveloper.h"
# include "ControlRigObjectVersion.h"
2022-06-01 11:28:01 -04:00
# include "GraphEditAction.h"
2022-05-05 11:55:01 -04:00
# include "RigVMModel/Nodes/RigVMAggregateNode.h"
2021-01-14 15:00:40 -04:00
# include "RigVMModel/Nodes/RigVMFunctionReferenceNode.h"
# include "RigVMModel/Nodes/RigVMFunctionEntryNode.h"
# include "RigVMModel/Nodes/RigVMFunctionReturnNode.h"
2021-03-10 11:44:24 -04:00
# include "RigVMModel/Nodes/RigVMCollapseNode.h"
2022-06-01 11:28:01 -04:00
# include "RigVMModel/Nodes/RigVMInvokeEntryNode.h"
2018-04-12 16:57:51 -04:00
2019-01-08 11:38:48 -05:00
# if WITH_EDITOR
# include "IControlRigEditorModule.h"
# endif //WITH_EDITOR
2018-04-12 16:57:51 -04:00
# define LOCTEXT_NAMESPACE "ControlRigGraphNode"
2019-04-09 16:29:40 -04:00
UControlRigGraphNode : : UControlRigGraphNode ( )
: Dimensions ( 0.0f , 0.0f )
, NodeTitle ( FText : : GetEmpty ( ) )
2021-03-10 11:44:24 -04:00
, FullNodeTitle ( FText : : GetEmpty ( ) )
2021-05-05 14:40:59 -04:00
, NodeTopologyVersion ( INDEX_NONE )
2019-06-04 09:58:36 -04:00
, CachedTitleColor ( FLinearColor ( 0.f , 0.f , 0.f , 0.f ) )
, CachedNodeColor ( FLinearColor ( 0.f , 0.f , 0.f , 0.f ) )
2021-08-20 12:55:39 -04:00
# if WITH_EDITOR
, bEnableProfiling ( false )
# endif
2022-03-01 04:23:55 -05:00
, CachedTemplate ( nullptr )
2019-04-09 16:29:40 -04:00
{
2019-04-17 22:11:57 -04:00
bHasCompilerMessage = false ;
ErrorType = ( int32 ) EMessageSeverity : : Info + 1 ;
2019-04-09 16:29:40 -04:00
}
2018-04-12 16:57:51 -04:00
FText UControlRigGraphNode : : GetNodeTitle ( ENodeTitleType : : Type TitleType ) const
{
2020-01-22 17:58:55 -05:00
if ( NodeTitle . IsEmpty ( ) )
2018-04-12 16:57:51 -04:00
{
2021-03-10 11:44:24 -04:00
FString SubTitle ;
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2018-04-12 16:57:51 -04:00
{
2020-12-02 10:59:58 -04:00
if ( URigVMUnitNode * UnitNode = Cast < URigVMUnitNode > ( ModelNode ) )
2020-09-24 00:43:27 -04:00
{
2022-06-01 15:51:46 -04:00
const UScriptStruct * ScriptStruct = UnitNode - > GetScriptStruct ( ) ;
if ( ScriptStruct & & ScriptStruct - > IsChildOf ( FRigUnit : : StaticStruct ( ) ) )
2020-09-24 00:43:27 -04:00
{
2020-12-02 10:59:58 -04:00
if ( TSharedPtr < FStructOnScope > StructOnScope = UnitNode - > ConstructStructInstance ( ) )
2020-09-24 00:43:27 -04:00
{
FRigUnit * RigUnit = ( FRigUnit * ) StructOnScope - > GetStructMemory ( ) ;
NodeTitle = FText : : FromString ( RigUnit - > GetUnitLabel ( ) ) ;
}
}
}
2021-03-10 11:44:24 -04:00
else if ( URigVMFunctionReferenceNode * FunctionReferenceNode = Cast < URigVMFunctionReferenceNode > ( ModelNode ) )
{
2021-06-01 06:11:08 -04:00
if ( URigVMLibraryNode * ReferencedNode = FunctionReferenceNode - > GetReferencedNode ( ) )
2021-03-10 11:44:24 -04:00
{
2021-06-01 06:11:08 -04:00
UPackage * ReferencedPackage = ReferencedNode - > GetOutermost ( ) ;
if ( ReferencedPackage ! = ModelNode - > GetOutermost ( ) )
{
SubTitle = FString : : Printf ( TEXT ( " From %s " ) , * ReferencedPackage - > GetName ( ) ) ;
}
else
{
static const FString LocalFunctionString = TEXT ( " Local Function " ) ;
SubTitle = LocalFunctionString ;
}
2021-03-10 11:44:24 -04:00
}
}
else if ( URigVMCollapseNode * CollapseNode = Cast < URigVMCollapseNode > ( ModelNode ) )
{
2022-05-05 11:55:01 -04:00
if ( ! CollapseNode - > IsA < URigVMAggregateNode > ( ) )
{
static const FString CollapseNodeString = TEXT ( " Collapsed Graph " ) ;
SubTitle = CollapseNodeString ;
}
2021-03-10 11:44:24 -04:00
}
2021-06-02 06:17:52 -04:00
else if ( URigVMVariableNode * VariableNode = Cast < URigVMVariableNode > ( ModelNode ) )
{
if ( VariableNode - > IsLocalVariable ( ) )
{
static const FString LocalVariableString = TEXT ( " Local Variable " ) ;
const FString DefaultValue = VariableNode - > GetVariableDescription ( ) . DefaultValue ;
if ( DefaultValue . IsEmpty ( ) )
{
SubTitle = LocalVariableString ;
}
else
{
SubTitle = FString : : Printf ( TEXT ( " %s \n Default %s " ) , * LocalVariableString , * DefaultValue ) ;
}
}
2021-09-27 11:50:32 -04:00
else if ( VariableNode - > IsInputArgument ( ) )
{
SubTitle = TEXT ( " Input parameter " ) ;
}
2021-06-02 06:17:52 -04:00
else
{
if ( UBlueprint * Blueprint = GetBlueprint ( ) )
{
const FName VariableName = VariableNode - > GetVariableName ( ) ;
for ( const FBPVariableDescription & NewVariable : Blueprint - > NewVariables )
{
if ( NewVariable . VarName = = VariableName )
{
2022-01-20 06:49:27 -05:00
FString DefaultValue = NewVariable . DefaultValue ;
2021-06-02 06:17:52 -04:00
if ( DefaultValue . IsEmpty ( ) )
{
static const FString VariableString = TEXT ( " Variable " ) ;
SubTitle = VariableString ;
}
else
{
2022-01-20 06:49:27 -05:00
// Change the order of values in rotators so that they match the pin order
if ( ! NewVariable . VarType . IsContainer ( ) & & NewVariable . VarType . PinSubCategoryObject = = TBaseStructure < FRotator > : : Get ( ) )
{
TArray < FString > Values ;
DefaultValue . ParseIntoArray ( Values , TEXT ( " , " ) ) ;
2022-05-11 07:51:44 -04:00
if ( Values . Num ( ) = = 3 )
{
Values . Swap ( 0 , 1 ) ;
Values . Swap ( 0 , 2 ) ;
}
2022-01-20 06:49:27 -05:00
DefaultValue = FString : : Join ( Values , TEXT ( " , " ) ) ;
}
2021-06-02 06:17:52 -04:00
SubTitle = FString : : Printf ( TEXT ( " Default %s " ) , * DefaultValue ) ;
}
break ;
}
}
}
}
2021-08-30 08:37:30 -04:00
if ( SubTitle . Len ( ) > 40 )
{
SubTitle = SubTitle . Left ( 36 ) + TEXT ( " ... " ) ;
}
2021-06-02 06:17:52 -04:00
}
2020-09-24 00:43:27 -04:00
if ( NodeTitle . IsEmpty ( ) )
{
NodeTitle = FText : : FromString ( ModelNode - > GetNodeTitle ( ) ) ;
}
}
if ( IsDeprecated ( ) )
{
NodeTitle = FText : : FromString ( FString : : Printf ( TEXT ( " %s (Deprecated) " ) , * NodeTitle . ToString ( ) ) ) ;
2018-04-12 16:57:51 -04:00
}
2021-03-10 11:44:24 -04:00
FullNodeTitle = NodeTitle ;
if ( ! SubTitle . IsEmpty ( ) )
{
FullNodeTitle = FText : : FromString ( FString : : Printf ( TEXT ( " %s \n %s " ) , * NodeTitle . ToString ( ) , * SubTitle ) ) ;
}
2018-04-12 16:57:51 -04:00
}
2021-03-10 11:44:24 -04:00
if ( TitleType = = ENodeTitleType : : FullTitle )
{
return FullNodeTitle ;
}
2020-09-24 00:43:27 -04:00
return NodeTitle ;
2018-04-12 16:57:51 -04:00
}
void UControlRigGraphNode : : ReconstructNode ( )
2020-01-22 17:58:55 -05:00
{
ReconstructNode_Internal ( ) ;
}
void UControlRigGraphNode : : ReconstructNode_Internal ( bool bForce )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2021-01-14 15:00:40 -04:00
UControlRigGraph * RigGraph = Cast < UControlRigGraph > ( GetOuter ( ) ) ;
2020-01-22 17:58:55 -05:00
if ( RigGraph & & ! bForce )
2019-04-09 16:29:40 -04:00
{
2019-05-29 11:33:11 -04:00
if ( RigGraph - > bIsTemporaryGraphForCopyPaste )
{
return ;
}
2020-01-22 17:58:55 -05:00
// if this node has been saved prior to our custom version,
// don't reset the node
int32 LinkerVersion = RigGraph - > GetLinkerCustomVersion ( FControlRigObjectVersion : : GUID ) ;
if ( LinkerVersion < FControlRigObjectVersion : : SwitchedToRigVM )
{
return ;
}
2019-04-09 16:29:40 -04:00
}
2021-08-20 12:55:39 -04:00
# if WITH_EDITOR
bEnableProfiling = false ;
if ( RigGraph )
{
if ( UControlRigBlueprint * RigBlueprint = RigGraph - > GetBlueprint ( ) )
{
bEnableProfiling = RigBlueprint - > VMRuntimeSettings . bEnableProfiling ;
}
}
# endif
2018-04-12 16:57:51 -04:00
// Clear previously set messages
ErrorMsg . Reset ( ) ;
// Move the existing pins to a saved array
TArray < UEdGraphPin * > OldPins ( Pins ) ;
Pins . Reset ( ) ;
// Recreate the new pins
2020-01-22 17:58:55 -05:00
CachedPins . Reset ( ) ;
CachedModelPins . Reset ( ) ;
2018-04-12 16:57:51 -04:00
ReallocatePinsDuringReconstruction ( OldPins ) ;
2022-01-13 10:27:28 -05:00
// Maintain watches up to date
if ( URigVMNode * Node = GetModelNode ( ) )
{
UBlueprint * Blueprint = GetBlueprint ( ) ;
for ( UEdGraphPin * NewPin : Pins )
{
const FString PinName = NewPin - > GetName ( ) ;
FString Left , Right = PinName ;
URigVMPin : : SplitPinPathAtStart ( PinName , Left , Right ) ;
if ( URigVMPin * ModelPin = Node - > FindPin ( Right ) )
{
if ( ModelPin - > RequiresWatch ( ) )
{
FKismetDebugUtilities : : AddPinWatch ( Blueprint , FBlueprintWatchedPin ( NewPin ) ) ;
}
}
}
}
2018-04-12 16:57:51 -04:00
RewireOldPinsToNewPins ( OldPins , Pins ) ;
// Let subclasses do any additional work
PostReconstructNode ( ) ;
2021-01-14 15:00:40 -04:00
if ( RigGraph )
{
RigGraph - > NotifyGraphChanged ( ) ;
}
2018-09-25 10:11:35 -04:00
}
2019-04-09 16:29:40 -04:00
bool UControlRigGraphNode : : IsDeprecated ( ) const
{
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2019-04-09 16:29:40 -04:00
{
2020-12-02 10:59:58 -04:00
if ( URigVMUnitNode * StructModelNode = Cast < URigVMUnitNode > ( ModelNode ) )
2019-04-09 16:29:40 -04:00
{
2020-09-24 00:43:27 -04:00
return StructModelNode - > IsDeprecated ( ) ;
2019-04-09 16:29:40 -04:00
}
}
return Super : : IsDeprecated ( ) ;
}
2019-05-30 12:18:07 -04:00
FEdGraphNodeDeprecationResponse UControlRigGraphNode : : GetDeprecationResponse ( EEdGraphNodeDeprecationType DeprecationType ) const
2019-04-09 16:29:40 -04:00
{
2019-05-30 12:18:07 -04:00
FEdGraphNodeDeprecationResponse Response = Super : : GetDeprecationResponse ( DeprecationType ) ;
2019-04-09 16:29:40 -04:00
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2019-04-09 16:29:40 -04:00
{
2020-12-02 10:59:58 -04:00
if ( URigVMUnitNode * StructModelNode = Cast < URigVMUnitNode > ( ModelNode ) )
2019-04-09 16:29:40 -04:00
{
2020-09-24 00:43:27 -04:00
FString DeprecatedMetadata = StructModelNode - > GetDeprecatedMetadata ( ) ;
if ( ! DeprecatedMetadata . IsEmpty ( ) )
{
FFormatNamedArguments Args ;
Args . Add ( TEXT ( " DeprecatedMetadata " ) , FText : : FromString ( DeprecatedMetadata ) ) ;
Response . MessageText = FText : : Format ( LOCTEXT ( " ControlRigGraphNodeDeprecationMessage " , " Warning: This node is deprecated from: {DeprecatedMetadata} " ) , Args ) ;
}
2019-04-09 16:29:40 -04:00
}
}
2019-05-30 12:18:07 -04:00
return Response ;
2019-04-09 16:29:40 -04:00
}
2018-04-12 16:57:51 -04:00
void UControlRigGraphNode : : ReallocatePinsDuringReconstruction ( const TArray < UEdGraphPin * > & OldPins )
{
AllocateDefaultPins ( ) ;
}
void UControlRigGraphNode : : RewireOldPinsToNewPins ( TArray < UEdGraphPin * > & InOldPins , TArray < UEdGraphPin * > & InNewPins )
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2018-04-12 16:57:51 -04:00
for ( UEdGraphPin * OldPin : InOldPins )
{
for ( UEdGraphPin * NewPin : InNewPins )
{
if ( OldPin - > PinName = = NewPin - > PinName & & OldPin - > PinType = = NewPin - > PinType & & OldPin - > Direction = = NewPin - > Direction )
{
2021-06-24 16:28:30 -04:00
// make sure to remove invalid entries from the linked to list
OldPin - > LinkedTo . Remove ( nullptr ) ;
2018-04-12 16:57:51 -04:00
NewPin - > MovePersistentDataFromOldPin ( * OldPin ) ;
break ;
}
}
}
DestroyPinList ( InOldPins ) ;
}
void UControlRigGraphNode : : DestroyPinList ( TArray < UEdGraphPin * > & InPins )
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2018-04-12 16:57:51 -04:00
UBlueprint * Blueprint = GetBlueprint ( ) ;
2019-05-29 11:33:11 -04:00
bool bNotify = false ;
if ( Blueprint ! = nullptr )
{
bNotify = ! Blueprint - > bIsRegeneratingOnLoad ;
}
2018-04-12 16:57:51 -04:00
// Throw away the original pins
for ( UEdGraphPin * Pin : InPins )
{
2019-05-29 11:33:11 -04:00
Pin - > BreakAllPinLinks ( bNotify ) ;
2018-04-12 16:57:51 -04:00
UEdGraphNode : : DestroyPin ( Pin ) ;
}
}
void UControlRigGraphNode : : PostReconstructNode ( )
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2018-04-12 16:57:51 -04:00
for ( UEdGraphPin * Pin : Pins )
{
2020-01-22 17:58:55 -05:00
SetupPinDefaultsFromModel ( Pin ) ;
2018-04-12 16:57:51 -04:00
}
2019-05-29 11:33:11 -04:00
bCanRenameNode = false ;
2019-06-04 09:58:36 -04:00
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2019-06-04 09:58:36 -04:00
{
2020-01-22 17:58:55 -05:00
SetColorFromModel ( ModelNode - > GetNodeColor ( ) ) ;
2019-06-04 09:58:36 -04:00
}
}
void UControlRigGraphNode : : SetColorFromModel ( const FLinearColor & InColor )
{
static const FLinearColor TitleToNodeColor ( 0.35f , 0.35f , 0.35f , 1.f ) ;
CachedNodeColor = InColor * TitleToNodeColor ;
CachedTitleColor = InColor ;
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : HandleClearArray ( FString InPinPath )
2019-01-08 11:38:48 -05:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-12-07 07:55:48 -04:00
if ( URigVMController * Controller = GetController ( ) )
2019-05-29 11:33:11 -04:00
{
2020-12-07 07:55:48 -04:00
Controller - > ClearArrayPin ( InPinPath ) ;
2019-05-29 11:33:11 -04:00
}
}
2019-01-08 11:38:48 -05:00
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : HandleAddArrayElement ( FString InPinPath )
2019-05-29 11:33:11 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-12-07 07:55:48 -04:00
if ( URigVMController * Controller = GetController ( ) )
2019-01-08 11:38:48 -05:00
{
2020-12-07 07:55:48 -04:00
Controller - > OpenUndoBracket ( TEXT ( " Add Array Pin " ) ) ;
2021-07-19 06:35:29 -04:00
FString PinPath = Controller - > AddArrayPin ( InPinPath , FString ( ) , true , true ) ;
2020-12-07 07:55:48 -04:00
Controller - > SetPinExpansion ( InPinPath , true ) ;
Controller - > SetPinExpansion ( PinPath , true ) ;
Controller - > CloseUndoBracket ( ) ;
2019-01-08 11:38:48 -05:00
}
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : HandleRemoveArrayElement ( FString InPinPath )
2019-01-08 11:38:48 -05:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-12-07 07:55:48 -04:00
if ( URigVMController * Controller = GetController ( ) )
2019-01-08 11:38:48 -05:00
{
2021-07-19 06:35:29 -04:00
Controller - > RemoveArrayPin ( InPinPath , true , true ) ;
2020-01-22 17:58:55 -05:00
}
}
void UControlRigGraphNode : : HandleInsertArrayElement ( FString InPinPath )
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-12-07 07:55:48 -04:00
if ( URigVMController * Controller = GetController ( ) )
2020-01-22 17:58:55 -05:00
{
if ( URigVMPin * ArrayElementPin = GetModelPinFromPinPath ( InPinPath ) )
2019-05-29 11:33:11 -04:00
{
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
if ( URigVMPin * ArrayPin = ArrayElementPin - > GetParentPin ( ) )
{
2020-12-07 07:55:48 -04:00
Controller - > OpenUndoBracket ( TEXT ( " Add Array Pin " ) ) ;
2021-07-19 06:35:29 -04:00
FString PinPath = Controller - > InsertArrayPin ( InPinPath , ArrayElementPin - > GetPinIndex ( ) + 1 , FString ( ) , true , true ) ;
2020-12-07 07:55:48 -04:00
Controller - > SetPinExpansion ( InPinPath , true ) ;
Controller - > SetPinExpansion ( PinPath , true ) ;
Controller - > CloseUndoBracket ( ) ;
2019-05-29 11:33:11 -04:00
}
2019-01-08 11:38:48 -05:00
}
}
}
2021-08-24 16:56:32 -04:00
int32 UControlRigGraphNode : : GetInstructionIndex ( bool bAsInput ) const
2021-01-26 04:06:19 -04:00
{
if ( UControlRigGraph * RigGraph = Cast < UControlRigGraph > ( GetGraph ( ) ) )
{
2021-08-24 16:56:32 -04:00
return RigGraph - > GetInstructionIndex ( this , bAsInput ) ;
2021-01-26 04:06:19 -04:00
}
return INDEX_NONE ;
}
2022-03-01 04:23:55 -05:00
const FRigVMTemplate * UControlRigGraphNode : : GetTemplate ( ) const
{
if ( CachedTemplate = = nullptr )
{
if ( URigVMTemplateNode * TemplateNode = Cast < URigVMTemplateNode > ( GetModelNode ( ) ) )
{
CachedTemplate = TemplateNode - > GetTemplate ( ) ;
}
else if ( ModelNodePath . Contains ( TEXT ( " ::Execute( " ) ) )
{
CachedTemplate = FRigVMRegistry : : Get ( ) . FindTemplate ( * ModelNodePath ) ;
}
}
return CachedTemplate ;
}
2021-08-20 12:55:39 -04:00
FLinearColor UControlRigGraphNode : : GetNodeProfilingColor ( ) const
{
# if WITH_EDITOR
if ( bEnableProfiling )
{
2021-08-25 10:34:39 -04:00
if ( UControlRigBlueprint * Blueprint = GetTypedOuter < UControlRigBlueprint > ( ) )
2021-08-20 12:55:39 -04:00
{
if ( UControlRig * DebuggedControlRig = Cast < UControlRig > ( Blueprint - > GetObjectBeingDebugged ( ) ) )
{
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
const double MicroSeconds = ModelNode - > GetInstructionMicroSeconds ( DebuggedControlRig - > GetVM ( ) , FRigVMASTProxy ( ) ) ;
if ( MicroSeconds > = 0.0 )
{
if ( Blueprint - > RigGraphDisplaySettings . bAutoDetermineRange )
{
if ( MicroSeconds < Blueprint - > RigGraphDisplaySettings . MinMicroSeconds )
{
Blueprint - > RigGraphDisplaySettings . MinMicroSeconds = MicroSeconds ;
}
if ( MicroSeconds > Blueprint - > RigGraphDisplaySettings . MaxMicroSeconds )
{
Blueprint - > RigGraphDisplaySettings . MaxMicroSeconds = MicroSeconds ;
}
}
const double MinMicroSeconds = Blueprint - > RigGraphDisplaySettings . LastMinMicroSeconds ;
const double MaxMicroSeconds = Blueprint - > RigGraphDisplaySettings . LastMaxMicroSeconds ;
if ( MaxMicroSeconds < = MinMicroSeconds )
{
return FLinearColor : : Black ;
}
const FLinearColor & MinColor = Blueprint - > RigGraphDisplaySettings . MinDurationColor ;
const FLinearColor & MaxColor = Blueprint - > RigGraphDisplaySettings . MaxDurationColor ;
const double T = ( MicroSeconds - MinMicroSeconds ) / ( MaxMicroSeconds - MinMicroSeconds ) ;
return FMath : : Lerp < FLinearColor > ( MinColor , MaxColor , ( float ) T ) ;
}
}
}
}
}
# endif
return FLinearColor : : Black ;
}
2018-09-25 10:11:35 -04:00
void UControlRigGraphNode : : AllocateDefaultPins ( )
{
2020-01-22 17:58:55 -05:00
ExecutePins . Reset ( ) ;
InputPins . Reset ( ) ;
InputOutputPins . Reset ( ) ;
OutputPins . Reset ( ) ;
2018-04-12 16:57:51 -04:00
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2018-04-12 16:57:51 -04:00
{
2021-04-07 13:09:20 -04:00
for ( int32 PinListIndex = 0 ; PinListIndex < 2 ; PinListIndex + + )
2020-01-22 17:58:55 -05:00
{
2021-04-07 13:09:20 -04:00
const TArray < URigVMPin * > & ModelPins = PinListIndex = = 0 ? ModelNode - > GetPins ( ) : ModelNode - > GetOrphanedPins ( ) ;
for ( URigVMPin * ModelPin : ModelPins )
2020-09-24 00:43:27 -04:00
{
2021-04-07 13:09:20 -04:00
if ( ModelPin - > ShowInDetailsPanelOnly ( ) )
2020-01-22 17:58:55 -05:00
{
2021-04-07 13:09:20 -04:00
continue ;
}
if ( ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : IO )
{
if ( ModelPin - > IsStruct ( ) )
{
2022-06-01 15:51:46 -04:00
const UScriptStruct * ScriptStruct = ModelPin - > GetScriptStruct ( ) ;
if ( ScriptStruct & & ScriptStruct - > IsChildOf ( FRigVMExecuteContext : : StaticStruct ( ) ) )
2021-04-07 13:09:20 -04:00
{
ExecutePins . Add ( ModelPin ) ;
continue ;
}
}
InputOutputPins . Add ( ModelPin ) ;
}
else if ( ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : Input | |
ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : Visible )
{
InputPins . Add ( ModelPin ) ;
}
else if ( ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : Output )
{
OutputPins . Add ( ModelPin ) ;
2020-01-22 17:58:55 -05:00
}
}
}
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
CreateExecutionPins ( ) ;
CreateInputPins ( ) ;
CreateInputOutputPins ( ) ;
CreateOutputPins ( ) ;
2021-04-27 03:19:42 -04:00
// Fill the variable list
ExternalVariables . Reset ( ) ;
if ( URigVMFunctionReferenceNode * FunctionReferenceNode = Cast < URigVMFunctionReferenceNode > ( GetModelNode ( ) ) )
{
if ( FunctionReferenceNode - > RequiresVariableRemapping ( ) )
{
TArray < FRigVMExternalVariable > CurrentExternalVariables = FunctionReferenceNode - > GetContainedGraph ( ) - > GetExternalVariables ( ) ;
for ( const FRigVMExternalVariable & CurrentExternalVariable : CurrentExternalVariables )
{
ExternalVariables . Add ( MakeShared < FRigVMExternalVariable > ( CurrentExternalVariable ) ) ;
}
}
}
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : CreateExecutionPins ( )
2019-04-09 16:29:40 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-01-22 17:58:55 -05:00
const TArray < URigVMPin * > ModelPins = ExecutePins ;
for ( URigVMPin * ModelPin : ModelPins )
2019-04-09 16:29:40 -04:00
{
2020-01-22 17:58:55 -05:00
PinPair & Pair = CachedPins . FindOrAdd ( ModelPin ) ;
if ( Pair . InputPin = = nullptr )
2019-04-09 16:29:40 -04:00
{
2020-01-22 17:58:55 -05:00
Pair . InputPin = CreatePin ( EGPD_Input , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . InputPin ! = nullptr )
2019-04-09 16:29:40 -04:00
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . InputPin , ModelPin , false , true ) ;
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
}
if ( Pair . OutputPin = = nullptr )
{
2020-01-22 17:58:55 -05:00
Pair . OutputPin = CreatePin ( EGPD_Output , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . OutputPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . OutputPin , ModelPin , false , true ) ;
2019-04-09 16:29:40 -04:00
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2019-04-09 16:29:40 -04:00
// note: no recursion for execution pins
}
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : CreateInputPins ( URigVMPin * InParentPin )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-01-22 17:58:55 -05:00
const TArray < URigVMPin * > ModelPins = InParentPin = = nullptr ? InputPins : InParentPin - > GetSubPins ( ) ;
for ( URigVMPin * ModelPin : ModelPins )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
PinPair & Pair = CachedPins . FindOrAdd ( ModelPin ) ;
if ( Pair . InputPin = = nullptr )
2018-09-25 10:11:35 -04:00
{
2020-01-22 17:58:55 -05:00
Pair . InputPin = CreatePin ( EGPD_Input , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . InputPin ! = nullptr )
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . InputPin , ModelPin , false , ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : Input ) ;
2018-04-12 16:57:51 -04:00
2020-01-22 17:58:55 -05:00
SetupPinDefaultsFromModel ( Pair . InputPin ) ;
if ( InParentPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
PinPair & ParentPair = CachedPins . FindChecked ( InParentPin ) ;
ParentPair . InputPin - > SubPins . Add ( Pair . InputPin ) ;
Pair . InputPin - > ParentPin = ParentPair . InputPin ;
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2020-01-22 17:58:55 -05:00
}
CreateInputPins ( ModelPin ) ;
2018-04-12 16:57:51 -04:00
}
}
2020-02-04 11:06:23 -05:00
void UControlRigGraphNode : : CreateInputOutputPins ( URigVMPin * InParentPin , bool bHidden )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2021-09-08 11:05:59 -04:00
bool bIsContainer = false ;
if ( InParentPin )
{
bIsContainer = InParentPin - > IsArray ( ) ;
}
2020-01-22 17:58:55 -05:00
const TArray < URigVMPin * > ModelPins = InParentPin = = nullptr ? InputOutputPins : InParentPin - > GetSubPins ( ) ;
for ( URigVMPin * ModelPin : ModelPins )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
PinPair & Pair = CachedPins . FindOrAdd ( ModelPin ) ;
if ( Pair . InputPin = = nullptr )
2018-09-25 10:11:35 -04:00
{
2020-01-22 17:58:55 -05:00
Pair . InputPin = CreatePin ( EGPD_Input , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . InputPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . InputPin , ModelPin , bHidden , ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : IO ) ;
2020-01-22 17:58:55 -05:00
SetupPinDefaultsFromModel ( Pair . InputPin ) ;
if ( InParentPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
PinPair & ParentPair = CachedPins . FindChecked ( InParentPin ) ;
ParentPair . InputPin - > SubPins . Add ( Pair . InputPin ) ;
Pair . InputPin - > ParentPin = ParentPair . InputPin ;
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
}
2021-09-08 11:05:59 -04:00
if ( Pair . OutputPin = = nullptr & & ! bIsContainer )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
Pair . OutputPin = CreatePin ( EGPD_Output , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . OutputPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . OutputPin , ModelPin , bHidden , ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : IO ) ;
2020-01-22 17:58:55 -05:00
if ( InParentPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
PinPair & ParentPair = CachedPins . FindChecked ( InParentPin ) ;
ParentPair . OutputPin - > SubPins . Add ( Pair . OutputPin ) ;
Pair . OutputPin - > ParentPin = ParentPair . OutputPin ;
}
2018-09-25 10:11:35 -04:00
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2018-04-12 16:57:51 -04:00
2020-01-22 17:58:55 -05:00
// don't recurse on knot / compact reroute nodes
if ( URigVMRerouteNode * RerouteNode = Cast < URigVMRerouteNode > ( GetModelNode ( ) ) )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
if ( ! RerouteNode - > GetShowsAsFullNode ( ) )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-02-04 11:06:23 -05:00
bHidden = true ;
2018-09-25 10:11:35 -04:00
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2018-04-12 16:57:51 -04:00
2021-09-08 11:05:59 -04:00
if ( bIsContainer )
{
CreateInputPins ( ModelPin ) ;
}
else
{
CreateInputOutputPins ( ModelPin , bHidden ) ;
}
2018-04-12 16:57:51 -04:00
}
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : CreateOutputPins ( URigVMPin * InParentPin )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-01-22 17:58:55 -05:00
const TArray < URigVMPin * > ModelPins = InParentPin = = nullptr ? OutputPins : InParentPin - > GetSubPins ( ) ;
for ( URigVMPin * ModelPin : ModelPins )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
PinPair & Pair = CachedPins . FindOrAdd ( ModelPin ) ;
if ( Pair . OutputPin = = nullptr )
2018-09-25 10:11:35 -04:00
{
2020-01-22 17:58:55 -05:00
Pair . OutputPin = CreatePin ( EGPD_Output , GetPinTypeForModelPin ( ModelPin ) , FName ( * ModelPin - > GetPinPath ( ) ) ) ;
if ( Pair . OutputPin ! = nullptr )
{
2022-03-14 10:19:31 -04:00
ConfigurePin ( Pair . OutputPin , ModelPin , false , ModelPin - > GetDirection ( ) = = ERigVMPinDirection : : Output ) ;
2020-01-22 17:58:55 -05:00
if ( InParentPin ! = nullptr )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
PinPair & ParentPair = CachedPins . FindChecked ( InParentPin ) ;
ParentPair . OutputPin - > SubPins . Add ( Pair . OutputPin ) ;
Pair . OutputPin - > ParentPin = ParentPair . OutputPin ;
}
}
2018-09-25 10:11:35 -04:00
}
2020-01-22 17:58:55 -05:00
CreateOutputPins ( ModelPin ) ;
2018-04-12 16:57:51 -04:00
}
}
UClass * UControlRigGraphNode : : GetControlRigGeneratedClass ( ) const
{
2021-08-25 10:34:39 -04:00
UControlRigBlueprint * Blueprint = GetTypedOuter < UControlRigBlueprint > ( ) ;
2018-04-12 16:57:51 -04:00
if ( Blueprint )
{
if ( Blueprint - > GeneratedClass )
{
check ( Blueprint - > GeneratedClass - > IsChildOf ( UControlRig : : StaticClass ( ) ) ) ;
return Blueprint - > GeneratedClass ;
}
}
return nullptr ;
}
UClass * UControlRigGraphNode : : GetControlRigSkeletonGeneratedClass ( ) const
{
2021-08-25 10:34:39 -04:00
UControlRigBlueprint * Blueprint = GetTypedOuter < UControlRigBlueprint > ( ) ;
2018-04-12 16:57:51 -04:00
if ( Blueprint )
{
if ( Blueprint - > SkeletonGeneratedClass )
{
check ( Blueprint - > SkeletonGeneratedClass - > IsChildOf ( UControlRig : : StaticClass ( ) ) ) ;
return Blueprint - > SkeletonGeneratedClass ;
}
}
return nullptr ;
}
2020-01-22 17:58:55 -05:00
FLinearColor UControlRigGraphNode : : GetNodeOpacityColor ( ) const
{
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
2022-03-07 10:20:24 -05:00
if ( Cast < URigVMVariableNode > ( ModelNode ) )
2020-01-22 17:58:55 -05:00
{
return FLinearColor : : White ;
}
2021-01-26 04:06:19 -04:00
2021-08-24 16:56:32 -04:00
if ( GetInstructionIndex ( true ) = = INDEX_NONE )
2020-01-22 17:58:55 -05:00
{
2021-08-24 16:56:32 -04:00
return FLinearColor ( 0.35f , 0.35f , 0.35f , 0.35f ) ;
2020-01-22 17:58:55 -05:00
}
}
return FLinearColor : : White ;
}
2019-04-09 16:29:40 -04:00
FLinearColor UControlRigGraphNode : : GetNodeTitleColor ( ) const
{
// return a darkened version of the default node's color
2020-01-22 17:58:55 -05:00
return CachedTitleColor * GetNodeOpacityColor ( ) ;
2019-04-09 16:29:40 -04:00
}
FLinearColor UControlRigGraphNode : : GetNodeBodyTintColor ( ) const
{
2021-08-20 12:55:39 -04:00
# if WITH_EDITOR
if ( bEnableProfiling )
{
return GetNodeProfilingColor ( ) ;
}
# endif
2020-01-22 17:58:55 -05:00
return CachedNodeColor * GetNodeOpacityColor ( ) ;
2019-04-09 16:29:40 -04:00
}
2021-01-14 15:00:40 -04:00
bool UControlRigGraphNode : : ShowPaletteIconOnNode ( ) const
{
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
return ModelNode - > IsEvent ( ) | |
2022-06-01 11:28:01 -04:00
ModelNode - > IsA < URigVMInvokeEntryNode > ( ) | |
2021-01-14 15:00:40 -04:00
ModelNode - > IsA < URigVMFunctionEntryNode > ( ) | |
ModelNode - > IsA < URigVMFunctionReturnNode > ( ) | |
2021-04-01 11:21:50 -04:00
ModelNode - > IsA < URigVMFunctionReferenceNode > ( ) | |
ModelNode - > IsA < URigVMCollapseNode > ( ) | |
2022-04-19 08:39:16 -04:00
ModelNode - > IsA < URigVMUnitNode > ( ) | |
ModelNode - > IsLoopNode ( ) ;
2021-01-14 15:00:40 -04:00
}
return false ;
}
2018-04-12 16:57:51 -04:00
FSlateIcon UControlRigGraphNode : : GetIconAndTint ( FLinearColor & OutColor ) const
{
2021-01-14 15:00:40 -04:00
OutColor = FLinearColor : : White ;
2022-05-09 13:12:28 -04:00
static FSlateIcon FunctionIcon ( FAppStyle : : GetAppStyleSetName ( ) , " Kismet.AllClasses.FunctionIcon " ) ;
static FSlateIcon EventIcon ( FAppStyle : : GetAppStyleSetName ( ) , " GraphEditor.Event_16x " ) ;
static FSlateIcon EntryReturnIcon ( FAppStyle : : GetAppStyleSetName ( ) , " GraphEditor.Default_16x " ) ;
static FSlateIcon CollapsedNodeIcon ( FAppStyle : : GetAppStyleSetName ( ) , " GraphEditor.SubGraph_16x " ) ;
static FSlateIcon ArrayNodeIteratorIcon ( FAppStyle : : GetAppStyleSetName ( ) , " GraphEditor.Macro.ForEach_16x " ) ;
2022-03-01 04:23:55 -05:00
static FSlateIcon TemplateNodeIcon ( " ControlRigEditorStyle " , " ControlRig.Template " ) ;
2021-01-14 15:00:40 -04:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
2022-06-01 11:28:01 -04:00
if ( ModelNode - > IsEvent ( ) | | ModelNode - > IsA < URigVMInvokeEntryNode > ( ) )
2021-01-14 15:00:40 -04:00
{
return EventIcon ;
}
2021-04-01 11:21:50 -04:00
2022-05-05 11:55:01 -04:00
while ( const URigVMAggregateNode * AggregateNode = Cast < URigVMAggregateNode > ( ModelNode ) )
{
ModelNode = AggregateNode - > GetFirstInnerNode ( ) ;
}
2021-04-01 11:21:50 -04:00
if ( ModelNode - > IsA < URigVMFunctionReferenceNode > ( ) )
{
return FunctionIcon ;
}
2022-05-05 11:55:01 -04:00
2021-04-01 11:21:50 -04:00
if ( ModelNode - > IsA < URigVMCollapseNode > ( ) )
{
return CollapsedNodeIcon ;
}
if ( ModelNode - > IsA < URigVMFunctionEntryNode > ( ) | |
ModelNode - > IsA < URigVMFunctionReturnNode > ( ) )
{
return EntryReturnIcon ;
}
2021-08-18 06:18:21 -04:00
if ( URigVMArrayNode * ArrayNode = Cast < URigVMArrayNode > ( ModelNode ) )
{
if ( ArrayNode - > IsLoopNode ( ) )
{
return ArrayNodeIteratorIcon ;
}
}
2021-04-01 11:21:50 -04:00
if ( URigVMUnitNode * UnitNode = Cast < URigVMUnitNode > ( ModelNode ) )
{
2022-04-19 08:39:16 -04:00
if ( const FRigVMTemplate * Template = UnitNode - > GetTemplate ( ) )
{
if ( Template - > NumPermutations ( ) > 1 )
{
return TemplateNodeIcon ;
}
}
2021-04-01 11:21:50 -04:00
FString IconPath ;
const int32 NumOfIconPathNames = 4 ;
FName IconPathNames [ NumOfIconPathNames ] = {
NAME_None , // StyleSetName
NAME_None , // StyleName
NAME_None , // SmallStyleName
NAME_None // StatusOverlayStyleName
} ;
2022-03-01 04:23:55 -05:00
if ( UnitNode - > GetScriptStruct ( ) )
2021-04-01 11:21:50 -04:00
{
2022-03-01 04:23:55 -05:00
// icon path format: StyleSetName|StyleName|SmallStyleName|StatusOverlayStyleName
// the last two names are optional, see FSlateIcon() for reference
UnitNode - > GetScriptStruct ( ) - > GetStringMetaDataHierarchical ( FRigVMStruct : : IconMetaName , & IconPath ) ;
2021-04-01 11:21:50 -04:00
2022-03-01 04:23:55 -05:00
int32 NameIndex = 0 ;
while ( ! IconPath . IsEmpty ( ) & & NameIndex < NumOfIconPathNames )
2021-04-01 11:21:50 -04:00
{
2022-03-01 04:23:55 -05:00
FString Left ;
FString Right ;
if ( ! IconPath . Split ( TEXT ( " | " ) , & Left , & Right ) )
{
Left = IconPath ;
}
IconPathNames [ NameIndex ] = FName ( * Left ) ;
NameIndex + + ;
IconPath = Right ;
2021-04-01 11:21:50 -04:00
}
}
return FSlateIcon ( IconPathNames [ 0 ] , IconPathNames [ 1 ] , IconPathNames [ 2 ] , IconPathNames [ 3 ] ) ;
}
2021-01-14 15:00:40 -04:00
}
return FunctionIcon ;
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : GetNodeContextMenuActions ( class UToolMenu * Menu , class UGraphNodeContextMenuContext * Context ) const
2018-04-12 16:57:51 -04:00
{
2019-01-08 11:38:48 -05:00
# if WITH_EDITOR
2020-01-22 17:58:55 -05:00
const UControlRigGraphSchema * Schema = Cast < UControlRigGraphSchema > ( GetSchema ( ) ) ;
IControlRigEditorModule : : Get ( ) . GetContextMenuActions ( Schema , Menu , Context ) ;
2019-01-08 11:38:48 -05:00
# endif
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
bool UControlRigGraphNode : : IsPinExpanded ( const FString & InPinPath )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
if ( URigVMPin * ModelPin = GetModelPinFromPinPath ( InPinPath ) )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ModelPin - > IsExpanded ( ) ;
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
return false ;
2018-04-12 16:57:51 -04:00
}
void UControlRigGraphNode : : DestroyNode ( )
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2018-04-12 16:57:51 -04:00
if ( UControlRigGraph * Graph = Cast < UControlRigGraph > ( GetOuter ( ) ) )
{
2022-04-06 08:26:45 -04:00
BreakAllNodeLinks ( ) ;
2018-04-12 16:57:51 -04:00
UControlRigBlueprint * ControlRigBlueprint = Cast < UControlRigBlueprint > ( Graph - > GetOuter ( ) ) ;
if ( ControlRigBlueprint )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2022-04-06 08:26:45 -04:00
if ( PropertyName_DEPRECATED . IsValid ( ) )
{
2020-01-22 17:58:55 -05:00
FControlRigBlueprintUtils : : RemoveMemberVariableIfNotUsed ( ControlRigBlueprint , PropertyName_DEPRECATED , this ) ;
}
2018-04-12 16:57:51 -04:00
}
2022-04-06 08:26:45 -04:00
}
2018-04-12 16:57:51 -04:00
UEdGraphNode : : DestroyNode ( ) ;
}
void UControlRigGraphNode : : PinDefaultValueChanged ( UEdGraphPin * Pin )
{
2021-07-19 06:35:29 -04:00
CopyPinDefaultsToModel ( Pin , true , true ) ;
2018-04-12 16:57:51 -04:00
}
2021-07-19 06:35:29 -04:00
void UControlRigGraphNode : : CopyPinDefaultsToModel ( UEdGraphPin * Pin , bool bUndo , bool bPrintPythonCommand )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-01-22 17:58:55 -05:00
if ( Pin - > Direction ! = EGPD_Input )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ;
2021-01-14 15:00:40 -04:00
}
2020-01-22 17:58:55 -05:00
const UEdGraphSchema_K2 * K2Schema = GetDefault < UEdGraphSchema_K2 > ( ) ;
if ( URigVMPin * ModelPin = GetModelPinFromPinPath ( Pin - > GetName ( ) ) )
{
if ( ModelPin - > GetSubPins ( ) . Num ( ) > 0 )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ;
2021-01-14 15:00:40 -04:00
}
2020-01-22 17:58:55 -05:00
FString DefaultValue = Pin - > DefaultValue ;
2021-10-19 06:24:52 -04:00
if ( DefaultValue . IsEmpty ( ) & & (
Pin - > PinType . PinCategory = = UEdGraphSchema_K2 : : PC_Object | |
Pin - > PinType . PinCategory = = UEdGraphSchema_K2 : : PC_SoftObject | |
2022-04-06 08:26:45 -04:00
Pin - > PinType . PinCategory = = UEdGraphSchema_K2 : : AllObjectTypes | |
Pin - > PinType . PinCategory = = UEdGraphSchema_K2 : : PC_Interface
2021-10-19 06:24:52 -04:00
) )
{
if ( Pin - > DefaultObject )
{
DefaultValue = Pin - > DefaultObject - > GetPathName ( ) ;
}
}
2020-01-22 17:58:55 -05:00
if ( DefaultValue = = FName ( NAME_None ) . ToString ( ) & & Pin - > PinType . PinSubCategory = = UEdGraphSchema_K2 : : PC_Name )
{
DefaultValue = FString ( ) ;
2021-01-14 15:00:40 -04:00
}
2020-01-22 17:58:55 -05:00
if ( ModelPin - > GetDefaultValue ( ) ! = DefaultValue )
2020-12-07 07:55:48 -04:00
{
if ( URigVMController * Controller = GetController ( ) )
{
2021-07-19 06:35:29 -04:00
Controller - > SetPinDefaultValue ( ModelPin - > GetPinPath ( ) , DefaultValue , false , true , false , bPrintPythonCommand ) ;
2020-12-07 07:55:48 -04:00
}
2018-04-12 16:57:51 -04:00
}
}
}
UControlRigBlueprint * UControlRigGraphNode : : GetBlueprint ( ) const
{
if ( UControlRigGraph * Graph = Cast < UControlRigGraph > ( GetOuter ( ) ) )
{
2020-12-07 07:55:48 -04:00
return Graph - > GetBlueprint ( ) ;
if ( UControlRigGraph * OuterGraph = Cast < UControlRigGraph > ( Graph - > GetOuter ( ) ) )
{
return OuterGraph - > GetBlueprint ( ) ;
}
2018-04-12 16:57:51 -04:00
return Cast < UControlRigBlueprint > ( Graph - > GetOuter ( ) ) ;
}
return nullptr ;
}
2020-12-07 07:55:48 -04:00
URigVMGraph * UControlRigGraphNode : : GetModel ( ) const
{
if ( UControlRigGraph * Graph = Cast < UControlRigGraph > ( GetOuter ( ) ) )
{
return Graph - > GetModel ( ) ;
}
return nullptr ;
}
URigVMController * UControlRigGraphNode : : GetController ( ) const
{
if ( UControlRigGraph * Graph = Cast < UControlRigGraph > ( GetOuter ( ) ) )
{
return Graph - > GetController ( ) ;
}
return nullptr ;
}
2020-01-22 17:58:55 -05:00
URigVMNode * UControlRigGraphNode : : GetModelNode ( ) const
{
2020-06-23 18:40:00 -04:00
UControlRigGraphNode * MutableThis = ( UControlRigGraphNode * ) this ;
2020-01-22 17:58:55 -05:00
if ( CachedModelNode )
{
2020-06-23 18:40:00 -04:00
if ( CachedModelNode - > GetOuter ( ) = = GetTransientPackage ( ) )
{
MutableThis - > CachedModelNode = nullptr ;
}
else
{
return CachedModelNode ;
}
2020-01-22 17:58:55 -05:00
}
if ( UControlRigGraph * Graph = Cast < UControlRigGraph > ( GetOuter ( ) ) )
{
# if WITH_EDITOR
2020-12-14 08:58:12 -04:00
if ( Graph - > TemplateController ! = nullptr )
2020-01-22 17:58:55 -05:00
{
2020-12-14 08:58:12 -04:00
return MutableThis - > CachedModelNode = Graph - > TemplateController - > GetGraph ( ) - > FindNode ( ModelNodePath ) ;
2020-01-22 17:58:55 -05:00
}
# endif
2020-12-07 07:55:48 -04:00
if ( URigVMGraph * Model = GetModel ( ) )
2020-01-22 17:58:55 -05:00
{
2020-12-07 07:55:48 -04:00
return MutableThis - > CachedModelNode = Model - > FindNode ( ModelNodePath ) ;
2020-01-22 17:58:55 -05:00
}
}
return nullptr ;
}
FName UControlRigGraphNode : : GetModelNodeName ( ) const
{
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
return ModelNode - > GetFName ( ) ;
}
return NAME_None ;
}
URigVMPin * UControlRigGraphNode : : GetModelPinFromPinPath ( const FString & InPinPath ) const
{
2021-09-09 10:07:44 -04:00
if ( TObjectPtr < URigVMPin > const * CachedModelPinPtr = CachedModelPins . Find ( InPinPath ) )
2020-01-22 17:58:55 -05:00
{
2020-12-14 08:58:12 -04:00
URigVMPin * CachedModelPin = * CachedModelPinPtr ;
if ( ! CachedModelPin - > HasAnyFlags ( RF_Transient ) & & CachedModelPin - > GetNode ( ) )
{
return CachedModelPin ;
}
2020-01-22 17:58:55 -05:00
}
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
FString PinPath = InPinPath . RightChop ( ModelNode - > GetNodePath ( ) . Len ( ) + 1 ) ;
URigVMPin * ModelPin = ModelNode - > FindPin ( PinPath ) ;
if ( ModelPin )
2020-12-14 08:58:12 -04:00
{
2020-01-22 17:58:55 -05:00
UControlRigGraphNode * MutableThis = ( UControlRigGraphNode * ) this ;
2020-12-14 08:58:12 -04:00
MutableThis - > CachedModelPins . FindOrAdd ( InPinPath ) = ModelPin ;
}
2020-01-22 17:58:55 -05:00
return ModelPin ;
}
return nullptr ;
}
2022-03-30 05:21:45 -04:00
void UControlRigGraphNode : : HandleAddAggregateElement ( const FString & InNodePath )
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
if ( URigVMController * Controller = GetController ( ) )
{
Controller - > AddAggregatePin ( InNodePath , FString ( ) , FString ( ) , true , true ) ;
}
}
2020-01-22 17:58:55 -05:00
void UControlRigGraphNode : : SetupPinDefaultsFromModel ( UEdGraphPin * Pin )
2018-04-12 16:57:51 -04:00
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2020-01-22 17:58:55 -05:00
if ( Pin - > Direction ! = EGPD_Input )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ;
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2020-01-22 17:58:55 -05:00
const UEdGraphSchema_K2 * K2Schema = GetDefault < UEdGraphSchema_K2 > ( ) ;
if ( URigVMPin * ModelPin = GetModelPinFromPinPath ( Pin - > GetName ( ) ) )
{
if ( ModelPin - > GetSubPins ( ) . Num ( ) > 0 )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ;
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2020-01-22 17:58:55 -05:00
FString DefaultValueString = ModelPin - > GetDefaultValue ( ) ;
if ( DefaultValueString . IsEmpty ( ) & & ModelPin - > GetCPPType ( ) = = TEXT ( " FName " ) )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-01-22 17:58:55 -05:00
DefaultValueString = FName ( NAME_None ) . ToString ( ) ;
2018-04-12 16:57:51 -04:00
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
K2Schema - > GetPinDefaultValuesFromString ( Pin - > PinType , Pin - > GetOwningNodeUnchecked ( ) , DefaultValueString , Pin - > DefaultValue , Pin - > DefaultObject , Pin - > DefaultTextValue ) ;
}
2018-04-12 16:57:51 -04:00
}
FText UControlRigGraphNode : : GetTooltipText ( ) const
{
2020-01-22 17:58:55 -05:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ModelNode - > GetToolTipText ( ) ;
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
return FText : : FromString ( ModelNodePath ) ;
2018-04-12 16:57:51 -04:00
}
void UControlRigGraphNode : : InvalidateNodeTitle ( ) const
{
NodeTitle = FText ( ) ;
2021-03-10 11:44:24 -04:00
FullNodeTitle = FText ( ) ;
2020-09-24 00:43:27 -04:00
NodeTitleDirtied . ExecuteIfBound ( ) ;
2018-04-12 16:57:51 -04:00
}
bool UControlRigGraphNode : : CanCreateUnderSpecifiedSchema ( const UEdGraphSchema * InSchema ) const
{
return InSchema - > IsA < UControlRigGraphSchema > ( ) ;
}
void UControlRigGraphNode : : AutowireNewNode ( UEdGraphPin * FromPin )
{
2019-07-16 11:49:59 -04:00
DECLARE_SCOPE_HIERARCHICAL_COUNTER_FUNC ( )
2018-04-12 16:57:51 -04:00
Super : : AutowireNewNode ( FromPin ) ;
const UControlRigGraphSchema * Schema = GetDefault < UControlRigGraphSchema > ( ) ;
2022-03-01 04:23:55 -05:00
// copying high level information into a local array since the try create connection below
// may cause the pin array to be destroyed / changed
TArray < TPair < FName , EEdGraphPinDirection > > PinsToVisit ;
2018-04-12 16:57:51 -04:00
for ( UEdGraphPin * Pin : Pins )
{
2022-03-01 04:23:55 -05:00
PinsToVisit . Emplace ( Pin - > GetFName ( ) , Pin - > Direction ) ;
}
for ( const TPair < FName , EEdGraphPinDirection > & PinToVisit : PinsToVisit )
{
UEdGraphPin * Pin = FindPin ( PinToVisit . Key , PinToVisit . Value ) ;
if ( Pin = = nullptr )
{
continue ;
}
2019-04-30 10:19:36 -04:00
if ( Pin - > ParentPin ! = nullptr )
{
continue ;
}
2019-05-29 11:33:11 -04:00
FPinConnectionResponse ConnectResponse = Schema - > CanCreateConnection ( FromPin , Pin ) ;
if ( ConnectResponse . Response ! = ECanCreateConnectionResponse : : CONNECT_RESPONSE_DISALLOW )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
if ( Schema - > TryCreateConnection ( FromPin , Pin ) )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
break ;
2022-03-01 04:23:55 -05:00
}
2018-04-12 16:57:51 -04:00
}
2022-03-01 04:23:55 -05:00
}
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
bool UControlRigGraphNode : : IsSelectedInEditor ( ) const
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
URigVMNode * ModelNode = GetModelNode ( ) ;
if ( ModelNode )
2018-04-12 16:57:51 -04:00
{
2020-01-22 17:58:55 -05:00
return ModelNode - > IsSelected ( ) ;
2018-04-12 16:57:51 -04:00
}
2020-01-22 17:58:55 -05:00
return false ;
2018-04-12 16:57:51 -04:00
}
2018-09-25 10:11:35 -04:00
2020-01-22 17:58:55 -05:00
bool UControlRigGraphNode : : ShouldDrawNodeAsControlPointOnly ( int32 & OutInputPinIndex , int32 & OutOutputPinIndex ) const
2019-05-29 11:33:11 -04:00
{
2020-01-22 17:58:55 -05:00
if ( URigVMRerouteNode * Reroute = Cast < URigVMRerouteNode > ( GetModelNode ( ) ) )
{
if ( ! Reroute - > GetShowsAsFullNode ( ) )
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
{
2020-02-04 11:06:23 -05:00
if ( Pins . Num ( ) > = 2 )
2020-01-22 17:58:55 -05:00
{
OutInputPinIndex = 0 ;
OutOutputPinIndex = 1 ;
return true ;
}
Reimplementing FProperty changes from //UE4/Main
+ Reimplemented FProperty related fixed from //UE4/Main:
CL#10791312, 10804850, 10851666, 10855122, 10855198, 10942138, 11030611, 11030639, 11032261, 11061515, 11136964,11138881, 11214238, 11214865
#rb none (previously reviewed in Dev-Core)
[FYI] Chris.Bunnner, Daniel.Lamb
#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 11302985 via CL 11303011 via CL 11303019
#ROBOMERGE-BOT: (v0-11244347)
[CL 11303183 by robert manuszewski in Main branch]
2020-02-10 08:06:56 -05:00
}
2020-01-22 17:58:55 -05:00
}
return false ;
}
FEdGraphPinType UControlRigGraphNode : : GetPinTypeForModelPin ( URigVMPin * InModelPin )
{
2022-03-14 10:19:31 -04:00
FEdGraphPinType PinType = RigVMTypeUtils : : PinTypeFromCPPType ( InModelPin - > GetCPPType ( ) , InModelPin - > GetCPPTypeObject ( ) ) ;
2020-09-24 00:43:27 -04:00
PinType . bIsConst = InModelPin - > IsDefinedAsConstant ( ) ;
2020-01-22 17:58:55 -05:00
return PinType ;
2019-05-29 11:33:11 -04:00
}
2022-03-14 10:19:31 -04:00
void UControlRigGraphNode : : ConfigurePin ( UEdGraphPin * EdGraphPin , URigVMPin * ModelPin , bool bHidden , bool bConnectable )
{
EdGraphPin - > bHidden = bHidden ;
EdGraphPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
EdGraphPin - > bNotConnectable = ! bConnectable ;
EdGraphPin - > bOrphanedPin = ModelPin - > IsOrphanPin ( ) ? 1 : 0 ;
EdGraphPin - > bDisplayAsMutableRef = ModelPin - > IsWildCard ( ) ;
}
2018-04-12 16:57:51 -04:00
# undef LOCTEXT_NAMESPACE