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"
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"
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
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
{
2020-12-02 10:59:58 -04:00
if ( UnitNode - > GetScriptStruct ( ) - > 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 ) )
{
static const FString CollapseNodeString = TEXT ( " Collapsed Graph " ) ;
SubTitle = CollapseNodeString ;
}
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 ( " , " ) ) ;
Values . Swap ( 0 , 1 ) ;
Values . Swap ( 0 , 2 ) ;
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 ;
}
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 ( ) )
{
if ( ModelPin - > GetScriptStruct ( ) - > IsChildOf ( FRigVMExecuteContext : : StaticStruct ( ) ) )
{
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
{
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
Pair . InputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
}
}
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
{
2020-01-22 17:58:55 -05:00
Pair . OutputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
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 )
{
Pair . InputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
Pair . InputPin - > bNotConnectable = ModelPin - > GetDirection ( ) ! = ERigVMPinDirection : : Input ;
2021-04-07 13:09:20 -04:00
Pair . InputPin - > bOrphanedPin = ModelPin - > IsOrphanPin ( ) ? 1 : 0 ;
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
{
2020-02-04 11:06:23 -05:00
Pair . InputPin - > bHidden = bHidden ;
2020-01-22 17:58:55 -05:00
Pair . InputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
Pair . InputPin - > bNotConnectable = ModelPin - > GetDirection ( ) ! = ERigVMPinDirection : : IO ;
2021-04-07 13:09:20 -04:00
Pair . InputPin - > bOrphanedPin = ModelPin - > IsOrphanPin ( ) ? 1 : 0 ;
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
{
2020-02-04 11:06:23 -05:00
Pair . OutputPin - > bHidden = bHidden ;
2020-01-22 17:58:55 -05:00
Pair . OutputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
Pair . OutputPin - > bNotConnectable = ModelPin - > GetDirection ( ) ! = ERigVMPinDirection : : IO ;
2021-04-07 13:09:20 -04:00
Pair . OutputPin - > bOrphanedPin = ModelPin - > IsOrphanPin ( ) ? 1 : 0 ;
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 )
{
Pair . OutputPin - > PinFriendlyName = FText : : FromName ( ModelPin - > GetDisplayName ( ) ) ;
Pair . OutputPin - > bNotConnectable = ModelPin - > GetDirection ( ) ! = ERigVMPinDirection : : Output ;
2021-04-07 13:09:20 -04:00
Pair . OutputPin - > bOrphanedPin = ModelPin - > IsOrphanPin ( ) ? 1 : 0 ;
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 ( ) )
{
if ( Cast < URigVMParameterNode > ( ModelNode ) | | Cast < URigVMVariableNode > ( ModelNode ) )
{
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 ( ) | |
ModelNode - > IsA < URigVMFunctionEntryNode > ( ) | |
ModelNode - > IsA < URigVMFunctionReturnNode > ( ) | |
2021-04-01 11:21:50 -04:00
ModelNode - > IsA < URigVMFunctionReferenceNode > ( ) | |
ModelNode - > IsA < URigVMCollapseNode > ( ) | |
2021-08-18 06:18:21 -04:00
ModelNode - > IsLoopNode ( ) | |
2021-04-01 11:21:50 -04:00
Cast < URigVMUnitNode > ( ModelNode ) ! = nullptr ;
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 ;
static FSlateIcon FunctionIcon ( " EditorStyle " , " Kismet.AllClasses.FunctionIcon " ) ;
static FSlateIcon EventIcon ( " EditorStyle " , " GraphEditor.Event_16x " ) ;
2021-04-01 11:21:50 -04:00
static FSlateIcon EntryReturnIcon ( " EditorStyle " , " GraphEditor.Default_16x " ) ;
static FSlateIcon CollapsedNodeIcon ( " EditorStyle " , " GraphEditor.SubGraph_16x " ) ;
2021-08-18 06:18:21 -04:00
static FSlateIcon ArrayNodeIteratorIcon ( " EditorStyle " , " GraphEditor.Macro.ForEach_16x " ) ;
2021-01-14 15:00:40 -04:00
if ( URigVMNode * ModelNode = GetModelNode ( ) )
{
2021-04-01 11:21:50 -04:00
if ( ModelNode - > IsEvent ( ) )
2021-01-14 15:00:40 -04:00
{
return EventIcon ;
}
2021-04-01 11:21:50 -04:00
if ( ModelNode - > IsA < URigVMFunctionReferenceNode > ( ) )
{
return FunctionIcon ;
}
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 ) )
{
ensure ( UnitNode - > GetScriptStruct ( ) ) ;
FString IconPath ;
// icon path format: StyleSetName|StyleName|SmallStyleName|StatusOverlayStyleName
// the last two names are optional, see FSlateIcon() for reference
UnitNode - > GetScriptStruct ( ) - > GetStringMetaDataHierarchical ( FRigVMStruct : : IconMetaName , & IconPath ) ;
const int32 NumOfIconPathNames = 4 ;
FName IconPathNames [ NumOfIconPathNames ] = {
NAME_None , // StyleSetName
NAME_None , // StyleName
NAME_None , // SmallStyleName
NAME_None // StatusOverlayStyleName
} ;
int32 NameIndex = 0 ;
while ( ! IconPath . IsEmpty ( ) & & NameIndex < NumOfIconPathNames )
{
FString Left ;
FString Right ;
if ( ! IconPath . Split ( TEXT ( " | " ) , & Left , & Right ) )
{
Left = IconPath ;
}
IconPathNames [ NameIndex ] = FName ( * Left ) ;
NameIndex + + ;
IconPath = Right ;
}
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 ( ) ) )
{
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
{
2018-04-12 16:57:51 -04:00
BreakAllNodeLinks ( ) ;
2020-01-22 17:58:55 -05:00
if ( PropertyName_DEPRECATED . IsValid ( ) )
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
FControlRigBlueprintUtils : : RemoveMemberVariableIfNotUsed ( ControlRigBlueprint , PropertyName_DEPRECATED , this ) ;
}
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
}
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 | |
Pin - > PinType . PinCategory = = UEdGraphSchema_K2 : : AllObjectTypes
) )
{
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 ;
}
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 > ( ) ;
for ( UEdGraphPin * Pin : Pins )
{
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 ;
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
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 )
{
FEdGraphPinType PinType ;
PinType . ResetToDefaults ( ) ;
FName ModelPinCPPType = InModelPin - > IsArray ( ) ? * InModelPin - > GetArrayElementCppType ( ) : * InModelPin - > GetCPPType ( ) ;
if ( ModelPinCPPType = = TEXT ( " bool " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Boolean ;
}
else if ( ModelPinCPPType = = TEXT ( " int32 " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Int ;
}
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
# if ENABLE_BLUEPRINT_REAL_NUMBERS
else if ( ModelPinCPPType = = TEXT ( " float " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Real ;
PinType . PinSubCategory = UEdGraphSchema_K2 : : PC_Float ;
}
else if ( ModelPinCPPType = = TEXT ( " double " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Real ;
PinType . PinSubCategory = UEdGraphSchema_K2 : : PC_Double ;
}
# else
2020-01-22 17:58:55 -05:00
else if ( ModelPinCPPType = = TEXT ( " float " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Float ;
}
2021-06-22 14:11:52 -04:00
else if ( ModelPinCPPType = = TEXT ( " double " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Double ;
}
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
# endif
2020-01-22 17:58:55 -05:00
else if ( ModelPinCPPType = = TEXT ( " FName " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Name ;
}
else if ( ModelPinCPPType = = TEXT ( " FString " ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_String ;
}
else if ( InModelPin - > GetScriptStruct ( ) ! = nullptr )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Struct ;
PinType . PinSubCategoryObject = InModelPin - > GetScriptStruct ( ) ;
}
2021-10-19 06:24:52 -04:00
else if ( InModelPin - > IsUObject ( ) )
{
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Object ;
PinType . PinSubCategoryObject = InModelPin - > GetCPPTypeObject ( ) ;
}
2020-01-22 17:58:55 -05:00
else if ( InModelPin - > GetEnum ( ) ! = nullptr )
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
{
2020-01-22 17:58:55 -05:00
PinType . PinCategory = UEdGraphSchema_K2 : : PC_Byte ;
PinType . PinSubCategoryObject = InModelPin - > GetEnum ( ) ;
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
}
2020-01-22 17:58:55 -05:00
if ( InModelPin - > IsArray ( ) )
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
{
2020-01-22 17:58:55 -05:00
PinType . ContainerType = EPinContainerType : : Array ;
Merging //UE5/Dev-LargeWorldCoordinates [at] 18802167 to //UE5/Release-5.0
Blueprint real number support.
This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures).
One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code.
The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG.
#rb marc.audy (serialization changes)
#jira UE-116484
#preflight 61f8bdd5a2514ba12ff7bdfc
#ROBOMERGE-AUTHOR: dave.jones2
#ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18823569 by dave jones2 in ue5-main branch]
2022-02-02 05:50:50 -05:00
}
2020-01-22 17:58:55 -05:00
else
{
PinType . ContainerType = EPinContainerType : : None ;
}
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
}
2018-04-12 16:57:51 -04:00
# undef LOCTEXT_NAMESPACE