2019-12-26 15:33:43 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-09-17 19:12:19 -04:00
# pragma once
# include "RigVMGraph.h"
2021-01-06 14:01:38 -04:00
# include "RigVMFunctionLibrary.h"
2020-12-02 10:59:58 -04:00
# include "RigVMModel/Nodes/RigVMUnitNode.h"
2019-09-17 19:12:19 -04:00
# include "RigVMModel/Nodes/RigVMVariableNode.h"
# include "RigVMModel/Nodes/RigVMParameterNode.h"
# include "RigVMModel/Nodes/RigVMCommentNode.h"
# include "RigVMModel/Nodes/RigVMRerouteNode.h"
2020-09-24 00:43:27 -04:00
# include "RigVMModel/Nodes/RigVMBranchNode.h"
# include "RigVMModel/Nodes/RigVMIfNode.h"
# include "RigVMModel/Nodes/RigVMSelectNode.h"
2022-03-01 04:23:55 -05:00
# include "RigVMModel/Nodes/RigVMTemplateNode.h"
2020-09-24 00:43:27 -04:00
# include "RigVMModel/Nodes/RigVMEnumNode.h"
2020-11-26 05:45:07 -04:00
# include "RigVMModel/Nodes/RigVMCollapseNode.h"
2021-01-06 14:01:38 -04:00
# include "RigVMModel/Nodes/RigVMFunctionReferenceNode.h"
2021-08-18 06:18:21 -04:00
# include "RigVMModel/Nodes/RigVMArrayNode.h"
2022-06-01 05:56:08 -04:00
# include "RigVMModel/Nodes/RigVMInvokeEntryNode.h"
2022-02-10 13:08:01 -05:00
# include "RigVMModel/RigVMBuildData.h"
2022-04-05 06:16:59 -04:00
# include "RigVMCore/RigVMUserWorkflow.h"
2022-04-06 08:26:45 -04:00
# include "UObject/Interface.h"
2019-09-17 19:12:19 -04:00
# include "RigVMController.generated.h"
2022-03-01 04:23:55 -05:00
# ifndef UE_RIGVM_ENABLE_TEMPLATE_NODES
2022-03-14 12:19:10 -04:00
# define UE_RIGVM_ENABLE_TEMPLATE_NODES 1
2022-03-01 04:23:55 -05:00
# endif
2019-09-17 19:12:19 -04:00
class URigVMActionStack ;
2022-11-16 03:33:17 -05:00
struct FRigVMGraphFunctionArgument ;
struct FRigVMGraphFunctionHeader ;
2019-09-17 19:12:19 -04:00
2021-04-29 07:44:28 -04:00
UENUM ( )
enum class ERigVMControllerBulkEditType : uint8
{
AddExposedPin ,
RemoveExposedPin ,
RenameExposedPin ,
ChangeExposedPinType ,
AddVariable ,
RemoveVariable ,
RenameVariable ,
ChangeVariableType ,
2021-08-05 11:41:14 -04:00
RemoveFunction ,
2021-04-29 07:44:28 -04:00
Max UMETA ( Hidden ) ,
} ;
UENUM ( )
enum class ERigVMControllerBulkEditProgress : uint8
{
BeginLoad ,
FinishedLoad ,
BeginEdit ,
FinishedEdit ,
Max UMETA ( Hidden ) ,
} ;
2021-06-24 10:50:40 -04:00
struct FRigVMController_BulkEditResult
{
bool bCanceled ;
bool bSetupUndoRedo ;
FRigVMController_BulkEditResult ( )
: bCanceled ( false )
, bSetupUndoRedo ( true )
{ }
} ;
2021-09-10 10:04:27 -04:00
class RIGVMDEVELOPER_API FRigVMControllerCompileBracketScope
{
public :
FRigVMControllerCompileBracketScope ( URigVMController * InController ) ;
~ FRigVMControllerCompileBracketScope ( ) ;
private :
URigVMGraph * Graph ;
bool bSuspendNotifications ;
} ;
2020-01-22 17:58:55 -05:00
DECLARE_DELEGATE_RetVal_OneParam ( bool , FRigVMController_ShouldStructUnfoldDelegate , const UStruct * )
2021-04-27 03:19:42 -04:00
DECLARE_DELEGATE_RetVal_OneParam ( TArray < FRigVMExternalVariable > , FRigVMController_GetExternalVariablesDelegate , URigVMGraph * )
2021-01-26 04:06:19 -04:00
DECLARE_DELEGATE_RetVal ( const FRigVMByteCode * , FRigVMController_GetByteCodeDelegate )
2022-11-16 03:33:17 -05:00
DECLARE_DELEGATE_RetVal_OneParam ( bool , FRigVMController_RequestLocalizeFunctionDelegate , TSoftObjectPtr < URigVMLibraryNode > )
2021-09-10 10:04:27 -04:00
DECLARE_DELEGATE_RetVal_ThreeParams ( FName , FRigVMController_RequestNewExternalVariableDelegate , FRigVMGraphVariableDescription , bool , bool ) ;
2022-11-16 03:33:17 -05:00
DECLARE_DELEGATE_RetVal_TwoParams ( bool , FRigVMController_IsDependencyCyclicDelegate , const FRigVMGraphFunctionHeader & Dependent , const FRigVMGraphFunctionHeader & Dependency )
2021-06-24 10:50:40 -04:00
DECLARE_DELEGATE_RetVal_TwoParams ( FRigVMController_BulkEditResult , FRigVMController_RequestBulkEditDialogDelegate , URigVMLibraryNode * , ERigVMControllerBulkEditType )
2022-05-09 07:34:28 -04:00
DECLARE_DELEGATE_RetVal_OneParam ( bool , FRigVMController_RequestBreakLinksDialogDelegate , TArray < URigVMLink * > )
2021-04-29 07:44:28 -04:00
DECLARE_DELEGATE_FiveParams ( FRigVMController_OnBulkEditProgressDelegate , TSoftObjectPtr < URigVMFunctionReferenceNode > , ERigVMControllerBulkEditType , ERigVMControllerBulkEditProgress , int32 , int32 )
2022-03-07 12:07:36 -05:00
DECLARE_DELEGATE_RetVal_TwoParams ( FString , FRigVMController_PinPathRemapDelegate , const FString & /* InPinPath */ , bool /* bIsInput */ ) ;
2022-03-14 10:19:31 -04:00
DECLARE_DELEGATE_OneParam ( FRigVMController_RequestJumpToHyperlinkDelegate , const UObject * InSubject ) ;
2022-04-05 06:16:59 -04:00
DECLARE_DELEGATE_OneParam ( FRigVMController_ConfigureWorkflowOptionsDelegate , URigVMUserWorkflowOptions * InOutOptions ) ;
2022-05-06 07:42:47 -04:00
DECLARE_DELEGATE_RetVal_TwoParams ( bool , FRigVMController_CheckPinComatibilityDelegate , URigVMPin * , URigVMPin * ) ;
2020-01-22 17:58:55 -05:00
2022-04-12 05:58:44 -04:00
USTRUCT ( BlueprintType )
struct RIGVMDEVELOPER_API FRigStructScope
{
GENERATED_BODY ( )
public :
FRigStructScope ( )
: ScriptStruct ( nullptr )
, Memory ( nullptr )
{ }
template <
typename T ,
typename TEnableIf < TModels < CRigVMUStruct , T > : : Value > : : Type * = nullptr
>
FRigStructScope ( const T & InInstance )
: ScriptStruct ( T : : StaticStruct ( ) )
, Memory ( ( const uint8 * ) & InInstance )
{ }
FRigStructScope ( const FStructOnScope & InScope )
: ScriptStruct ( Cast < UScriptStruct > ( InScope . GetStruct ( ) ) )
, Memory ( InScope . GetStructMemory ( ) )
{ }
const UScriptStruct * GetScriptStruct ( ) const { return ScriptStruct ; }
const uint8 * GetMemory ( ) const { return Memory ; }
bool IsValid ( ) const { return ScriptStruct ! = nullptr & & Memory ! = nullptr ; }
protected :
const UScriptStruct * ScriptStruct ;
const uint8 * Memory ;
} ;
2019-09-17 19:12:19 -04:00
/**
* The Controller is the sole authority to perform changes
* on the Graph . The Controller itself is stateless .
* The Controller offers a Modified event to subscribe to
* for user interface views - so they can be informed about
* any change that ' s happening within the Graph .
* The Controller routes all changes through the Graph itself ,
* so you can have N Controllers performing edits on 1 Graph ,
* and N Views subscribing to 1 Controller .
* In Python you can also subscribe to this event to be
* able to react to topological changes of the Graph there .
*/
UCLASS ( BlueprintType )
2020-01-22 17:58:55 -05:00
class RIGVMDEVELOPER_API URigVMController : public UObject
2019-09-17 19:12:19 -04:00
{
GENERATED_UCLASS_BODY ( )
public :
// Default constructor
URigVMController ( ) ;
// Default destructor
~ URigVMController ( ) ;
2022-10-14 12:42:43 -04:00
# if WITH_EDITORONLY_DATA
static void DeclareConstructClasses ( TArray < FTopLevelAssetPath > & OutConstructClasses , const UClass * SpecificSubclass ) ;
# endif
2019-09-17 19:12:19 -04:00
// Returns the currently edited Graph of this controller.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMGraph * GetGraph ( ) const ;
// Sets the currently edited Graph of this controller.
// This causes a GraphChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
void SetGraph ( URigVMGraph * InGraph ) ;
2020-12-14 08:58:12 -04:00
// Pushes a new graph to the stack
// This causes a GraphChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
void PushGraph ( URigVMGraph * InGraph , bool bSetupUndoRedo = true ) ;
// Pops the last graph off the stack
// This causes a GraphChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMGraph * PopGraph ( bool bSetupUndoRedo = true ) ;
// Returns the top level graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMGraph * GetTopLevelGraph ( ) const ;
2019-09-17 19:12:19 -04:00
// The Modified event used to subscribe to changes
// happening within the Graph. This is broadcasted to
// for any change happening - not only the changes
// performed by this Controller - so it can be used
// for UI Views to react accordingly.
FRigVMGraphModifiedEvent & OnModified ( ) ;
2020-01-22 17:58:55 -05:00
// Submits an event to the graph for broadcasting.
2021-10-19 07:53:34 -04:00
void Notify ( ERigVMGraphNotifType InNotifType , UObject * InSubject ) const ;
2020-01-22 17:58:55 -05:00
// Resends all notifications
void ResendAllNotifications ( ) ;
2019-09-17 19:12:19 -04:00
// Enables or disables the error reporting of this Controller.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
void EnableReporting ( bool bEnabled = true ) { bReportWarningsAndErrors = bEnabled ; }
2020-06-23 18:40:00 -04:00
// Returns true if reporting is enabled
UFUNCTION ( BlueprintPure , Category = RigVMController )
bool IsReportingEnabled ( ) const { return bReportWarningsAndErrors ; }
2021-06-16 13:02:50 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
TArray < FString > GeneratePythonCommands ( ) ;
TArray < FString > GetAddNodePythonCommands ( URigVMNode * Node ) const ;
2019-09-17 19:12:19 -04:00
# if WITH_EDITOR
// Note: The functions below are scoped with WITH_EDITOR since we are considering
// to move this code into the runtime in the future. Right now there's a dependency
// on the metadata of the USTRUCT - which is only available in the editor.
// Adds a Function / Struct Node to the edited Graph.
2020-12-02 10:59:58 -04:00
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
2019-09-17 19:12:19 -04:00
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMUnitNode * AddUnitNode ( UScriptStruct * InScriptStruct , const FName & InMethodName = TEXT ( " Execute " ) , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Function / Struct Node to the edited Graph given its struct object path name.
2020-12-02 10:59:58 -04:00
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
2019-09-17 19:12:19 -04:00
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMUnitNode * AddUnitNodeFromStructPath ( const FString & InScriptStructPath , const FName & InMethodName = TEXT ( " Execute " ) , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2022-04-12 05:58:44 -04:00
// Adds a unit node using a template
template <
typename T ,
typename TEnableIf < TModels < CRigVMUStruct , T > : : Value > : : Type * = nullptr
>
URigVMUnitNode * AddUnitNode ( const T & InDefaults , const FName & InMethodName = TEXT ( " Execute " ) , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false )
{
return AddUnitNodeWithDefaults ( T : : StaticStruct ( ) , InDefaults , InMethodName , InPosition , InNodeName , bSetupUndoRedo , bPrintPythonCommand ) ;
}
// Adds a Function / Struct Node to the edited Graph.
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMUnitNode * AddUnitNodeWithDefaults ( UScriptStruct * InScriptStruct , const FString & InDefaults , const FName & InMethodName = TEXT ( " Execute " ) , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
// Adds a Function / Struct Node to the edited Graph.
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
// This causes a NodeAdded modified event.
URigVMUnitNode * AddUnitNodeWithDefaults ( UScriptStruct * InScriptStruct , const FRigStructScope & InDefaults , const FName & InMethodName = TEXT ( " Execute " ) , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
// Adds a Function / Struct Node to the edited Graph.
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2022-04-14 06:28:01 -04:00
bool SetUnitNodeDefaults ( URigVMUnitNode * InNode , const FString & InDefaults , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-04-12 05:58:44 -04:00
bool SetUnitNodeDefaults ( URigVMUnitNode * InNode , const FRigStructScope & InDefaults , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Variable Node to the edited Graph.
// Variables represent local work state for the function and
// can be read from and written to.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMVariableNode * AddVariableNode ( const FName & InVariableName , const FString & InCPPType , UObject * InCPPTypeObject , bool bIsGetter , const FString & InDefaultValue , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Variable Node to the edited Graph given a struct object path name.
// Variables represent local work state for the function and
// can be read from (bIsGetter == true) or written to (bIsGetter == false).
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMVariableNode * AddVariableNodeFromObjectPath ( const FName & InVariableName , const FString & InCPPType , const FString & InCPPTypeObjectPath , bool bIsGetter , const FString & InDefaultValue , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-09-24 00:43:27 -04:00
// Refreshes the variable node with the new data
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-09-27 11:50:32 -04:00
void RefreshVariableNode ( const FName & InNodeName , const FName & InVariableName , const FString & InCPPType , UObject * InCPPTypeObject , bool bSetupUndoRedo , bool bSetupOrphanPins = true ) ;
2020-09-24 00:43:27 -04:00
// Removes all nodes related to a given variable
2021-07-22 04:23:56 -04:00
void OnExternalVariableRemoved ( const FName & InVarName , bool bSetupUndoRedo ) ;
2020-09-24 00:43:27 -04:00
// Renames the variable name in all relevant nodes
2022-03-18 07:41:19 -04:00
bool OnExternalVariableRenamed ( const FName & InOldVarName , const FName & InNewVarName , bool bSetupUndoRedo ) ;
2020-09-24 00:43:27 -04:00
// Changes the data type of all nodes matching a given variable name
2021-07-22 04:23:56 -04:00
void OnExternalVariableTypeChanged ( const FName & InVarName , const FString & InCPPType , UObject * InCPPTypeObject , bool bSetupUndoRedo ) ;
2021-07-19 06:35:29 -04:00
void OnExternalVariableTypeChangedFromObjectPath ( const FName & InVarName , const FString & InCPPType , const FString & InCPPTypeObjectPath , bool bSetupUndoRedo ) ;
2020-09-24 00:43:27 -04:00
// Refreshes the variable node with the new data
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
URigVMVariableNode * ReplaceParameterNodeWithVariable ( const FName & InNodeName , const FName & InVariableName , const FString & InCPPType , UObject * InCPPTypeObject , bool bSetupUndoRedo ) ;
2020-09-24 00:43:27 -04:00
2022-03-14 10:19:31 -04:00
// Turns a resolved templated node(s) back into its template.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool UnresolveTemplateNodes ( const TArray < FName > & InNodeNames , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-09-06 11:24:29 -04:00
bool UnresolveTemplateNodes ( const TArray < URigVMNode * > & InNodes , bool bSetupUndoRedo , bool bBreakLinks = true ) ;
2022-03-14 10:19:31 -04:00
2022-03-07 12:07:36 -05:00
// Upgrades a set of nodes with each corresponding next known version
UFUNCTION ( BlueprintCallable , Category = RigVMController )
TArray < URigVMNode * > UpgradeNodes ( const TArray < FName > & InNodeNames , bool bRecursive = true , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Parameter Node to the edited Graph.
// Parameters represent input or output arguments to the Graph / Function.
// Input Parameters are constant values / literals.
// This causes a NodeAdded modified event.
2022-03-07 10:20:24 -05:00
UFUNCTION ( BlueprintCallable , Category = RigVMController , meta = ( DeprecatedFunction ) )
2021-07-19 06:35:29 -04:00
URigVMParameterNode * AddParameterNode ( const FName & InParameterName , const FString & InCPPType , UObject * InCPPTypeObject , bool bIsInput , const FString & InDefaultValue , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Parameter Node to the edited Graph given a struct object path name.
// Parameters represent input or output arguments to the Graph / Function.
// Input Parameters are constant values / literals.
// This causes a NodeAdded modified event.
2022-03-07 10:20:24 -05:00
UFUNCTION ( BlueprintCallable , Category = RigVMController , meta = ( DeprecatedFunction ) )
2021-07-19 06:35:29 -04:00
URigVMParameterNode * AddParameterNodeFromObjectPath ( const FName & InParameterName , const FString & InCPPType , const FString & InCPPTypeObjectPath , bool bIsInput , const FString & InDefaultValue , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Comment Node to the edited Graph.
// Comments can be used to annotate the Graph.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMCommentNode * AddCommentNode ( const FString & InCommentText , const FVector2D & InPosition = FVector2D : : ZeroVector , const FVector2D & InSize = FVector2D ( 400.f , 300.f ) , const FLinearColor & InColor = FLinearColor : : Black , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Reroute Node on an existing Link to the edited Graph.
// Reroute Nodes can be used to visually improve the data flow,
// they don't require any additional memory though and are purely
// cosmetic. This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMRerouteNode * AddRerouteNodeOnLink ( URigVMLink * InLink , bool bShowAsFullNode , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Reroute Node on an existing Link to the edited Graph given the Link's string representation.
// Reroute Nodes can be used to visually improve the data flow,
// they don't require any additional memory though and are purely
// cosmetic. This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMRerouteNode * AddRerouteNodeOnLinkPath ( const FString & InLinkPinPathRepresentation , bool bShowAsFullNode , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Adds a Reroute Node on an existing Pin to the editor Graph.
// Reroute Nodes can be used to visually improve the data flow,
// they don't require any additional memory though and are purely
// cosmetic. This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMRerouteNode * AddRerouteNodeOnPin ( const FString & InPinPath , bool bAsInput , bool bShowAsFullNode , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
// Adds a free Reroute Node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
URigVMRerouteNode * AddFreeRerouteNode ( bool bShowAsFullNode , const FString & InCPPType , const FName & InCPPTypeObjectPath , bool bIsConstant , const FName & InCustomWidgetName , const FString & InDefaultValue , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true ) ;
2020-01-22 17:58:55 -05:00
2020-09-24 00:43:27 -04:00
// Adds a branch node to the graph.
// Branch nodes can be used to split the execution of into multiple branches,
// allowing to drive behavior by logic.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMBranchNode * AddBranchNode ( const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-09-24 00:43:27 -04:00
// Adds an if node to the graph.
// If nodes can be used to pick between two values based on a condition.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMIfNode * AddIfNode ( const FString & InCPPType , const FName & InCPPTypeObjectPath , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-10-01 08:08:39 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMIfNode * AddIfNodeFromStruct ( UScriptStruct * InScriptStruct , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true ) ;
2020-09-24 00:43:27 -04:00
// Adds a select node to the graph.
// Select nodes can be used to pick between multiple values based on an index.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMSelectNode * AddSelectNode ( const FString & InCPPType , const FName & InCPPTypeObjectPath , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-07-12 05:43:35 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMSelectNode * AddSelectNodeFromStruct ( UScriptStruct * InScriptStruct , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true ) ;
2022-03-01 04:23:55 -05:00
// Adds a template node to the graph.
2020-09-24 00:43:27 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2022-03-01 04:23:55 -05:00
URigVMTemplateNode * AddTemplateNode ( const FName & InNotation , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-03-14 10:19:31 -04:00
// Returns all registered unit structs
UFUNCTION ( BlueprintCallable , Category = RigVMController )
static TArray < UScriptStruct * > GetRegisteredUnitStructs ( ) ;
// Returns all registered template notations
UFUNCTION ( BlueprintCallable , Category = RigVMController )
static TArray < FString > GetRegisteredTemplates ( ) ;
// Returns all supported unit structs for a given template notation
UFUNCTION ( BlueprintCallable , Category = RigVMController )
static TArray < UScriptStruct * > GetUnitStructsForTemplate ( const FName & InNotation ) ;
// Returns the template for a given function (or an empty string)
UFUNCTION ( BlueprintCallable , Category = RigVMController )
static FString GetTemplateForUnitStruct ( UScriptStruct * InFunction , const FString & InMethodName = TEXT ( " Execute " ) ) ;
2022-03-01 04:23:55 -05:00
// Resolves a wildcard pin on any node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool ResolveWildCardPin ( const FString & InPinPath , const FString & InCPPType , const FName & InCPPTypeObjectPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-06-07 11:01:59 -04:00
bool ResolveWildCardPin ( URigVMPin * InPin , const FRigVMTemplateArgumentType & InType , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-07-05 11:39:15 -04:00
bool ResolveWildCardPin ( const FString & InPinPath , TRigVMTypeIndex InTypeIndex , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
bool ResolveWildCardPin ( URigVMPin * InPin , TRigVMTypeIndex InTypeIndex , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-06-28 13:41:23 -04:00
2020-01-22 17:58:55 -05:00
// Adds a Function / Struct Node to the edited Graph as an injected node
2020-12-02 10:59:58 -04:00
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
2020-01-22 17:58:55 -05:00
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMInjectionInfo * AddInjectedNode ( const FString & InPinPath , bool bAsInput , UScriptStruct * InScriptStruct , const FName & InMethodName , const FName & InInputPinName , const FName & InOutputPinName , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
// Adds a Function / Struct Node to the edited Graph as an injected node
2020-12-02 10:59:58 -04:00
// UnitNode represent a RIGVM_METHOD declaration on a USTRUCT.
2020-01-22 17:58:55 -05:00
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
URigVMInjectionInfo * AddInjectedNodeFromStructPath ( const FString & InPinPath , bool bAsInput , const FString & InScriptStructPath , const FName & InMethodName , const FName & InInputPinName , const FName & InOutputPinName , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true ) ;
2020-01-22 17:58:55 -05:00
2022-01-10 10:15:49 -05:00
// Removes an injected node
// This causes a NodeRemoved modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool RemoveInjectedNode ( const FString & InPinPath , bool bAsInput , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
// Ejects the last injected node on a pin
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMNode * EjectNodeFromPin ( const FString & InPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-09-24 00:43:27 -04:00
// Adds an enum node to the graph
// Enum nodes can be used to represent constant enum values within the graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMEnumNode * AddEnumNode ( const FName & InCPPTypeObjectPath , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-09-24 00:43:27 -04:00
2021-08-18 06:18:21 -04:00
// Adds a Array Node to the edited Graph.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMArrayNode * AddArrayNode ( ERigVMOpCode InOpCode , const FString & InCPPType , UObject * InCPPTypeObject , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
// Adds a Array Node to the edited Graph given a struct object path name.
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMArrayNode * AddArrayNodeFromObjectPath ( ERigVMOpCode InOpCode , const FString & InCPPType , const FString & InCPPTypeObjectPath , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-06-01 05:56:08 -04:00
// Adds an entry invocation node
// This causes a NodeAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMInvokeEntryNode * AddInvokeEntryNode ( const FName & InEntryName , const FVector2D & InPosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Un-does the last action on the stack.
// Note: This should really only be used for unit tests,
// use the GEditor's main Undo method instead.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool Undo ( ) ;
// Re-does the last action on the stack.
// Note: This should really only be used for unit tests,
// use the GEditor's main Undo method instead.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool Redo ( ) ;
// Opens an undo bracket / scoped transaction for
// a series of actions to be performed as one step on the
// Undo stack. This is primarily useful for Python.
2020-01-22 17:58:55 -05:00
// This causes a UndoBracketOpened modified event.
2019-09-17 19:12:19 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool OpenUndoBracket ( const FString & InTitle ) ;
// Closes an undo bracket / scoped transaction.
// This is primarily useful for Python.
2020-01-22 17:58:55 -05:00
// This causes a UndoBracketClosed modified event.
2019-09-17 19:12:19 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool CloseUndoBracket ( ) ;
2020-01-22 17:58:55 -05:00
// Cancels an undo bracket / scoped transaction.
// This is primarily useful for Python.
// This causes a UndoBracketCanceled modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool CancelUndoBracket ( ) ;
// Exports the given nodes as text
UFUNCTION ( BlueprintCallable , Category = RigVMController )
FString ExportNodesToText ( const TArray < FName > & InNodeNames ) ;
// Exports the selected nodes as text
UFUNCTION ( BlueprintCallable , Category = RigVMController )
FString ExportSelectedNodesToText ( ) ;
// Exports the given nodes as text
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool CanImportNodesFromText ( const FString & InText ) ;
// Exports the given nodes as text
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-27 09:37:12 -04:00
TArray < FName > ImportNodesFromText ( const FString & InText , bool bSetupUndoRedo = true , bool bPrintPythonCommands = false ) ;
2020-01-22 17:58:55 -05:00
2021-03-10 05:52:25 -04:00
// Copies a function declaration into this graph's local function library
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMLibraryNode * LocalizeFunction (
URigVMLibraryNode * InFunctionDefinition ,
bool bLocalizeDependentPrivateFunctions = true ,
2021-07-19 06:35:29 -04:00
bool bSetupUndoRedo = true ,
bool bPrintPythonCommand = false ) ;
2021-03-10 05:52:25 -04:00
// Copies a series of function declaratioms into this graph's local function library
2021-07-19 06:35:29 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-03-10 05:52:25 -04:00
TMap < URigVMLibraryNode * , URigVMLibraryNode * > LocalizeFunctions (
TArray < URigVMLibraryNode * > InFunctionDefinitions ,
bool bLocalizeDependentPrivateFunctions = true ,
2021-07-19 06:35:29 -04:00
bool bSetupUndoRedo = true ,
bool bPrintPythonCommand = false ) ;
2021-03-10 05:52:25 -04:00
2020-01-22 17:58:55 -05:00
// Returns a unique name
2021-09-09 10:12:46 -04:00
static FName GetUniqueName ( const FName & InName , TFunction < bool ( const FName & ) > IsNameAvailableFunction , bool bAllowPeriod , bool bAllowSpace ) ;
2020-01-22 17:58:55 -05:00
2020-11-26 05:45:07 -04:00
// Turns a series of nodes into a Collapse node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2022-03-28 05:56:56 -04:00
URigVMCollapseNode * CollapseNodes ( const TArray < FName > & InNodeNames , const FString & InCollapseNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , bool bIsAggregate = false ) ;
2020-11-26 05:45:07 -04:00
// Turns a library node into its contained nodes
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
TArray < URigVMNode * > ExpandLibraryNode ( const FName & InNodeName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-11-26 05:45:07 -04:00
2021-01-19 04:58:31 -04:00
// Turns a collapse node into a function node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-11-11 09:37:24 -05:00
FName PromoteCollapseNodeToFunctionReferenceNode ( const FName & InNodeName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , const FString & InExistingFunctionDefinitionPath = TEXT ( " " ) ) ;
2021-01-19 04:58:31 -04:00
// Turns a collapse node into a function node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-11-11 09:37:24 -05:00
FName PromoteFunctionReferenceNodeToCollapseNode ( const FName & InNodeName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , bool bRemoveFunctionDefinition = false ) ;
2021-01-19 04:58:31 -04:00
2019-09-17 19:12:19 -04:00
# endif
// Removes a node from the graph
// This causes a NodeRemoved modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-10-11 05:19:26 -04:00
bool RemoveNode ( URigVMNode * InNode , bool bSetupUndoRedo = true , bool bRecursive = false , bool bPrintPythonCommand = false , bool bRelinkPins = false ) ;
2019-09-17 19:12:19 -04:00
// Removes a node from the graph given the node's name.
// This causes a NodeRemoved modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-10-11 05:19:26 -04:00
bool RemoveNodeByName ( const FName & InNodeName , bool bSetupUndoRedo = true , bool bRecursive = false , bool bPrintPythonCommand = false , bool bRelinkPins = false ) ;
2020-12-14 08:58:12 -04:00
// Renames a node in the graph
// This causes a NodeRenamed modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-22 05:00:14 -04:00
bool RenameNode ( URigVMNode * InNode , const FName & InNewName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-12-14 08:58:12 -04:00
2019-09-17 19:12:19 -04:00
// Selects a single node in the graph.
// This causes a NodeSelected / NodeDeselected modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SelectNode ( URigVMNode * InNode , bool bSelect = true , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Selects a single node in the graph by name.
// This causes a NodeSelected / NodeDeselected modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
bool SelectNodeByName ( const FName & InNodeName , bool bSelect = true , bool bSetupUndoRedo = true ) ;
2019-09-17 19:12:19 -04:00
// Deselects all currently selected nodes in the graph.
// This might cause several NodeDeselected modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool ClearNodeSelection ( bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-01-22 17:58:55 -05:00
// Selects the nodes given the selection
// This might cause several NodeDeselected modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeSelection ( const TArray < FName > & InNodeNames , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
2019-09-17 19:12:19 -04:00
// Sets the position of a node in the graph.
// This causes a NodePositionChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodePosition ( URigVMNode * InNode , const FVector2D & InPosition , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the position of a node in the graph by name.
// This causes a NodePositionChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodePositionByName ( const FName & InNodeName , const FVector2D & InPosition , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the size of a node in the graph.
// This causes a NodeSizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeSize ( URigVMNode * InNode , const FVector2D & InSize , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the size of a node in the graph by name.
// This causes a NodeSizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeSizeByName ( const FName & InNodeName , const FVector2D & InSize , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the color of a node in the graph.
// This causes a NodeColorChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeColor ( URigVMNode * InNode , const FLinearColor & InColor , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the color of a node in the graph by name.
// This causes a NodeColorChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
bool SetNodeColorByName ( const FName & InNodeName , const FLinearColor & InColor , bool bSetupUndoRedo = true , bool bMergeUndoAction = false ) ;
2019-09-17 19:12:19 -04:00
2021-01-27 05:06:20 -04:00
// Sets the category of a node in the graph.
// This causes a NodeCategoryChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeCategory ( URigVMCollapseNode * InNode , const FString & InCategory , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2021-01-27 05:06:20 -04:00
// Sets the category of a node in the graph.
// This causes a NodeCategoryChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool SetNodeCategoryByName ( const FName & InNodeName , const FString & InCategory , bool bSetupUndoRedo = true , bool bMergeUndoAction = false ) ;
// Sets the keywords of a node in the graph.
// This causes a NodeKeywordsChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeKeywords ( URigVMCollapseNode * InNode , const FString & InKeywords , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2021-01-27 05:06:20 -04:00
// Sets the keywords of a node in the graph.
// This causes a NodeKeywordsChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool SetNodeKeywordsByName ( const FName & InNodeName , const FString & InKeywords , bool bSetupUndoRedo = true , bool bMergeUndoAction = false ) ;
2021-06-08 12:10:13 -04:00
// Sets the function description of a node in the graph.
// This causes a NodeDescriptionChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetNodeDescription ( URigVMCollapseNode * InNode , const FString & InDescription , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2021-06-08 12:10:13 -04:00
// Sets the keywords of a node in the graph.
// This causes a NodeDescriptionChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool SetNodeDescriptionByName ( const FName & InNodeName , const FString & InDescription , bool bSetupUndoRedo = true , bool bMergeUndoAction = false ) ;
2021-10-25 04:25:30 -04:00
// Sets the comment text and properties of a comment node in the graph.
2019-09-17 19:12:19 -04:00
// This causes a CommentTextChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-10-25 04:25:30 -04:00
bool SetCommentText ( URigVMNode * InNode , const FString & InCommentText , const int32 & InCommentFontSize , const bool & bInCommentBubbleVisible , const bool & bInCommentColorBubble , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2021-10-25 04:25:30 -04:00
// Sets the comment text and properties of a comment node in the graph by name.
2019-09-17 19:12:19 -04:00
// This causes a CommentTextChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-10-25 04:25:30 -04:00
bool SetCommentTextByName ( const FName & InNodeName , const FString & InCommentText , const int32 & InCommentFontSize , const bool & bInCommentBubbleVisible , const bool & bInCommentColorBubble , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the compactness of a reroute node in the graph.
// This causes a RerouteCompactnessChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetRerouteCompactness ( URigVMNode * InNode , bool bShowAsFullNode , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Sets the compactness of a reroute node in the graph by name.
// This causes a RerouteCompactnessChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
bool SetRerouteCompactnessByName ( const FName & InNodeName , bool bShowAsFullNode , bool bSetupUndoRedo = true ) ;
2019-09-17 19:12:19 -04:00
// Renames a variable in the graph.
// This causes a VariableRenamed modified event.
2022-03-18 07:41:19 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController , meta = ( DeprecatedFunction ) )
2020-10-27 03:30:51 -04:00
bool RenameVariable ( const FName & InOldName , const FName & InNewName , bool bSetupUndoRedo = true ) ;
2019-09-17 19:12:19 -04:00
// Renames a parameter in the graph.
// This causes a ParameterRenamed modified event.
2022-03-07 10:20:24 -05:00
UFUNCTION ( BlueprintCallable , Category = RigVMController , meta = ( DeprecatedFunction ) )
2022-03-07 12:07:36 -05:00
bool RenameParameter ( const FName & InOldName , const FName & InNewName , bool bSetupUndoRedo = true ) ; \
// Upgrades a set of nodes with each corresponding next known version
TArray < URigVMNode * > UpgradeNodes ( const TArray < URigVMNode * > & InNodes , bool bRecursive = true , bool bSetupUndoRedo = true ) ;
// Upgrades a single node with its next known version
URigVMNode * UpgradeNode ( URigVMNode * InNode , bool bSetupUndoRedo = true , FRigVMController_PinPathRemapDelegate * OutRemapPinDelegate = nullptr ) ;
2019-09-17 19:12:19 -04:00
2020-01-22 17:58:55 -05:00
// Sets the pin to be expanded or not
// This causes a PinExpansionChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetPinExpansion ( const FString & InPinPath , bool bIsExpanded , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
// Sets the pin to be watched (or not)
// This causes a PinWatchedChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2020-10-27 03:30:51 -04:00
bool SetPinIsWatched ( const FString & InPinPath , bool bIsWatched , bool bSetupUndoRedo = true ) ;
2020-01-22 17:58:55 -05:00
2019-09-17 19:12:19 -04:00
// Returns the default value of a pin given its pinpath.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
FString GetPinDefaultValue ( const FString & InPinPath ) ;
// Sets the default value of a pin given its pinpath.
// This causes a PinDefaultValueChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetPinDefaultValue ( const FString & InPinPath , const FString & InDefaultValue , bool bResizeArrays = true , bool bSetupUndoRedo = true , bool bMergeUndoAction = false , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-01-22 17:58:55 -05:00
// Resets the default value of a pin given its pinpath.
// This causes a PinDefaultValueChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool ResetPinDefaultValue ( const FString & InPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
2022-03-28 05:56:56 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
FString AddAggregatePin ( const FString & InNodeName , const FString & InPinName , const FString & InDefaultValue = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool RemoveAggregatePin ( const FString & InPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2022-03-30 05:21:45 -04:00
# if UE_RIGVM_AGGREGATE_NODES_ENABLED
2022-03-28 05:56:56 -04:00
FString AddAggregatePin ( URigVMNode * InNode , const FString & InPinName , const FString & InDefaultValue = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
bool RemoveAggregatePin ( URigVMPin * InPin , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
# endif
2019-09-17 19:12:19 -04:00
// Adds an array element pin to the end of an array pin.
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
FString AddArrayPin ( const FString & InArrayPinPath , const FString & InDefaultValue = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Duplicates an array element pin.
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
FString DuplicateArrayPin ( const FString & InArrayElementPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Inserts an array element pin into an array pin.
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
FString InsertArrayPin ( const FString & InArrayPinPath , int32 InIndex = - 1 , const FString & InDefaultValue = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Removes an array element pin from an array pin.
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool RemoveArrayPin ( const FString & InArrayElementPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Removes all (but one) array element pin from an array pin.
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool ClearArrayPin ( const FString & InArrayPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-01-22 17:58:55 -05:00
// Sets the size of the array pin
// This causes a PinArraySizeChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetArrayPinSize ( const FString & InArrayPinPath , int32 InSize , const FString & InDefaultValue = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-01-22 17:58:55 -05:00
2020-10-21 03:46:35 -04:00
// Binds a pin to a variable (or removes the binding given NAME_None)
// This causes a PinBoundVariableChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool BindPinToVariable ( const FString & InPinPath , const FString & InNewBoundVariablePath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-10-21 03:46:35 -04:00
// Removes the binging of a pin to a variable
// This causes a PinBoundVariableChanged modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool UnbindPinFromVariable ( const FString & InPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-10-21 03:46:35 -04:00
2020-10-26 06:51:31 -04:00
// Turns a variable node into one or more bindings
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool MakeBindingsFromVariableNode ( const FName & InNodeName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-10-26 06:51:31 -04:00
// Turns a binding to a variable node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool MakeVariableNodeFromBinding ( const FString & InPinPath , const FVector2D & InNodePosition = FVector2D : : ZeroVector , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-10-26 06:51:31 -04:00
// Promotes a pin to a variable
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool PromotePinToVariable ( const FString & InPinPath , bool bCreateVariableNode , const FVector2D & InNodePosition = FVector2D : : ZeroVector , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-10-26 06:51:31 -04:00
2019-09-17 19:12:19 -04:00
// Adds a link to the graph.
// This causes a LinkAdded modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2022-11-07 04:27:49 -05:00
bool AddLink ( const FString & InOutputPinPath , const FString & InInputPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , ERigVMPinDirection InUserDirection = ERigVMPinDirection : : Output , bool bCreateCastNode = false ) ;
2019-09-17 19:12:19 -04:00
// Removes a link from the graph.
// This causes a LinkRemoved modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool BreakLink ( const FString & InOutputPinPath , const FString & InInputPinPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
// Removes all links on a given pin from the graph.
// This might cause multiple LinkRemoved modified event.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool BreakAllLinks ( const FString & InPinPath , bool bAsInput = true , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2019-09-17 19:12:19 -04:00
2020-12-14 08:58:12 -04:00
// Adds an exposed pin to the graph controlled by this
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
FName AddExposedPin ( const FName & InPinName , ERigVMPinDirection InDirection , const FString & InCPPType , const FName & InCPPTypeObjectPath , const FString & InDefaultValue , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-12-14 08:58:12 -04:00
// Removes an exposed pin from the graph controlled by this
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool RemoveExposedPin ( const FName & InPinName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-12-14 08:58:12 -04:00
// Renames an exposed pin in the graph controlled by this
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool RenameExposedPin ( const FName & InOldPinName , const FName & InNewPinName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2020-12-14 08:58:12 -04:00
// Changes the type of an exposed pin in the graph controlled by this
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool ChangeExposedPinType ( const FName & InPinName , const FString & InCPPType , const FName & InCPPTypeObjectPath , UPARAM ( ref ) bool & bSetupUndoRedo , bool bSetupOrphanPins = true , bool bPrintPythonCommand = false ) ;
2020-12-14 08:58:12 -04:00
2021-01-21 04:38:23 -04:00
// Sets the index for an exposed pin. This can be used to move the pin up and down on the node.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetExposedPinIndex ( const FName & InPinName , int32 InNewIndex , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-01-21 04:38:23 -04:00
2021-01-06 14:01:38 -04:00
// Adds a function reference / invocation to the graph
2022-11-16 03:33:17 -05:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMFunctionReferenceNode * AddFunctionReferenceNodeFromDescription ( const FRigVMGraphFunctionHeader & InFunctionDefinition , const FVector2D & InNodePosition = FVector2D : : ZeroVector , const
FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , bool bAllowPrivateFunctions = false ) ;
2021-01-06 14:01:38 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMFunctionReferenceNode * AddFunctionReferenceNode ( URigVMLibraryNode * InFunctionDefinition , const FVector2D & InNodePosition = FVector2D : : ZeroVector , const FString & InNodeName = TEXT ( " " ) , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-01-06 14:01:38 -04:00
2021-04-27 03:19:42 -04:00
// Sets the remapped variable on a function reference node
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool SetRemappedVariable ( URigVMFunctionReferenceNode * InFunctionRefNode , const FName & InInnerVariableName , const FName & InOuterVariableName , bool bSetupUndoRedo = true ) ;
2021-01-06 14:01:38 -04:00
// Adds a function definition to a function library graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
URigVMLibraryNode * AddFunctionToLibrary ( const FName & InFunctionName , bool bMutable , const FVector2D & InNodePosition = FVector2D : : ZeroVector , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-01-06 14:01:38 -04:00
// Removes a function from a function library graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool RemoveFunctionFromLibrary ( const FName & InFunctionName , bool bSetupUndoRedo = true ) ;
2021-07-22 05:00:14 -04:00
// Renames a function in the function library
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool RenameFunction ( const FName & InOldFunctionName , const FName & InNewFunctionName , bool bSetupUndoRedo = true ) ;
2021-05-11 17:13:58 -04:00
// Add a local variable to the graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
FRigVMGraphVariableDescription AddLocalVariable ( const FName & InVariableName , const FString & InCPPType , UObject * InCPPTypeObject , const FString & InDefaultValue , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-05-11 17:13:58 -04:00
2021-06-16 13:02:50 -04:00
// Add a local variable to the graph given a struct object path name.
UFUNCTION ( BlueprintCallable , Category = RigVMController )
FRigVMGraphVariableDescription AddLocalVariableFromObjectPath ( const FName & InVariableName , const FString & InCPPType , const FString & InCPPTypeObjectPath , const FString & InDefaultValue , bool bSetupUndoRedo = true ) ;
2021-05-11 17:13:58 -04:00
// Remove a local variable from the graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool RemoveLocalVariable ( const FName & InVariableName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-05-11 17:13:58 -04:00
2021-06-07 06:49:07 -04:00
// Rename a local variable from the graph
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool RenameLocalVariable ( const FName & InVariableName , const FName & InNewVariableName , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-06-07 06:49:07 -04:00
// Sets the type of the local variable
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-07-19 06:35:29 -04:00
bool SetLocalVariableType ( const FName & InVariableName , const FString & InCPPType , UObject * InCPPTypeObject , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool SetLocalVariableTypeFromObjectPath ( const FName & InVariableName , const FString & InCPPType , const FString & InCPPTypeObjectPath , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
2021-06-07 06:49:07 -04:00
2021-09-01 04:50:52 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2021-09-06 04:39:25 -04:00
bool SetLocalVariableDefaultValue ( const FName & InVariableName , const FString & InDefaultValue , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false , bool bNotify = true ) ;
2021-09-01 04:50:52 -04:00
2022-04-05 06:16:59 -04:00
// creates the options struct for a given workflow
UFUNCTION ( BlueprintCallable , Category = RigVMController )
URigVMUserWorkflowOptions * MakeOptionsForWorkflow ( UObject * InSubject , const FRigVMUserWorkflow & InWorkflow ) ;
// performs all actions representing the workflow
UFUNCTION ( BlueprintCallable , Category = RigVMController )
bool PerformUserWorkflow ( const FRigVMUserWorkflow & InWorkflow , const URigVMUserWorkflowOptions * InOptions , bool bSetupUndoRedo = true ) ;
2021-04-29 07:44:28 -04:00
// Determine affected function references for a potential bulk edit on a library node
TArray < TSoftObjectPtr < URigVMFunctionReferenceNode > > GetAffectedReferences ( ERigVMControllerBulkEditType InEditType , bool bForceLoad = false , bool bNotify = true ) ;
// Determine affected assets for a potential bulk edit on a library node
TArray < FAssetData > GetAffectedAssets ( ERigVMControllerBulkEditType InEditType , bool bForceLoad = false , bool bNotify = true ) ;
2020-01-22 17:58:55 -05:00
// A delegate that can be set to change the struct unfolding behaviour
FRigVMController_ShouldStructUnfoldDelegate UnfoldStructDelegate ;
2020-10-21 03:46:35 -04:00
// A delegate to retrieve the list of external variables
FRigVMController_GetExternalVariablesDelegate GetExternalVariablesDelegate ;
2021-01-26 04:06:19 -04:00
// A delegate to retrieve the current bytecode of the graph
FRigVMController_GetByteCodeDelegate GetCurrentByteCodeDelegate ;
2021-03-10 05:52:25 -04:00
// A delegate to localize a function on demand
FRigVMController_RequestLocalizeFunctionDelegate RequestLocalizeFunctionDelegate ;
2021-09-10 10:04:27 -04:00
// A delegate to create a new blueprint member variable
FRigVMController_RequestNewExternalVariableDelegate RequestNewExternalVariableDelegate ;
2021-04-29 07:44:28 -04:00
// A delegate to ask the host / client for a dialog to confirm a bulk edit
FRigVMController_RequestBulkEditDialogDelegate RequestBulkEditDialogDelegate ;
2022-05-09 07:34:28 -04:00
// A delegate to ask the host / client for a dialog to confirm a bulk edit
FRigVMController_RequestBreakLinksDialogDelegate RequestBreakLinksDialogDelegate ;
2021-04-29 07:44:28 -04:00
// A delegate to inform the host / client about the progress during a bulk edit
FRigVMController_OnBulkEditProgressDelegate OnBulkEditProgressDelegate ;
2021-03-10 05:52:25 -04:00
2022-03-14 10:19:31 -04:00
// A delegate to request the client to follow a hyper link
2022-04-05 06:16:59 -04:00
FRigVMController_RequestJumpToHyperlinkDelegate RequestJumpToHyperlinkDelegate ;
// A delegate to request to configure an options instance for a node workflow
FRigVMController_ConfigureWorkflowOptionsDelegate ConfigureWorkflowOptionsDelegate ;
2022-03-14 10:19:31 -04:00
2022-02-10 07:13:27 -05:00
// Returns the build data of the host
static URigVMBuildData * GetBuildData ( bool bCreateIfNeeded = true ) ;
2020-12-14 08:58:12 -04:00
int32 DetachLinksFromPinObjects ( const TArray < URigVMLink * > * InLinks = nullptr , bool bNotify = false ) ;
2022-07-14 06:53:37 -04:00
int32 ReattachLinksToPinObjects ( bool bFollowCoreRedirectors = false , const TArray < URigVMLink * > * InLinks = nullptr , bool bNotify = false , bool bSetupOrphanedPins = false , bool bAllowNonArgumentLinks = false ) ;
2020-09-24 00:43:27 -04:00
void AddPinRedirector ( bool bInput , bool bOutput , const FString & OldPinPath , const FString & NewPinPath ) ;
2020-01-22 17:58:55 -05:00
2020-09-01 14:07:48 -04:00
// Removes nodes which went stale.
void RemoveStaleNodes ( ) ;
2020-01-22 17:58:55 -05:00
# if WITH_EDITOR
2020-09-24 00:43:27 -04:00
bool ShouldRedirectPin ( UScriptStruct * InOwningStruct , const FString & InOldRelativePinPath , FString & InOutNewRelativePinPath ) const ;
bool ShouldRedirectPin ( const FString & InOldPinPath , FString & InOutNewPinPath ) const ;
2021-04-07 13:09:20 -04:00
void RepopulatePinsOnNode ( URigVMNode * InNode , bool bFollowCoreRedirectors = true , bool bNotify = false , bool bSetupOrphanedPins = false ) ;
void RemovePinsDuringRepopulate ( URigVMNode * InNode , TArray < URigVMPin * > & InPins , bool bNotify , bool bSetupOrphanedPins ) ;
// removes any orphan pins that no longer holds a link
bool RemoveUnusedOrphanedPins ( URigVMNode * InNode , bool bNotify ) ;
2022-05-09 07:34:28 -04:00
2022-05-20 09:28:06 -04:00
// Initializes and recomputes the filtered permutations of all template nodes in the graph
2022-07-14 06:53:37 -04:00
// Returns true if any pin has change it's type or link was broken
bool RecomputeAllTemplateFilteredPermutations ( bool bSetupUndoRedo ) ;
// Update the template of a subgraph with the filtered permutations of the interface nodes
bool UpdateLibraryTemplate ( URigVMLibraryNode * LibraryNode , bool bSetupUndoRedo ) ;
// Update filtered permutations, and propagate both ways of the link before adding this link
bool PrepareToLink ( URigVMPin * FirstToResolve , URigVMPin * SecondToResolve , bool bSetupUndoRedo ) ;
2022-05-09 07:34:28 -04:00
2022-05-10 12:00:48 -04:00
// Try to initialize the filterd permutations from the pin types
void InitializeFilteredPermutationsFromTemplateTypes ( ) ;
2022-05-09 07:34:28 -04:00
// Initializes filtered permuations to be unresolved in all template nodes in graph
2022-05-10 09:29:27 -04:00
void InitializeAllTemplateFiltersInGraph ( bool bSetupUndoRedo , bool bChangePinTypes ) ;
2021-04-07 13:09:20 -04:00
2020-01-22 17:58:55 -05:00
# endif
2022-08-23 19:22:27 -04:00
bool FullyResolveTemplateNode ( URigVMTemplateNode * InNode , int32 InPermutationIndex , bool bSetupUndoRedo ) ;
2020-12-02 10:59:58 -04:00
FRigVMUnitNodeCreatedContext & GetUnitNodeCreatedContext ( ) { return UnitNodeCreatedContext ; }
2020-10-19 08:06:50 -04:00
2020-12-02 10:59:58 -04:00
// Wires the unit node delegates to the default controller delegates.
2020-10-26 06:51:31 -04:00
// this is used only within the Control Rig Editor currently.
2021-01-21 10:14:22 -04:00
void SetupDefaultUnitNodeDelegates ( TDelegate < FName ( FRigVMExternalVariable , FString ) > InCreateExternalVariableDelegate ) ;
2020-12-02 10:59:58 -04:00
void ResetUnitNodeDelegates ( ) ;
2020-10-26 06:51:31 -04:00
2021-01-06 16:30:00 -04:00
// A flag that can be used to turn off pin default value validation if necessary
bool bValidatePinDefaults ;
2022-07-14 06:53:37 -04:00
// A flag to suspend the recomputation of filtered permutations of outer graphs
bool bSuspendRecomputingOuterTemplateFilters ;
2021-01-26 04:06:19 -04:00
const FRigVMByteCode * GetCurrentByteCode ( ) const ;
2022-03-07 12:07:36 -05:00
void ReportInfo ( const FString & InMessage ) const ;
2021-10-19 07:53:34 -04:00
void ReportWarning ( const FString & InMessage ) const ;
void ReportError ( const FString & InMessage ) const ;
2022-03-14 10:19:31 -04:00
void ReportAndNotifyInfo ( const FString & InMessage ) const ;
void ReportAndNotifyWarning ( const FString & InMessage ) const ;
2021-10-19 07:53:34 -04:00
void ReportAndNotifyError ( const FString & InMessage ) const ;
2022-03-14 10:19:31 -04:00
void SendUserFacingNotification ( const FString & InMessage , float InDuration = 0.f , const UObject * InSubject = nullptr , const FName & InBrushName = TEXT ( " MessageLog.Warning " ) ) const ;
2021-01-27 11:44:35 -04:00
2022-03-07 12:07:36 -05:00
template < typename FmtType , typename . . . Types >
void ReportInfof ( const FmtType & Fmt , Types . . . Args )
{
ReportInfo ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
2021-01-27 11:44:35 -04:00
template < typename FmtType , typename . . . Types >
void ReportWarningf ( const FmtType & Fmt , Types . . . Args )
{
ReportWarning ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
template < typename FmtType , typename . . . Types >
void ReportErrorf ( const FmtType & Fmt , Types . . . Args )
{
ReportError ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
2022-03-14 10:19:31 -04:00
template < typename FmtType , typename . . . Types >
void ReportAndNotifyInfof ( const FmtType & Fmt , Types . . . Args )
{
ReportAndNotifyInfo ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
template < typename FmtType , typename . . . Types >
void ReportAndNotifyWarningf ( const FmtType & Fmt , Types . . . Args )
{
ReportAndNotifyWarning ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
2021-01-27 11:44:35 -04:00
template < typename FmtType , typename . . . Types >
void ReportAndNotifyErrorf ( const FmtType & Fmt , Types . . . Args )
{
ReportAndNotifyError ( FString : : Printf ( Fmt , Args . . . ) ) ;
}
2021-03-01 18:41:53 -04:00
/**
* Function to override the notification behavior and temporarily
* disable all notifications . Client code is responsible for calling
* SuspendNotifications ( true ) once all changes have been done .
*/
void SuspendNotifications ( bool bSuspend ) { bSuspendNotifications = bSuspend ; }
2021-01-27 11:44:35 -04:00
2021-05-12 11:49:38 -04:00
/**
* Helper function to disable a series of checks that can be ignored during a unit test
*/
2021-06-21 07:47:49 -04:00
UFUNCTION ( BlueprintCallable , Category = RigVMController )
2022-02-15 12:05:01 -05:00
void SetIsRunningUnitTest ( bool bIsRunning ) ;
2021-05-12 11:49:38 -04:00
2019-09-17 19:12:19 -04:00
private :
UPROPERTY ( BlueprintReadOnly , Category = RigVMController , meta = ( ScriptName = " ModifiedEvent " , AllowPrivateAccess = " true " ) )
FRigVMGraphModifiedDynamicEvent ModifiedEventDynamic ;
FRigVMGraphModifiedEvent ModifiedEventStatic ;
void HandleModifiedEvent ( ERigVMGraphNotifType InNotifType , URigVMGraph * InGraph , UObject * InSubject ) ;
2020-01-22 17:58:55 -05:00
FString GetValidNodeName ( const FString & InPrefix ) ;
2021-10-19 07:53:34 -04:00
bool IsValidGraph ( ) const ;
2022-03-30 05:21:45 -04:00
bool IsGraphEditable ( ) const ;
2019-09-17 19:12:19 -04:00
bool IsValidNodeForGraph ( URigVMNode * InNode ) ;
bool IsValidPinForGraph ( URigVMPin * InPin ) ;
bool IsValidLinkForGraph ( URigVMLink * InLink ) ;
2021-05-27 07:55:17 -04:00
bool CanAddNode ( URigVMNode * InNode , bool bReportErrors , bool bIgnoreFunctionEntryReturnNodes = false ) ;
2021-10-19 07:53:34 -04:00
TObjectPtr < URigVMNode > FindEventNode ( const UScriptStruct * InScriptStruct ) const ;
bool CanAddEventNode ( UScriptStruct * InScriptStruct , const bool bReportErrors ) const ;
2022-11-16 03:33:17 -05:00
bool CanAddFunctionRefForDefinition ( const FRigVMGraphFunctionHeader & InFunctionDefinition , bool bReportErrors , bool bAllowPrivateFunctions = false ) ;
2020-12-14 08:58:12 -04:00
void AddPinsForStruct ( UStruct * InStruct , URigVMNode * InNode , URigVMPin * InParentPin , ERigVMPinDirection InPinDirection , const FString & InDefaultValue , bool bAutoExpandArrays , bool bNotify = false ) ;
2020-01-22 17:58:55 -05:00
void AddPinsForArray ( FArrayProperty * InArrayProperty , URigVMNode * InNode , URigVMPin * InParentPin , ERigVMPinDirection InPinDirection , const TArray < FString > & InDefaultValues , bool bAutoExpandArrays ) ;
2022-11-11 07:04:17 -05:00
void AddPinsForTemplate ( const FRigVMTemplate * InTemplate , const FRigVMTemplateTypeMap & InPinTypeMap , URigVMNode * InNode ) ;
2019-12-13 11:07:03 -05:00
void ConfigurePinFromProperty ( FProperty * InProperty , URigVMPin * InOutPin , ERigVMPinDirection InPinDirection = ERigVMPinDirection : : Invalid ) ;
2022-05-05 11:55:01 -04:00
void ConfigurePinFromPin ( URigVMPin * InOutPin , URigVMPin * InPin , bool bCopyDisplayName = false ) ;
2022-11-16 03:33:17 -05:00
void ConfigurePinFromArgument ( URigVMPin * InOutPin , const FRigVMGraphFunctionArgument & InArgument , bool bCopyDisplayName = false ) ;
2019-09-17 19:12:19 -04:00
virtual bool ShouldStructBeUnfolded ( const UStruct * InStruct ) ;
virtual bool ShouldPinBeUnfolded ( URigVMPin * InPin ) ;
2021-09-06 04:39:25 -04:00
bool SetPinDefaultValue ( URigVMPin * InPin , const FString & InDefaultValue , bool bResizeArrays , bool bSetupUndoRedo , bool bMergeUndoAction , bool bNotify = true ) ;
2020-10-27 03:30:51 -04:00
bool ResetPinDefaultValue ( URigVMPin * InPin , bool bSetupUndoRedo ) ;
2021-10-25 12:17:18 -04:00
static FString GetPinInitialDefaultValue ( const URigVMPin * InPin ) ;
static FString GetPinInitialDefaultValueFromStruct ( UScriptStruct * ScriptStruct , const URigVMPin * InPin , uint32 InOffset ) ;
2020-10-27 03:30:51 -04:00
URigVMPin * InsertArrayPin ( URigVMPin * ArrayPin , int32 InIndex , const FString & InDefaultValue , bool bSetupUndoRedo ) ;
2020-12-14 08:58:12 -04:00
bool RemovePin ( URigVMPin * InPinToRemove , bool bSetupUndoRedo , bool bNotify ) ;
2019-12-13 11:07:03 -05:00
FProperty * FindPropertyForPin ( const FString & InPinPath ) ;
2021-12-09 14:47:18 -05:00
bool BindPinToVariable ( URigVMPin * InPin , const FString & InNewBoundVariablePath , bool bSetupUndoRedo , const FString & InVariableNodeName = FString ( ) ) ;
2021-11-29 11:26:01 -05:00
bool UnbindPinFromVariable ( URigVMPin * InPin , bool bSetupUndoRedo ) ;
2020-10-27 03:30:51 -04:00
bool MakeBindingsFromVariableNode ( URigVMVariableNode * InNode , bool bSetupUndoRedo ) ;
bool PromotePinToVariable ( URigVMPin * InPin , bool bCreateVariableNode , const FVector2D & InNodePosition , bool bSetupUndoRedo ) ;
2022-01-10 10:15:49 -05:00
URigVMInjectionInfo * InjectNodeIntoPin ( const FString & InPinPath , bool bAsInput , const FName & InInputPinName , const FName & InOutputPinName , bool bSetupUndoRedo = true ) ;
URigVMInjectionInfo * InjectNodeIntoPin ( URigVMPin * InPin , bool bAsInput , const FName & InInputPinName , const FName & InOutputPinName , bool bSetupUndoRedo = true ) ;
URigVMNode * EjectNodeFromPin ( URigVMPin * InPin , bool bSetupUndoRedo = true , bool bPrintPythonCommands = false ) ;
2022-04-01 04:37:48 -04:00
bool EjectAllInjectedNodes ( URigVMNode * InNode , bool bSetupUndoRedo = true , bool bPrintPythonCommands = false ) ;
2021-08-18 06:18:21 -04:00
2021-10-11 05:19:26 -04:00
// try to reconnect source and target pins after a node deletion
void RelinkSourceAndTargetPins ( URigVMNode * RigNode , bool bSetupUndoRedo = true ) ;
2022-03-01 04:23:55 -05:00
2021-08-18 06:18:21 -04:00
public :
2022-11-07 04:27:49 -05:00
bool AddLink ( URigVMPin * OutputPin , URigVMPin * InputPin , bool bSetupUndoRedo = true , ERigVMPinDirection InUserDirection = ERigVMPinDirection : : Invalid , bool bCreateCastNode = false ) ;
2021-08-18 06:18:21 -04:00
bool BreakLink ( URigVMPin * OutputPin , URigVMPin * InputPin , bool bSetupUndoRedo = true ) ;
bool BreakAllLinks ( URigVMPin * Pin , bool bAsInput , bool bSetupUndoRedo = true ) ;
2022-10-20 08:54:59 -04:00
void EnableTypeCasting ( bool bEnabled = true ) { bEnableTypeCasting = bEnabled ; }
2021-08-18 06:18:21 -04:00
private :
2022-05-09 07:34:28 -04:00
bool BreakAllLinksRecursive ( URigVMPin * Pin , bool bAsInput , bool bTowardsParent , bool bSetupUndoRedo ) ;
2020-10-27 03:30:51 -04:00
void UpdateRerouteNodeAfterChangingLinks ( URigVMPin * PinChanged , bool bSetupUndoRedo = true ) ;
bool SetPinExpansion ( URigVMPin * InPin , bool bIsExpanded , bool bSetupUndoRedo = true ) ;
void ExpandPinRecursively ( URigVMPin * InPin , bool bSetupUndoRedo ) ;
bool SetPinIsWatched ( URigVMPin * InPin , bool bIsWatched , bool bSetupUndoRedo ) ;
bool SetVariableName ( URigVMVariableNode * InVariableNode , const FName & InVariableName , bool bSetupUndoRedo ) ;
2020-01-22 17:58:55 -05:00
static void ForEveryPinRecursively ( URigVMPin * InPin , TFunction < void ( URigVMPin * ) > OnEachPinFunction ) ;
static void ForEveryPinRecursively ( URigVMNode * InNode , TFunction < void ( URigVMPin * ) > OnEachPinFunction ) ;
2022-03-28 05:56:56 -04:00
URigVMCollapseNode * CollapseNodes ( const TArray < URigVMNode * > & InNodes , const FString & InCollapseNodeName , bool bSetupUndoRedo , bool bIsAggregate ) ;
2020-11-26 05:45:07 -04:00
TArray < URigVMNode * > ExpandLibraryNode ( URigVMLibraryNode * InNode , bool bSetupUndoRedo ) ;
2021-11-11 09:37:24 -05:00
URigVMFunctionReferenceNode * PromoteCollapseNodeToFunctionReferenceNode ( URigVMCollapseNode * InCollapseNode , bool bSetupUndoRedo , const FString & InExistingFunctionDefinitionPath ) ;
URigVMCollapseNode * PromoteFunctionReferenceNodeToCollapseNode ( URigVMFunctionReferenceNode * InFunctionRefNode , bool bSetupUndoRedo , bool bRemoveFunctionDefinition ) ;
2021-03-10 05:52:25 -04:00
void SetReferencedFunction ( URigVMFunctionReferenceNode * InFunctionRefNode , URigVMLibraryNode * InNewReferencedNode , bool bSetupUndoRedo ) ;
2021-01-19 04:58:31 -04:00
2020-12-14 08:58:12 -04:00
void RefreshFunctionPins ( URigVMNode * InNode , bool bNotify = true ) ;
2020-11-26 05:45:07 -04:00
2022-03-14 10:19:31 -04:00
void ReportRemovedLink ( const FString & InSourcePinPath , const FString & InTargetPinPath ) ;
2020-11-26 05:45:07 -04:00
struct FPinState
{
2021-04-07 13:09:20 -04:00
ERigVMPinDirection Direction ;
FString CPPType ;
UObject * CPPTypeObject ;
2020-11-26 05:45:07 -04:00
FString DefaultValue ;
bool bIsExpanded ;
TArray < URigVMInjectionInfo * > InjectionInfos ;
2022-04-01 04:37:48 -04:00
TArray < URigVMInjectionInfo : : FWeakInfo > WeakInjectionInfos ;
2020-11-26 05:45:07 -04:00
} ;
TMap < FString , FString > GetRedirectedPinPaths ( URigVMNode * InNode ) const ;
2022-04-01 04:37:48 -04:00
FPinState GetPinState ( URigVMPin * InPin , bool bStoreWeakInjectionInfos = false ) const ;
TMap < FString , FPinState > GetPinStates ( URigVMNode * InNode , bool bStoreWeakInjectionInfos = false ) const ;
void ApplyPinState ( URigVMPin * InPin , const FPinState & InPinState , bool bSetupUndoRedo = false ) ;
void ApplyPinStates ( URigVMNode * InNode , const TMap < FString , FPinState > & InPinStates , const TMap < FString , FString > & InRedirectedPinPaths = TMap < FString , FString > ( ) , bool bSetupUndoRedo = false ) ;
2019-09-17 19:12:19 -04:00
2020-12-04 05:36:01 -04:00
2020-01-22 17:58:55 -05:00
static FLinearColor GetColorFromMetadata ( const FString & InMetadata ) ;
2021-01-05 03:52:27 -04:00
static void CreateDefaultValueForStructIfRequired ( UScriptStruct * InStruct , FString & InOutDefaultValue ) ;
2020-01-22 17:58:55 -05:00
static void PostProcessDefaultValue ( URigVMPin * Pin , FString & OutDefaultValue ) ;
2019-09-17 19:12:19 -04:00
2022-03-14 10:19:31 -04:00
void ResolveTemplateNodeMetaData ( URigVMTemplateNode * InNode , bool bSetupUndoRedo ) ;
2022-08-23 19:22:27 -04:00
2022-05-09 07:34:28 -04:00
// Prepare the graph for the change this template node is about to make
// If any of the types is supported (without breaking any links), then the filtered permutations will be updated and the change will
// propagate to other nodes in the graph.
// If it is not supported, we will attempt to find and break any links that do not support this change
2022-07-05 11:39:15 -04:00
bool PrepareTemplatePinForType ( URigVMPin * InPin , const TArray < TRigVMTypeIndex > & InTypeIndices , bool bSetupUndoRedo ) ;
2022-05-09 07:34:28 -04:00
// Get filtered types for a wildcard node. If template node, that means just returning its filtered wildcard types, but if it's another type of node (select, if, rereoute), iterate
// its connections to figure out the filtered types
2022-07-14 06:53:37 -04:00
TArray < TRigVMTypeIndex > GetFilteredTypes ( URigVMPin * InPin ) ;
2022-05-09 07:34:28 -04:00
// Updates the permutations allowed without having to break any links
bool UpdateFilteredPermutations ( URigVMPin * InPin , URigVMPin * InLinkedPin , bool bSetupUndoRedo ) ;
2022-07-05 11:39:15 -04:00
bool UpdateFilteredPermutations ( URigVMPin * InPin , const TArray < TRigVMTypeIndex > & InTypeIndices , bool bSetupUndoRedo ) ;
2022-07-18 04:44:55 -04:00
bool UpdateFilteredPermutations ( URigVMTemplateNode * InNode , const TArray < int32 > & InPermutations , bool bSetupUndoRedo ) ;
2022-05-09 07:34:28 -04:00
// Changes Pin types if filtered types of a pin are unique
2022-07-14 06:53:37 -04:00
bool UpdateTemplateNodePinTypes ( URigVMTemplateNode * InNode , bool bSetupUndoRedo , bool bInitializeDefaultValue = true ) ;
2022-05-09 07:34:28 -04:00
// Reduces the filtered permutations of all templates in the graph to comply with the types filtered by InNode
// Returns false if a link had to be broken
bool PropagateTemplateFilteredTypes ( URigVMTemplateNode * InNode , bool bSetupUndoRedo ) ;
2022-07-14 06:53:37 -04:00
// Adds a preferred type for the pin
// Returns false if the pin already has a different type
2022-07-18 04:44:55 -04:00
bool AddPreferredType ( URigVMTemplateNode * InNode , const FName & InPinName , const TRigVMTypeIndex & InPreferredTypeIndex , bool bSetupUndoRedo ) ;
2022-07-14 06:53:37 -04:00
// Removes preferred type
// Returns true if the preferred type was found and removed
bool RemovePreferredType ( URigVMTemplateNode * InNode , const FName & InPinName , bool bSetupUndoRedo ) ;
// Returns true if the pin is connected, and the filtered types is reduced (not infinite like reroute, if, select or array nodes)
bool ShouldPinOwnArgument ( URigVMPin * InPin ) ;
// Given a Entry or Return pin and a potential pin to link it to, try to add the first pin as an argument of the library's template
bool AddArgumentForPin ( URigVMPin * InPin , URigVMPin * InToLinkPin , bool bSetupUndoRedo = true , bool bPrintPythonCommand = false ) ;
bool ChangePinType ( const FString & InPinPath , const FString & InCPPType , const FName & InCPPTypeObjectPath , bool bSetupUndoRedo , bool bSetupOrphanPins = true , bool bBreakLinks = true , bool bRemoveSubPins = true , bool bInitializeDefaultValue = true ) ;
bool ChangePinType ( URigVMPin * InPin , const FString & InCPPType , const FName & InCPPTypeObjectPath , bool bSetupUndoRedo , bool bSetupOrphanPins = true , bool bBreakLinks = true , bool bRemoveSubPins = true , bool bInitializeDefaultValue = true ) ;
bool ChangePinType ( URigVMPin * InPin , const FString & InCPPType , UObject * InCPPTypeObject , bool bSetupUndoRedo , bool bSetupOrphanPins = true , bool bBreakLinks = true , bool bRemoveSubPins = true , bool bInitializeDefaultValue = true ) ;
bool ChangePinType ( URigVMPin * InPin , TRigVMTypeIndex InTypeIndex , bool bSetupUndoRedo , bool bSetupOrphanPins = true , bool bBreakLinks = true , bool bRemoveSubPins = true , bool bInitializeDefaultValue = true ) ;
2020-09-24 00:43:27 -04:00
2019-09-17 19:12:19 -04:00
# if WITH_EDITOR
2020-10-27 03:30:51 -04:00
void RewireLinks ( URigVMPin * OldPin , URigVMPin * NewPin , bool bAsInput , bool bSetupUndoRedo , TArray < URigVMLink * > InLinks = TArray < URigVMLink * > ( ) ) ;
2019-09-17 19:12:19 -04:00
# endif
2021-11-29 11:26:01 -05:00
bool RenameObject ( UObject * InObjectToRename , const TCHAR * InNewName , UObject * InNewOuter = nullptr ) ;
2020-09-24 00:43:27 -04:00
void DestroyObject ( UObject * InObjectToDestroy ) ;
2022-08-11 06:58:29 -04:00
static URigVMPin * MakeExecutePin ( URigVMNode * InNode , const FName & InName ) ;
static void MakeExecutePin ( URigVMPin * InOutPin ) ;
2021-08-26 06:58:05 -04:00
static void AddNodePin ( URigVMNode * InNode , URigVMPin * InPin ) ;
static void AddSubPin ( URigVMPin * InParentPin , URigVMPin * InPin ) ;
static bool EnsurePinValidity ( URigVMPin * InPin , bool bRecursive ) ;
static void ValidatePin ( URigVMPin * InPin ) ;
2020-09-24 00:43:27 -04:00
2022-01-13 22:49:09 -05:00
// recreate the CPP type strings for variables that reference a type object
// they can get out of sync when the variable references a user defined struct
void EnsureLocalVariableValidity ( ) ;
2021-09-27 11:50:32 -04:00
FRigVMExternalVariable GetVariableByName ( const FName & InExternalVariableName , const bool bIncludeInputArguments = false ) ;
TArray < FRigVMExternalVariable > GetAllVariables ( const bool bIncludeInputArguments = false ) ;
2020-10-21 03:46:35 -04:00
2021-01-14 15:00:40 -04:00
void RefreshFunctionReferences ( URigVMLibraryNode * InFunctionDefinition , bool bSetupUndoRedo ) ;
2021-09-09 10:12:46 -04:00
FString GetGraphOuterName ( ) const ;
2021-10-22 05:17:33 -04:00
public :
static int32 GetMaxNameLength ( ) { return 100 ; }
2021-09-09 10:12:46 -04:00
static FString GetSanitizedName ( const FString & InName , bool bAllowPeriod , bool bAllowSpace ) ;
static FString GetSanitizedGraphName ( const FString & InName ) ;
static FString GetSanitizedNodeName ( const FString & InName ) ;
static FString GetSanitizedVariableName ( const FString & InName ) ;
static FString GetSanitizedPinName ( const FString & InName ) ;
static FString GetSanitizedPinPath ( const FString & InName ) ;
static void SanitizeName ( FString & InOutName , bool bAllowPeriod , bool bAllowSpace ) ;
2022-04-01 04:37:48 -04:00
static TArray < TPair < FString , FString > > GetLinkedPinPaths ( URigVMNode * InNode , bool bIncludeInjectionNodes = false ) ;
static TArray < TPair < FString , FString > > GetLinkedPinPaths ( const TArray < URigVMNode * > & InNodes , bool bIncludeInjectionNodes = false ) ;
2022-05-06 07:42:47 -04:00
bool BreakLinkedPaths ( const TArray < TPair < FString , FString > > & InLinkedPaths , bool bSetupUndoRedo ) ;
bool RestoreLinkedPaths (
const TArray < TPair < FString , FString > > & InLinkedPaths ,
const TMap < FString , FString > & InNodeNameMap ,
const TMap < FString , FRigVMController_PinPathRemapDelegate > & InRemapDelegates ,
FRigVMController_CheckPinComatibilityDelegate InCompatibilityDelegate ,
bool bSetupUndoRedo ,
ERigVMPinDirection InUserDirection = ERigVMPinDirection : : Invalid ) ;
bool RestoreLinkedPaths (
const TArray < TPair < FString , FString > > & InLinkedPaths ,
const TMap < FString , FString > & InNodeNameMap ,
const TMap < FString , FRigVMController_PinPathRemapDelegate > & InRemapDelegates ,
bool bSetupUndoRedo ,
ERigVMPinDirection InUserDirection = ERigVMPinDirection : : Invalid )
{
return RestoreLinkedPaths ( InLinkedPaths , InNodeNameMap , InRemapDelegates , FRigVMController_CheckPinComatibilityDelegate ( ) , bSetupUndoRedo , InUserDirection ) ;
}
2021-10-20 11:50:24 -04:00
2022-08-23 07:06:22 -04:00
# if WITH_EDITOR
// Registers this template node's use for later determining the commonly used types
void RegisterUseOfTemplate ( const URigVMTemplateNode * InNode ) ;
// Inquire on the commonly used types for a template node. This can be used to resolve a node without user input (as a default)
FRigVMTemplate : : FTypeMap GetCommonlyUsedTypesForTemplate ( const URigVMTemplateNode * InNode ) const ;
# endif
2022-11-11 07:04:17 -05:00
protected :
// backwards compatibility code
void PatchDispatchNodesOnLoad ( ) ;
2022-08-23 07:06:22 -04:00
2021-10-20 11:50:24 -04:00
private :
2020-01-22 17:58:55 -05:00
UPROPERTY ( transient )
2021-07-20 00:24:38 -04:00
TArray < TObjectPtr < URigVMGraph > > Graphs ;
2019-09-17 19:12:19 -04:00
UPROPERTY ( transient )
2021-07-20 00:24:38 -04:00
TObjectPtr < URigVMActionStack > ActionStack ;
2019-09-17 19:12:19 -04:00
2020-01-22 17:58:55 -05:00
bool bSuspendNotifications ;
2019-09-17 19:12:19 -04:00
bool bReportWarningsAndErrors ;
2020-02-04 11:06:23 -05:00
bool bIgnoreRerouteCompactnessChanges ;
2022-03-14 10:19:31 -04:00
ERigVMPinDirection UserLinkDirection ;
2022-10-20 08:54:59 -04:00
bool bEnableTypeCasting ;
2019-09-17 19:12:19 -04:00
2020-09-24 00:43:27 -04:00
// temporary maps used for pin redirection
// only valid between Detach & ReattachLinksToPinObjects
TMap < FString , FString > InputPinRedirectors ;
TMap < FString , FString > OutputPinRedirectors ;
struct FControlRigStructPinRedirectorKey
{
FControlRigStructPinRedirectorKey ( )
{
}
FControlRigStructPinRedirectorKey ( UScriptStruct * InScriptStruct , const FString & InPinPathInNode )
: Struct ( InScriptStruct )
, PinPathInNode ( InPinPathInNode )
{
}
friend FORCEINLINE uint32 GetTypeHash ( const FControlRigStructPinRedirectorKey & Cache )
{
return HashCombine ( GetTypeHash ( Cache . Struct ) , GetTypeHash ( Cache . PinPathInNode ) ) ;
}
FORCEINLINE bool operator = = ( const FControlRigStructPinRedirectorKey & Other ) const
{
return Struct = = Other . Struct & & PinPathInNode = = Other . PinPathInNode ;
}
FORCEINLINE bool operator ! = ( const FControlRigStructPinRedirectorKey & Other ) const
{
return Struct ! = Other . Struct | | PinPathInNode ! = Other . PinPathInNode ;
}
UScriptStruct * Struct ;
FString PinPathInNode ;
} ;
static TMap < FControlRigStructPinRedirectorKey , FString > PinPathCoreRedirectors ;
FCriticalSection PinPathCoreRedirectorsLock ;
2020-12-02 10:59:58 -04:00
FRigVMUnitNodeCreatedContext UnitNodeCreatedContext ;
2020-10-19 08:06:50 -04:00
2022-03-30 05:21:45 -04:00
bool bIsTransacting ; // Performing undo/redo transaction
2021-05-12 11:49:38 -04:00
bool bIsRunningUnitTest ;
2022-03-01 04:23:55 -05:00
bool bIsFullyResolvingTemplateNode ;
2022-11-14 09:19:46 -05:00
public :
2022-05-09 07:34:28 -04:00
bool bSuspendRecomputingTemplateFilters ;
2022-11-14 09:19:46 -05:00
private :
2022-08-23 07:06:22 -04:00
# if WITH_EDITOR
bool bRegisterTemplateNodeUsage ;
# endif
2021-05-12 11:49:38 -04:00
2019-09-17 19:12:19 -04:00
friend class URigVMGraph ;
2021-10-19 06:24:52 -04:00
friend class URigVMPin ;
2019-09-17 19:12:19 -04:00
friend class URigVMActionStack ;
2022-03-07 12:07:36 -05:00
friend struct FRigVMBaseAction ;
2019-09-17 19:12:19 -04:00
friend class URigVMCompiler ;
2020-01-22 17:58:55 -05:00
friend struct FRigVMControllerObjectFactory ;
friend struct FRigVMAddRerouteNodeAction ;
2020-09-24 00:43:27 -04:00
friend struct FRigVMChangePinTypeAction ;
2022-01-10 10:15:49 -05:00
friend struct FRigVMInjectNodeIntoPinAction ;
2020-09-24 00:43:27 -04:00
friend class FRigVMParserAST ;
2021-09-10 10:04:27 -04:00
friend class FRigVMControllerCompileBracketScope ;
2022-09-17 01:49:42 -04:00
friend class FRigVMControllerGraphGuard ;
2022-11-11 07:04:17 -05:00
friend struct FRigVMClient ;
2019-09-17 19:12:19 -04:00
} ;
2020-12-14 08:58:12 -04:00
class FRigVMControllerGraphGuard
{
public :
FRigVMControllerGraphGuard ( URigVMController * InController , URigVMGraph * InGraph , bool bSetupUndoRedo = true )
: Controller ( InController )
, bUndo ( bSetupUndoRedo )
{
Controller - > PushGraph ( InGraph , bUndo ) ;
2022-09-17 01:49:42 -04:00
NumGraphs = Controller - > Graphs . Num ( ) ;
2020-12-14 08:58:12 -04:00
}
~ FRigVMControllerGraphGuard ( )
{
2022-09-17 01:49:42 -04:00
// an action can be cancelled in the middle of a graph guard,
// in that case CancelAction should have already popped the graph
if ( Controller - > Graphs . Num ( ) < NumGraphs )
{
return ;
}
2020-12-14 08:58:12 -04:00
Controller - > PopGraph ( bUndo ) ;
}
private :
URigVMController * Controller ;
bool bUndo ;
2022-09-17 01:49:42 -04:00
int32 NumGraphs ;
2020-12-14 08:58:12 -04:00
} ;
2022-08-23 07:06:22 -04:00
USTRUCT ( )
struct FRigVMController_CommonTypePerTemplate
{
GENERATED_BODY ( )
UPROPERTY ( EditAnywhere , Category = " RigVMController " )
TMap < FString , int32 > Counts ;
} ;
/**
* Default settings for the RigVM Controller
*/
UCLASS ( config = EditorSettings )
class URigVMControllerSettings : public UObject
{
public :
URigVMControllerSettings ( const FObjectInitializer & Initializer ) ;
GENERATED_BODY ( )
/**
* When adding a link to an execute pin on a template node ,
* this functionality automatically resolves the template node to the
* most commonly used type .
*/
UPROPERTY ( EditAnywhere , Category = " RigVMController " )
bool bAutoResolveTemplateNodesWhenLinkingExecute ;
/** The commonly used types for a template node */
UPROPERTY ( )
TMap < FName , FRigVMController_CommonTypePerTemplate > TemplateDefaultTypes ;
} ;