Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

100 lines
2.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;
UPROPERTY()
FName CPPTypeObjectPath;
// The default value of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FString DefaultValue;
// The category of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FText Category;
// The tooltip of the variable
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
FText Tooltip;
// Should this variable be exposed on spawn
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
bool bExposedOnSpawn = false;
// Should this variable be exposed on spawn
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
bool bExposeToCinematics = false;
// Is this variable public
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
bool bPublic = false;
// Is this variable private
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = RigVMGraphVariableDescription)
bool bPrivate = true;
// Returns nullptr external variable matching this description
FRigVMExternalVariable ToExternalVariable() const
{
return RigVMTypeUtils::ExternalVariableFromRigVMVariableDescription(*this);
}
FEdGraphPinType ToPinType() const
{
return RigVMTypeUtils::PinTypeFromRigVMVariableDescription(*this);
}
bool ChangeType(const FEdGraphPinType& PinType)
{
UObject* Object = nullptr;
const bool bSuccess = RigVMTypeUtils::CPPTypeFromPinType(PinType, CPPType, &Object);
CPPTypeObject = Object;
if (CPPTypeObject)
{
CPPTypeObjectPath = *CPPTypeObject->GetPathName();
}
else
{
CPPTypeObjectPath = NAME_None;
}
return bSuccess;
}
};