Files
UnrealEngineUWP/Engine/Source/Developer/RigVMDeveloper/Public/RigVMModel/RigVMVariableDescription.h
Helge Mathee b37d7c3439 RigVM: split up RigVMTypeUtils into runtime and developer
#rb sara.schvartzman
#jira na
#preflight https://horde.devtools.epicgames.com/job/6214c3dc263b1fd1a27b9809

[CL 19070635 by Helge Mathee in ue5-main branch]
2022-02-22 06:21:42 -05:00

65 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "RigVMCore/RigVMExternalVariable.h"
#include "RigVMModel/RigVMNode.h"
#include "EdGraphSchema_K2.h"
#include "RigVMDeveloperTypeUtils.h"
#include "RigVMVariableDescription.generated.h"
/**
* The variable description is used to convey information
* about unique variables within a Graph. Multiple Variable
* Nodes can share the same variable description.
*/
USTRUCT(BlueprintType)
struct FRigVMGraphVariableDescription
{
GENERATED_BODY()
public:
// comparison operator
bool operator ==(const FRigVMGraphVariableDescription& Other) const
{
return Name == Other.Name;
}
// The name of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FName Name;
// The C++ data type of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FString CPPType;
// The Struct of the C++ data type of the variable (or nullptr)
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
TObjectPtr<UObject> CPPTypeObject = nullptr;
// The default value of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FString DefaultValue;
// Returns nullptr external variable matching this description
FORCEINLINE FRigVMExternalVariable ToExternalVariable() const
{
return RigVMTypeUtils::ExternalVariableFromRigVMVariableDescription(*this);
}
FORCEINLINE FEdGraphPinType ToPinType() const
{
return RigVMTypeUtils::PinTypeFromRigVMVariableDescription(*this);
}
FORCEINLINE bool ChangeType(const FEdGraphPinType& PinType)
{
UObject* Object = nullptr;
const bool bSuccess = RigVMTypeUtils::CPPTypeFromPinType(PinType, CPPType, &Object);
CPPTypeObject = Object;
return bSuccess;
}
};