Updated
This commit is contained in:
141
Source/FLESHEditor/Public/FLESHGraph/FLESHCompiler.h
Normal file
141
Source/FLESHEditor/Public/FLESHGraph/FLESHCompiler.h
Normal file
@@ -0,0 +1,141 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "FLESHCompiler.generated.h"
|
||||
|
||||
class UFLESHGraphNode;
|
||||
class UFLESHGraph;
|
||||
|
||||
/**
|
||||
* FLESH node type enum
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EFLESHNodeType : uint8
|
||||
{
|
||||
None UMETA(DisplayName = "None"),
|
||||
Cut UMETA(DisplayName = "Cut"),
|
||||
BloodEffect UMETA(DisplayName = "Blood Effect"),
|
||||
Physics UMETA(DisplayName = "Physics"),
|
||||
Organ UMETA(DisplayName = "Organ"),
|
||||
Wound UMETA(DisplayName = "Wound"),
|
||||
BoneSelection UMETA(DisplayName = "Bone Selection")
|
||||
};
|
||||
|
||||
/**
|
||||
* FLESH node data structure
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FFLESHNodeData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Node name
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
FName NodeName;
|
||||
|
||||
// Node type
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
EFLESHNodeType NodeType;
|
||||
|
||||
// Node parameters
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, float> FloatParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, FVector> VectorParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, FRotator> RotatorParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, bool> BoolParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, FString> StringParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, TObjectPtr<UObject>> ObjectParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, FName> NameParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, FLinearColor> ColorParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TMap<FName, TObjectPtr<UNiagaraSystem>> NiagaraSystemParameters;
|
||||
|
||||
// Connected nodes
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH")
|
||||
TArray<int32> ConnectedNodes;
|
||||
};
|
||||
|
||||
/**
|
||||
* FLESH compiler class
|
||||
* Compiles FLESH graph into executable format
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class FLESHEDITOR_API UFLESHCompiler : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UFLESHCompiler();
|
||||
|
||||
// Initialize compiler with graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void Initialize(UFLESHGraph* InGraph);
|
||||
|
||||
// Compile graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool Compile();
|
||||
|
||||
// Get compiled node data
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
TArray<FFLESHNodeData> GetCompiledNodeData() const;
|
||||
|
||||
// Get execution order
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
TArray<int32> GetExecutionOrder() const;
|
||||
|
||||
// Check if compilation was successful
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool IsCompilationSuccessful() const;
|
||||
|
||||
// Get error message
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
FString GetErrorMessage() const;
|
||||
|
||||
private:
|
||||
// Source graph
|
||||
UPROPERTY()
|
||||
TObjectPtr<UFLESHGraph> SourceGraph;
|
||||
|
||||
// Compiled node data
|
||||
UPROPERTY()
|
||||
TArray<FFLESHNodeData> CompiledNodeData;
|
||||
|
||||
// Execution order
|
||||
UPROPERTY()
|
||||
TArray<int32> ExecutionOrder;
|
||||
|
||||
// Compilation status
|
||||
UPROPERTY()
|
||||
bool bCompilationSuccessful;
|
||||
|
||||
// Error message
|
||||
UPROPERTY()
|
||||
FString ErrorMessage;
|
||||
|
||||
// Process node
|
||||
bool ProcessNode(UFLESHGraphNode* Node, int32 NodeIndex);
|
||||
|
||||
// Sort nodes in execution order
|
||||
void SortNodes();
|
||||
|
||||
// Validate graph
|
||||
bool ValidateGraph();
|
||||
};
|
80
Source/FLESHEditor/Public/FLESHGraph/FLESHExecutor.h
Normal file
80
Source/FLESHEditor/Public/FLESHGraph/FLESHExecutor.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "FLESHGraph/FLESHCompiler.h"
|
||||
#include "FLESHExecutor.generated.h"
|
||||
|
||||
class UBooleanCutTool;
|
||||
class USkeletalMeshComponent;
|
||||
|
||||
/**
|
||||
* FLESH executor class
|
||||
* Executes compiled FLESH graph on target actor
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class FLESHEDITOR_API UFLESHExecutor : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UFLESHExecutor();
|
||||
|
||||
// Initialize executor with compiler
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void Initialize(UFLESHCompiler* InCompiler);
|
||||
|
||||
// Execute graph on target actor
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool Execute(AActor* InTargetActor);
|
||||
|
||||
// Set boolean cut tool
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void SetCutTool(UBooleanCutTool* InCutTool);
|
||||
|
||||
// Get boolean cut tool
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
UBooleanCutTool* GetCutTool() const;
|
||||
|
||||
private:
|
||||
// Compiler reference
|
||||
UPROPERTY()
|
||||
TObjectPtr<UFLESHCompiler> Compiler;
|
||||
|
||||
// Target actor
|
||||
UPROPERTY()
|
||||
TObjectPtr<AActor> TargetActor;
|
||||
|
||||
// Target skeletal mesh component
|
||||
UPROPERTY()
|
||||
TObjectPtr<USkeletalMeshComponent> TargetSkeletalMesh;
|
||||
|
||||
// Boolean cut tool
|
||||
UPROPERTY()
|
||||
TObjectPtr<UBooleanCutTool> CutTool;
|
||||
|
||||
// Find target skeletal mesh component
|
||||
bool FindTargetSkeletalMesh();
|
||||
|
||||
// Execute node
|
||||
bool ExecuteNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute cut node
|
||||
bool ExecuteCutNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute blood effect node
|
||||
bool ExecuteBloodEffectNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute physics node
|
||||
bool ExecutePhysicsNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute organ node
|
||||
bool ExecuteOrganNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute wound node
|
||||
bool ExecuteWoundNode(const FFLESHNodeData& NodeData);
|
||||
|
||||
// Execute bone selection node
|
||||
bool ExecuteBoneSelectionNode(const FFLESHNodeData& NodeData);
|
||||
};
|
74
Source/FLESHEditor/Public/FLESHGraph/FLESHGraph.h
Normal file
74
Source/FLESHEditor/Public/FLESHGraph/FLESHGraph.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "FLESHGraph.generated.h"
|
||||
|
||||
class UFLESHGraphNode;
|
||||
|
||||
/**
|
||||
* FLESH graph class
|
||||
* Manages nodes in the FLESH editor
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class FLESHEDITOR_API UFLESHGraph : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UFLESHGraph();
|
||||
|
||||
// Initialize graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void Initialize();
|
||||
|
||||
// Add node
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
UFLESHGraphNode* AddNode(TSubclassOf<UFLESHGraphNode> NodeClass, const FVector2D& Position);
|
||||
|
||||
// Remove node
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool RemoveNode(UFLESHGraphNode* Node);
|
||||
|
||||
// Connect nodes
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool ConnectNodes(UFLESHGraphNode* SourceNode, UFLESHGraphNode* TargetNode);
|
||||
|
||||
// Disconnect nodes
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool DisconnectNodes(UFLESHGraphNode* SourceNode, UFLESHGraphNode* TargetNode);
|
||||
|
||||
// Get all nodes
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
TArray<UFLESHGraphNode*> GetAllNodes() const;
|
||||
|
||||
// Get root node
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
UFLESHGraphNode* GetRootNode() const;
|
||||
|
||||
// Set root node
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void SetRootNode(UFLESHGraphNode* InRootNode);
|
||||
|
||||
// Clear graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
void ClearGraph();
|
||||
|
||||
// Save graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool SaveGraph();
|
||||
|
||||
// Load graph
|
||||
UFUNCTION(BlueprintCallable, Category = "FLESH")
|
||||
bool LoadGraph();
|
||||
|
||||
private:
|
||||
// All nodes in the graph
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UFLESHGraphNode>> Nodes;
|
||||
|
||||
// Root node
|
||||
UPROPERTY()
|
||||
TObjectPtr<UFLESHGraphNode> RootNode;
|
||||
};
|
93
Source/FLESHEditor/Public/FLESHGraph/FLESHGraphNode.h
Normal file
93
Source/FLESHEditor/Public/FLESHGraph/FLESHGraphNode.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#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;
|
||||
};
|
Reference in New Issue
Block a user