Files
FLESH/Source/FLESHEditor/Public/FLESHGraph/FLESHGraphNode.h
2025-04-23 01:18:06 +08:00

94 lines
2.6 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "FLESHCompiler.h"
#include "FLESHGraphNode.generated.h"
/**
* FLESH Graph Node Base Class
* Base class for all FLESH graph node types
*/
UCLASS(BlueprintType, Abstract)
class FLESHEDITOR_API UFLESHGraphNode : public UObject
{
GENERATED_BODY()
public:
// Constructor
UFLESHGraphNode();
// Get node title
UFUNCTION(BlueprintCallable, Category = "FLESH")
virtual FString GetNodeTitle() const;
// Get node type
UFUNCTION(BlueprintCallable, Category = "FLESH")
virtual EFLESHNodeType GetNodeType() const;
// Get node color
UFUNCTION(BlueprintCallable, Category = "FLESH")
virtual FLinearColor GetNodeColor() const;
// Get node position
UFUNCTION(BlueprintCallable, Category = "FLESH")
FVector2D GetNodePosition() const;
// Set node position
UFUNCTION(BlueprintCallable, Category = "FLESH")
void SetNodePosition(const FVector2D& InPosition);
// Get input nodes
UFUNCTION(BlueprintCallable, Category = "FLESH")
TArray<UFLESHGraphNode*> GetInputNodes() const;
// Get output nodes
UFUNCTION(BlueprintCallable, Category = "FLESH")
TArray<UFLESHGraphNode*> GetOutputNodes() const;
// Add input node
UFUNCTION(BlueprintCallable, Category = "FLESH")
bool AddInputNode(UFLESHGraphNode* Node);
// Add output node
UFUNCTION(BlueprintCallable, Category = "FLESH")
bool AddOutputNode(UFLESHGraphNode* Node);
// Remove input node
UFUNCTION(BlueprintCallable, Category = "FLESH")
bool RemoveInputNode(UFLESHGraphNode* Node);
// Remove output node
UFUNCTION(BlueprintCallable, Category = "FLESH")
bool RemoveOutputNode(UFLESHGraphNode* Node);
// Compile node
UFUNCTION(BlueprintCallable, Category = "FLESH")
virtual bool CompileNode(FFLESHNodeData& OutNodeData);
protected:
// Node title
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
FString NodeTitle;
// Node type
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
EFLESHNodeType NodeType;
// Node color
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
FLinearColor NodeColor;
// Node position
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
FVector2D NodePosition;
// Input nodes
UPROPERTY()
TArray<TObjectPtr<UFLESHGraphNode>> InputNodes;
// Output nodes
UPROPERTY()
TArray<TObjectPtr<UFLESHGraphNode>> OutputNodes;
};