Updated
This commit is contained in:
@@ -1,135 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Toolkits/AssetEditorToolkit.h"
|
||||
#include "EditorUndoClient.h"
|
||||
#include "BooleanCutTool.h"
|
||||
#include "AnatomicalLayerSystem.h"
|
||||
|
||||
class USkeletalMesh;
|
||||
class SDockTab;
|
||||
class IDetailsView;
|
||||
class SBorder;
|
||||
|
||||
/**
|
||||
* Dismemberment System Editor
|
||||
* Provides real-time boolean cutting and multi-layer system editing functionality
|
||||
* Allows users to create and edit anatomical layer structures for skeletal meshes
|
||||
* Supports physics settings and effect previews
|
||||
*/
|
||||
class FDismembermentEditor : public FAssetEditorToolkit, public FEditorUndoClient
|
||||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
FDismembermentEditor();
|
||||
|
||||
/** Destructor */
|
||||
virtual ~FDismembermentEditor();
|
||||
|
||||
/**
|
||||
* Initialize the dismemberment editor
|
||||
* @param Mode - Toolkit mode
|
||||
* @param InitToolkitHost - Toolkit host
|
||||
* @param InSkeletalMesh - Skeletal mesh to edit
|
||||
*/
|
||||
void InitDismembermentEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, USkeletalMesh* InSkeletalMesh);
|
||||
|
||||
/** Get toolkit name */
|
||||
virtual FName GetToolkitFName() const override;
|
||||
|
||||
/** Get base toolkit name */
|
||||
virtual FText GetBaseToolkitName() const override;
|
||||
|
||||
/** Get world centric tab prefix */
|
||||
virtual FString GetWorldCentricTabPrefix() const override;
|
||||
|
||||
/** Get world centric tab color scale */
|
||||
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
||||
|
||||
/** Post undo handler */
|
||||
virtual void PostUndo(bool bSuccess) override;
|
||||
|
||||
/** Post redo handler */
|
||||
virtual void PostRedo(bool bSuccess) override;
|
||||
|
||||
/** Get current skeletal mesh being edited */
|
||||
USkeletalMesh* GetSkeletalMesh() const { return SkeletalMesh; }
|
||||
|
||||
private:
|
||||
/** Create editor layout */
|
||||
void CreateEditorLayout();
|
||||
|
||||
/** Create editor toolbar */
|
||||
void CreateEditorToolbar();
|
||||
|
||||
/** Register tab spawners */
|
||||
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
|
||||
|
||||
/** Unregister tab spawners */
|
||||
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
|
||||
|
||||
/** Spawn viewport tab */
|
||||
TSharedRef<SDockTab> SpawnTab_Viewport(const FSpawnTabArgs& Args);
|
||||
|
||||
/** Spawn details tab */
|
||||
TSharedRef<SDockTab> SpawnTab_Details(const FSpawnTabArgs& Args);
|
||||
|
||||
/** Spawn layer system tab */
|
||||
TSharedRef<SDockTab> SpawnTab_LayerSystem(const FSpawnTabArgs& Args);
|
||||
|
||||
/** Spawn physics settings tab */
|
||||
TSharedRef<SDockTab> SpawnTab_PhysicsSettings(const FSpawnTabArgs& Args);
|
||||
|
||||
/** Spawn node tree tab */
|
||||
TSharedRef<SDockTab> SpawnTab_NodeTree(const FSpawnTabArgs& Args);
|
||||
|
||||
/** Perform boolean cut operation */
|
||||
void PerformBooleanCut();
|
||||
|
||||
/** Add new anatomical layer */
|
||||
void AddNewLayer();
|
||||
|
||||
/** Save edits */
|
||||
void SaveEdits();
|
||||
|
||||
/** Preview effects */
|
||||
void PreviewEffects();
|
||||
|
||||
private:
|
||||
/** Current skeletal mesh being edited */
|
||||
USkeletalMesh* SkeletalMesh;
|
||||
|
||||
/** Viewport widget */
|
||||
TSharedPtr<SBorder> ViewportWidget;
|
||||
|
||||
/** Details widget */
|
||||
TSharedPtr<IDetailsView> DetailsWidget;
|
||||
|
||||
/** Layer system widget */
|
||||
TSharedPtr<SBorder> LayerSystemWidget;
|
||||
|
||||
/** Physics settings widget */
|
||||
TSharedPtr<SBorder> PhysicsSettingsWidget;
|
||||
|
||||
/** Boolean cut tool */
|
||||
UBooleanCutTool* BooleanCutTool;
|
||||
|
||||
/** Anatomical layer system */
|
||||
UAnatomicalLayerSystem* LayerSystem;
|
||||
|
||||
/** Current cut plane */
|
||||
FCutPlane CurrentCutPlane;
|
||||
|
||||
/** Selected bone name for cutting */
|
||||
FName SelectedBoneName;
|
||||
|
||||
/** Flag to create cap mesh */
|
||||
bool bCreateCapMesh;
|
||||
|
||||
/** Tab ID constants */
|
||||
static const FName ViewportTabId;
|
||||
static const FName DetailsTabId;
|
||||
static const FName LayerSystemTabId;
|
||||
static const FName PhysicsSettingsTabId;
|
||||
static const FName NodeTreeTabId;
|
||||
};
|
@@ -1,347 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "DismembermentCompiler.generated.h"
|
||||
|
||||
class UDismembermentGraphNode;
|
||||
class UDismembermentGraph;
|
||||
|
||||
/**
|
||||
* Dismemberment node type enum
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EDismembermentNodeType : 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")
|
||||
};
|
||||
|
||||
/**
|
||||
* Dismemberment node data structure
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDismembermentNodeData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Node name
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
FName NodeName;
|
||||
|
||||
// Node type
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
EDismembermentNodeType NodeType;
|
||||
|
||||
// Node parameters
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, float> FloatParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, FVector> VectorParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, FRotator> RotatorParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, bool> BoolParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, FName> NameParameters;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dismemberment")
|
||||
TMap<FName, TObjectPtr<UObject>> ObjectParameters;
|
||||
|
||||
// Constructor
|
||||
FDismembermentNodeData()
|
||||
: NodeType(EDismembermentNodeType::None)
|
||||
{
|
||||
}
|
||||
|
||||
// Get float parameter
|
||||
float GetFloatParameter(const FName& ParamName, float DefaultValue = 0.0f) const
|
||||
{
|
||||
if (const float* Value = FloatParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
|
||||
// Get vector parameter
|
||||
FVector GetVectorParameter(const FName& ParamName, const FVector& DefaultValue = FVector::ZeroVector) const
|
||||
{
|
||||
if (const FVector* Value = VectorParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
|
||||
// Get rotator parameter
|
||||
FRotator GetRotatorParameter(const FName& ParamName, const FRotator& DefaultValue = FRotator::ZeroRotator) const
|
||||
{
|
||||
if (const FRotator* Value = RotatorParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
|
||||
// Get bool parameter
|
||||
bool GetBoolParameter(const FName& ParamName, bool DefaultValue = false) const
|
||||
{
|
||||
if (const bool* Value = BoolParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
|
||||
// Get name parameter
|
||||
FName GetNameParameter(const FName& ParamName, const FName& DefaultValue = NAME_None) const
|
||||
{
|
||||
if (const FName* Value = NameParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
|
||||
// Get object parameter
|
||||
TObjectPtr<UObject> GetObjectParameter(const FName& ParamName, TObjectPtr<UObject> DefaultValue = nullptr) const
|
||||
{
|
||||
if (const TObjectPtr<UObject>* Value = ObjectParameters.Find(ParamName))
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
return DefaultValue;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Compiled node data structure
|
||||
*/
|
||||
USTRUCT()
|
||||
struct FCompiledNodeData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Node reference
|
||||
UPROPERTY()
|
||||
TObjectPtr<UDismembermentGraphNode> Node;
|
||||
|
||||
// Input nodes
|
||||
UPROPERTY()
|
||||
TArray<int32> InputNodeIndices;
|
||||
|
||||
// Output nodes
|
||||
UPROPERTY()
|
||||
TArray<int32> OutputNodeIndices;
|
||||
|
||||
// Execution order index
|
||||
int32 ExecutionOrder;
|
||||
|
||||
// Constructor
|
||||
FCompiledNodeData()
|
||||
: Node(nullptr)
|
||||
, ExecutionOrder(-1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Dismemberment compiler class
|
||||
* Compiles a dismemberment graph into executable logic
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentCompiler : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UDismembermentCompiler();
|
||||
|
||||
/**
|
||||
* Compile a dismemberment graph
|
||||
* @param InGraph - The graph to compile
|
||||
* @return True if compilation was successful
|
||||
*/
|
||||
bool CompileGraph(UDismembermentGraph* InGraph);
|
||||
|
||||
/**
|
||||
* Get the compiled node data
|
||||
* @return Array of compiled node data
|
||||
*/
|
||||
const TArray<FCompiledNodeData>& GetCompiledNodeData() const { return CompiledNodeData; }
|
||||
|
||||
/**
|
||||
* Get the execution order
|
||||
* @param OutExecutionOrder - Array to fill with node indices in execution order
|
||||
* @return True if execution order is valid
|
||||
*/
|
||||
bool GetExecutionOrder(TArray<int32>& OutExecutionOrder) const
|
||||
{
|
||||
if (ExecutionOrder.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutExecutionOrder = ExecutionOrder;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node data for a specific node index
|
||||
* @param NodeIndex - Index of the node
|
||||
* @param OutNodeData - Node data to fill
|
||||
* @return True if node data is valid
|
||||
*/
|
||||
bool GetNodeData(int32 NodeIndex, FDismembermentNodeData& OutNodeData) const;
|
||||
|
||||
/**
|
||||
* Add a bone selection
|
||||
* @param BoneName - Name of the bone to select
|
||||
*/
|
||||
void AddBoneSelection(const FName& BoneName);
|
||||
|
||||
/**
|
||||
* Add a cut operation
|
||||
* @param Location - Location of the cut
|
||||
* @param Direction - Direction of the cut
|
||||
* @param Width - Width of the cut
|
||||
* @param Depth - Depth of the cut
|
||||
* @param Material - Material to use for the cut surface
|
||||
*/
|
||||
void AddCutOperation(const FVector& Location, const FVector& Direction, float Width, float Depth, TObjectPtr<UMaterialInterface> Material);
|
||||
|
||||
/**
|
||||
* Add a blood effect
|
||||
* @param Location - Location of the blood effect
|
||||
* @param BloodEffect - Niagara system for the blood effect
|
||||
* @param BloodAmount - Amount of blood
|
||||
* @param BloodPressure - Blood pressure
|
||||
* @param CreateBloodPool - Whether to create a blood pool
|
||||
* @param BloodPoolSize - Size of the blood pool
|
||||
* @param BloodPoolMaterial - Material for the blood pool
|
||||
*/
|
||||
void AddBloodEffect(const FVector& Location, TObjectPtr<UNiagaraSystem> BloodEffect, float BloodAmount, float BloodPressure, bool CreateBloodPool, float BloodPoolSize, TObjectPtr<UMaterialInterface> BloodPoolMaterial);
|
||||
|
||||
/**
|
||||
* Add a physics simulation
|
||||
* @param Mass - Mass of the object
|
||||
* @param LinearDamping - Linear damping
|
||||
* @param AngularDamping - Angular damping
|
||||
* @param EnableGravity - Whether to enable gravity
|
||||
* @param SimulatePhysics - Whether to simulate physics
|
||||
* @param GenerateOverlapEvents - Whether to generate overlap events
|
||||
* @param PhysicalMaterial - Physical material to use
|
||||
* @param ImpulseForce - Force of the impulse
|
||||
* @param ImpulseRadius - Radius of the impulse
|
||||
*/
|
||||
void AddPhysicsSimulation(float Mass, float LinearDamping, float AngularDamping, bool EnableGravity, bool SimulatePhysics, bool GenerateOverlapEvents, TObjectPtr<UPhysicalMaterial> PhysicalMaterial, float ImpulseForce, float ImpulseRadius);
|
||||
|
||||
/**
|
||||
* Add an organ
|
||||
* @param OrganMesh - Mesh for the organ
|
||||
* @param OrganMaterial - Material for the organ
|
||||
* @param AttachBoneName - Name of the bone to attach to
|
||||
* @param RelativeLocation - Relative location
|
||||
* @param RelativeRotation - Relative rotation
|
||||
* @param RelativeScale - Relative scale
|
||||
* @param SimulatePhysics - Whether to simulate physics
|
||||
* @param DamageMultiplier - Damage multiplier
|
||||
* @param IsCriticalOrgan - Whether this is a critical organ
|
||||
* @param BloodAmount - Amount of blood
|
||||
*/
|
||||
void AddOrgan(TObjectPtr<UStaticMesh> OrganMesh, TObjectPtr<UMaterialInterface> OrganMaterial, const FName& AttachBoneName, const FVector& RelativeLocation, const FRotator& RelativeRotation, const FVector& RelativeScale, bool SimulatePhysics, float DamageMultiplier, bool IsCriticalOrgan, float BloodAmount);
|
||||
|
||||
/**
|
||||
* Add a wound effect
|
||||
* @param WoundSize - Size of the wound
|
||||
* @param WoundDepth - Depth of the wound
|
||||
* @param WoundMaterial - Material for the wound
|
||||
* @param WoundEffect - Effect for the wound
|
||||
* @param CreateDecal - Whether to create a decal
|
||||
* @param DecalMaterial - Material for the decal
|
||||
* @param DecalSize - Size of the decal
|
||||
* @param DecalLifetime - Lifetime of the decal
|
||||
* @param AffectBoneHealth - Whether to affect bone health
|
||||
* @param BoneDamage - Amount of bone damage
|
||||
*/
|
||||
void AddWoundEffect(float WoundSize, float WoundDepth, TObjectPtr<UMaterialInterface> WoundMaterial, TObjectPtr<UNiagaraSystem> WoundEffect, bool CreateDecal, TObjectPtr<UMaterialInterface> DecalMaterial, float DecalSize, float DecalLifetime, bool AffectBoneHealth, float BoneDamage);
|
||||
|
||||
private:
|
||||
// The graph being compiled
|
||||
UPROPERTY()
|
||||
TObjectPtr<UDismembermentGraph> Graph;
|
||||
|
||||
// Compiled node data
|
||||
UPROPERTY()
|
||||
TArray<FCompiledNodeData> CompiledNodeData;
|
||||
|
||||
// Execution order
|
||||
UPROPERTY()
|
||||
TArray<int32> ExecutionOrder;
|
||||
|
||||
// Bone selections
|
||||
UPROPERTY()
|
||||
TArray<FName> BoneSelections;
|
||||
|
||||
// Cut operations
|
||||
UPROPERTY()
|
||||
TArray<FTransform> CutOperations;
|
||||
|
||||
// Cut materials
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UMaterialInterface>> CutMaterials;
|
||||
|
||||
// Cut widths
|
||||
UPROPERTY()
|
||||
TArray<float> CutWidths;
|
||||
|
||||
// Cut depths
|
||||
UPROPERTY()
|
||||
TArray<float> CutDepths;
|
||||
|
||||
// Blood effects
|
||||
UPROPERTY()
|
||||
TArray<FTransform> BloodEffectTransforms;
|
||||
|
||||
// Blood effect systems
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UNiagaraSystem>> BloodEffectSystems;
|
||||
|
||||
// Blood amounts
|
||||
UPROPERTY()
|
||||
TArray<float> BloodAmounts;
|
||||
|
||||
// Blood pressures
|
||||
UPROPERTY()
|
||||
TArray<float> BloodPressures;
|
||||
|
||||
// Create blood pools
|
||||
UPROPERTY()
|
||||
TArray<bool> CreateBloodPools;
|
||||
|
||||
// Blood pool sizes
|
||||
UPROPERTY()
|
||||
TArray<float> BloodPoolSizes;
|
||||
|
||||
// Blood pool materials
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UMaterialInterface>> BloodPoolMaterials;
|
||||
|
||||
// Topological sort the nodes
|
||||
bool TopologicalSort();
|
||||
|
||||
// Visit node for topological sort
|
||||
void VisitNode(int32 NodeIndex, TArray<bool>& Visited, TArray<bool>& TempMark, TArray<int32>& SortedNodes, bool& bHasCycle);
|
||||
};
|
@@ -1,161 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "DismembermentCompiler.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "BooleanCutTool.h"
|
||||
#include "DismembermentExecutor.generated.h"
|
||||
|
||||
class AActor;
|
||||
class USkeletalMeshComponent;
|
||||
class UDismembermentCompiler;
|
||||
|
||||
/**
|
||||
* Dismemberment executor class
|
||||
* Executes a compiled dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentExecutor : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UDismembermentExecutor();
|
||||
|
||||
/**
|
||||
* Initialize the executor with a compiler
|
||||
* @param InCompiler - The compiler containing the compiled graph
|
||||
*/
|
||||
void Initialize(UDismembermentCompiler* InCompiler);
|
||||
|
||||
/**
|
||||
* Execute the compiled graph on a target actor
|
||||
* @param TargetActor - The actor to apply the dismemberment effects to
|
||||
* @return True if execution was successful
|
||||
*/
|
||||
bool Execute(AActor* TargetActor);
|
||||
|
||||
/**
|
||||
* Get the target actor
|
||||
* @return The target actor
|
||||
*/
|
||||
AActor* GetTargetActor() const { return TargetActor; }
|
||||
|
||||
/**
|
||||
* Get the target skeletal mesh component
|
||||
* @return The target skeletal mesh component
|
||||
*/
|
||||
USkeletalMeshComponent* GetTargetSkeletalMesh() const { return TargetSkeletalMesh; }
|
||||
|
||||
/**
|
||||
* Get the selected bones
|
||||
* @return Array of selected bone names
|
||||
*/
|
||||
const TArray<FName>& GetSelectedBones() const { return SelectedBones; }
|
||||
|
||||
/**
|
||||
* Add a bone to the selection
|
||||
* @param BoneName - Name of the bone to add
|
||||
*/
|
||||
void AddSelectedBone(const FName& BoneName);
|
||||
|
||||
/**
|
||||
* Apply a cut to the target
|
||||
* @param Location - Location of the cut
|
||||
* @param Direction - Direction of the cut
|
||||
* @param Width - Width of the cut
|
||||
* @param Depth - Depth of the cut
|
||||
* @param Material - Material to use for the cut surface
|
||||
* @return True if the cut was successful
|
||||
*/
|
||||
bool ApplyCut(const FVector& Location, const FVector& Direction, float Width, float Depth, UMaterialInterface* Material);
|
||||
|
||||
/**
|
||||
* Spawn a blood effect
|
||||
* @param Location - Location of the blood effect
|
||||
* @param BloodEffect - Niagara system for the blood effect
|
||||
* @param BloodAmount - Amount of blood
|
||||
* @param BloodPressure - Blood pressure
|
||||
* @param CreateBloodPool - Whether to create a blood pool
|
||||
* @param BloodPoolSize - Size of the blood pool
|
||||
* @param BloodPoolMaterial - Material for the blood pool
|
||||
* @return True if the blood effect was created successfully
|
||||
*/
|
||||
bool SpawnBloodEffect(const FVector& Location, UNiagaraSystem* BloodEffect, float BloodAmount, float BloodPressure, bool CreateBloodPool, float BloodPoolSize, UMaterialInterface* BloodPoolMaterial);
|
||||
|
||||
/**
|
||||
* Apply physics simulation
|
||||
* @param Mass - Mass of the object
|
||||
* @param LinearDamping - Linear damping
|
||||
* @param AngularDamping - Angular damping
|
||||
* @param EnableGravity - Whether to enable gravity
|
||||
* @param SimulatePhysics - Whether to simulate physics
|
||||
* @param GenerateOverlapEvents - Whether to generate overlap events
|
||||
* @param PhysicalMaterial - Physical material to use
|
||||
* @param ImpulseForce - Force of the impulse
|
||||
* @param ImpulseRadius - Radius of the impulse
|
||||
* @return True if the physics simulation was applied successfully
|
||||
*/
|
||||
bool ApplyPhysics(float Mass, float LinearDamping, float AngularDamping, bool EnableGravity, bool SimulatePhysics, bool GenerateOverlapEvents, UPhysicalMaterial* PhysicalMaterial, float ImpulseForce, float ImpulseRadius);
|
||||
|
||||
/**
|
||||
* Spawn an organ
|
||||
* @param OrganMesh - Mesh for the organ
|
||||
* @param OrganMaterial - Material for the organ
|
||||
* @param AttachBoneName - Name of the bone to attach to
|
||||
* @param RelativeLocation - Relative location
|
||||
* @param RelativeRotation - Relative rotation
|
||||
* @param RelativeScale - Relative scale
|
||||
* @param SimulatePhysics - Whether to simulate physics
|
||||
* @param DamageMultiplier - Damage multiplier
|
||||
* @param IsCriticalOrgan - Whether this is a critical organ
|
||||
* @param BloodAmount - Amount of blood
|
||||
* @return True if the organ was spawned successfully
|
||||
*/
|
||||
bool SpawnOrgan(UStaticMesh* OrganMesh, UMaterialInterface* OrganMaterial, const FName& AttachBoneName, const FVector& RelativeLocation, const FRotator& RelativeRotation, const FVector& RelativeScale, bool SimulatePhysics, float DamageMultiplier, bool IsCriticalOrgan, float BloodAmount);
|
||||
|
||||
/**
|
||||
* Apply a wound effect
|
||||
* @param WoundSize - Size of the wound
|
||||
* @param WoundDepth - Depth of the wound
|
||||
* @param WoundMaterial - Material for the wound
|
||||
* @param WoundEffect - Effect for the wound
|
||||
* @param CreateDecal - Whether to create a decal
|
||||
* @param DecalMaterial - Material for the decal
|
||||
* @param DecalSize - Size of the decal
|
||||
* @param DecalLifetime - Lifetime of the decal
|
||||
* @param AffectBoneHealth - Whether to affect bone health
|
||||
* @param BoneDamage - Amount of bone damage
|
||||
* @return True if the wound effect was applied successfully
|
||||
*/
|
||||
bool ApplyWoundEffect(float WoundSize, float WoundDepth, UMaterialInterface* WoundMaterial, UNiagaraSystem* WoundEffect, bool CreateDecal, UMaterialInterface* DecalMaterial, float DecalSize, float DecalLifetime, bool AffectBoneHealth, float BoneDamage);
|
||||
|
||||
private:
|
||||
// The compiler containing the compiled graph
|
||||
UPROPERTY()
|
||||
TObjectPtr<UDismembermentCompiler> Compiler;
|
||||
|
||||
// The target actor
|
||||
UPROPERTY()
|
||||
TObjectPtr<AActor> TargetActor;
|
||||
|
||||
// The target skeletal mesh component
|
||||
UPROPERTY()
|
||||
TObjectPtr<USkeletalMeshComponent> TargetSkeletalMesh;
|
||||
|
||||
// Selected bones
|
||||
UPROPERTY()
|
||||
TArray<FName> SelectedBones;
|
||||
|
||||
// Boolean cut tool for mesh cutting operations
|
||||
UPROPERTY()
|
||||
TObjectPtr<UBooleanCutTool> CutTool;
|
||||
|
||||
// Find the target skeletal mesh component
|
||||
bool FindTargetSkeletalMesh();
|
||||
|
||||
// Execute a node
|
||||
bool ExecuteNode(int32 NodeIndex);
|
||||
};
|
@@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "DismembermentGraph.generated.h"
|
||||
|
||||
/**
|
||||
* Dismemberment graph for visual logic design
|
||||
* Allows for node-based editing of dismemberment system logic
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraph : public UEdGraph
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraph();
|
||||
|
||||
// The asset that owns this graph
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UDismembermentGraphAsset> OwningAsset;
|
||||
};
|
@@ -1,80 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Toolkits/AssetEditorToolkit.h"
|
||||
#include "GraphEditor.h"
|
||||
|
||||
class UDismembermentGraphAsset;
|
||||
class UDismembermentGraph;
|
||||
class SDockTab;
|
||||
|
||||
/**
|
||||
* Dismemberment graph editor
|
||||
* Provides a Mutable-like node editor for dismemberment system logic
|
||||
*/
|
||||
class FLESHEDITOR_API FDismembermentGraphEditor : public FAssetEditorToolkit
|
||||
{
|
||||
public:
|
||||
FDismembermentGraphEditor();
|
||||
virtual ~FDismembermentGraphEditor();
|
||||
|
||||
// Initialize the editor
|
||||
void InitDismembermentGraphEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, UDismembermentGraphAsset* InAsset);
|
||||
|
||||
// FAssetEditorToolkit interface
|
||||
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& TabManager) override;
|
||||
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& TabManager) override;
|
||||
virtual FName GetToolkitFName() const override;
|
||||
virtual FText GetBaseToolkitName() const override;
|
||||
virtual FString GetWorldCentricTabPrefix() const override;
|
||||
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
||||
// End of FAssetEditorToolkit interface
|
||||
|
||||
// Get the edited asset
|
||||
UDismembermentGraphAsset* GetEditedAsset() const { return EditedAsset; }
|
||||
|
||||
// Get the graph editor widget
|
||||
TSharedRef<SGraphEditor> GetGraphEditor() const { return GraphEditorWidget.ToSharedRef(); }
|
||||
|
||||
private:
|
||||
// The asset being edited
|
||||
UDismembermentGraphAsset* EditedAsset;
|
||||
|
||||
// The graph editor widget
|
||||
TSharedPtr<SGraphEditor> GraphEditorWidget;
|
||||
|
||||
// Tab spawners
|
||||
TSharedRef<SDockTab> SpawnTab_GraphCanvas(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_Properties(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_Palette(const FSpawnTabArgs& Args);
|
||||
|
||||
// Create graph editor widget
|
||||
TSharedRef<SGraphEditor> CreateGraphEditorWidget();
|
||||
|
||||
// Graph editor commands
|
||||
void CreateCommandList();
|
||||
TSharedPtr<FUICommandList> GraphEditorCommands;
|
||||
|
||||
// Command handlers
|
||||
void SelectAllNodes();
|
||||
void DeleteSelectedNodes();
|
||||
void CutSelectedNodes();
|
||||
void CopySelectedNodes();
|
||||
void PasteNodes();
|
||||
void DuplicateSelectedNodes();
|
||||
|
||||
// Graph changed handler
|
||||
void OnGraphChanged(const FEdGraphEditAction& Action);
|
||||
|
||||
// Node selection changed handler
|
||||
void OnSelectedNodesChanged(const TSet<UObject*>& NewSelection);
|
||||
|
||||
// Compile the graph
|
||||
void CompileGraph();
|
||||
|
||||
// Properties panel
|
||||
TSharedPtr<class IDetailsView> PropertiesWidget;
|
||||
|
||||
// Node palette
|
||||
TSharedPtr<class SDismembermentGraphPalette> PaletteWidget;
|
||||
};
|
@@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Factories/Factory.h"
|
||||
#include "DismembermentGraphEditorFactory.generated.h"
|
||||
|
||||
/**
|
||||
* Factory for creating dismemberment graph assets
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphEditorFactory : public UFactory
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphEditorFactory();
|
||||
|
||||
// UFactory interface
|
||||
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
||||
virtual bool ShouldShowInNewMenu() const override;
|
||||
// End of UFactory interface
|
||||
};
|
@@ -1,43 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
#include "DismembermentGraphNode.generated.h"
|
||||
|
||||
/**
|
||||
* Base class for all dismemberment graph nodes
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNode : public UEdGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNode();
|
||||
|
||||
// Node title color
|
||||
UPROPERTY(EditAnywhere, Category = "Appearance")
|
||||
FLinearColor NodeTitleColor;
|
||||
|
||||
// Node category
|
||||
UPROPERTY(EditAnywhere, Category = "Category")
|
||||
FText NodeCategory;
|
||||
|
||||
// Node description
|
||||
UPROPERTY(EditAnywhere, Category = "Description")
|
||||
FText NodeDescription;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
virtual FLinearColor GetNodeTitleColor() const override;
|
||||
virtual FText GetTooltipText() const override;
|
||||
virtual FText GetMenuCategory() const;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// Compile this node into executable logic
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler);
|
||||
|
||||
// Execute this node
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor);
|
||||
};
|
@@ -1,47 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "DismembermentGraphNodeBloodEffect.generated.h"
|
||||
|
||||
/**
|
||||
* Node for creating blood effects in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodeBloodEffect : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodeBloodEffect();
|
||||
|
||||
// Blood effect parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect")
|
||||
TObjectPtr<UNiagaraSystem> BloodEffect;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect")
|
||||
float BloodAmount;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect")
|
||||
float BloodPressure;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect")
|
||||
bool bCreateBloodPool;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect", meta = (EditCondition = "bCreateBloodPool"))
|
||||
float BloodPoolSize;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Blood Effect", meta = (EditCondition = "bCreateBloodPool"))
|
||||
TObjectPtr<UMaterialInterface> BloodPoolMaterial;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "DismembermentGraphNodeBoneSelect.generated.h"
|
||||
|
||||
/**
|
||||
* Node for selecting bones in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodeBoneSelect : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodeBoneSelect();
|
||||
|
||||
// Bone selection parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Bone Selection")
|
||||
TArray<FName> BoneNames;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Bone Selection")
|
||||
bool bUseRegex;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Bone Selection", meta = (EditCondition = "bUseRegex"))
|
||||
FString BoneNamePattern;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Bone Selection")
|
||||
bool bIncludeChildren;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "DismembermentGraphNodeCut.generated.h"
|
||||
|
||||
/**
|
||||
* Node for performing a cut operation in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodeCut : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodeCut();
|
||||
|
||||
// Cut parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Cut Parameters")
|
||||
float CutWidth;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Cut Parameters")
|
||||
float CutDepth;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Cut Parameters")
|
||||
bool bUseCustomMaterial;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Cut Parameters", meta = (EditCondition = "bUseCustomMaterial"))
|
||||
TObjectPtr<UMaterialInterface> CustomCutMaterial;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EdGraphUtilities.h"
|
||||
|
||||
class UDismembermentGraphNode;
|
||||
class SDismembermentGraphNode;
|
||||
|
||||
/**
|
||||
* Dismemberment graph node factory
|
||||
* Used to create visual representations of dismemberment graph nodes
|
||||
*/
|
||||
class FDismembermentGraphNodeFactory : public FGraphPanelNodeFactory
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FDismembermentGraphNodeFactory();
|
||||
|
||||
FDismembermentGraphNodeFactory(UClass* InNodeClass, const FText& InDisplayName, const FText& InTooltip);
|
||||
|
||||
// FGraphPanelNodeFactory interface
|
||||
virtual TSharedPtr<SGraphNode> CreateNode(UEdGraphNode* Node) const override;
|
||||
// End of interface
|
||||
|
||||
private:
|
||||
// Node class
|
||||
UClass* NodeClass;
|
||||
|
||||
// Display name
|
||||
FText DisplayName;
|
||||
|
||||
// Tooltip
|
||||
FText Tooltip;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dismemberment schema action - New node
|
||||
* Used to create new nodes in the context menu
|
||||
*/
|
||||
class FDismembermentSchemaAction_NewNode : public FEdGraphSchemaAction
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
FDismembermentSchemaAction_NewNode(const FText& InNodeCategory, const FText& InMenuDesc, const FText& InToolTip, const int32 InGrouping);
|
||||
|
||||
// Perform action
|
||||
virtual UEdGraphNode* PerformAction(UEdGraph* ParentGraph, UEdGraphPin* FromPin, const FVector2D Location, bool bSelectNewNode = true) override;
|
||||
|
||||
// Node class
|
||||
TSubclassOf<UDismembermentGraphNode> NodeClass;
|
||||
};
|
@@ -1,58 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "DismembermentGraphNodeOrgan.generated.h"
|
||||
|
||||
/**
|
||||
* Node for organ simulation in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodeOrgan : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodeOrgan();
|
||||
|
||||
// Organ parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
TObjectPtr<UStaticMesh> OrganMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
TObjectPtr<UMaterialInterface> OrganMaterial;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
FName AttachBoneName;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
FVector RelativeLocation;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
FRotator RelativeRotation;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
FVector RelativeScale;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
bool bSimulatePhysics;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
float DamageMultiplier;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
bool bIsCriticalOrgan;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Organ Parameters")
|
||||
float BloodAmount;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "DismembermentGraphNodePhysics.generated.h"
|
||||
|
||||
/**
|
||||
* Node for physics simulation in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodePhysics : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodePhysics();
|
||||
|
||||
// Physics parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
float Mass;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
float LinearDamping;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
float AngularDamping;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
bool bEnableGravity;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
bool bSimulatePhysics;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
bool bGenerateOverlapEvents;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
TObjectPtr<UPhysicalMaterial> PhysicalMaterial;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
float ImpulseForce;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Physics Parameters")
|
||||
float ImpulseRadius;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,59 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DismembermentGraphNode.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "DismembermentGraphNodeWound.generated.h"
|
||||
|
||||
/**
|
||||
* Node for wound effects in the dismemberment graph
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphNodeWound : public UDismembermentGraphNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDismembermentGraphNodeWound();
|
||||
|
||||
// Wound parameters
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
float WoundSize;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
float WoundDepth;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
TObjectPtr<UMaterialInterface> WoundMaterial;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
TObjectPtr<UNiagaraSystem> WoundEffect;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
bool bCreateDecal;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters", meta = (EditCondition = "bCreateDecal"))
|
||||
TObjectPtr<UMaterialInterface> DecalMaterial;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters", meta = (EditCondition = "bCreateDecal"))
|
||||
float DecalSize;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters", meta = (EditCondition = "bCreateDecal"))
|
||||
float DecalLifetime;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters")
|
||||
bool bAffectBoneHealth;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Wound Parameters", meta = (EditCondition = "bAffectBoneHealth"))
|
||||
float BoneDamage;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UDismembermentGraphNode interface
|
||||
virtual void CompileNode(class FDismembermentCompiler* Compiler) override;
|
||||
virtual void ExecuteNode(class FDismembermentExecutor* Executor) override;
|
||||
// End of UDismembermentGraphNode interface
|
||||
};
|
@@ -1,56 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Views/STableRow.h"
|
||||
#include "Widgets/Views/STreeView.h"
|
||||
|
||||
class FDismembermentGraphEditor;
|
||||
|
||||
/**
|
||||
* Node category structure for the palette
|
||||
*/
|
||||
struct FDismembermentGraphNodeCategory
|
||||
{
|
||||
// Category name
|
||||
FText CategoryName;
|
||||
|
||||
// Child nodes
|
||||
TArray<TSharedPtr<FDismembermentGraphNodeCategory>> Children;
|
||||
|
||||
// Node classes in this category
|
||||
TArray<UClass*> NodeClasses;
|
||||
|
||||
// Constructor
|
||||
FDismembermentGraphNodeCategory(const FText& InCategoryName)
|
||||
: CategoryName(InCategoryName)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Node palette widget for the dismemberment graph editor
|
||||
* This is a stub class that will be implemented later
|
||||
*/
|
||||
class FLESHEDITOR_API SDismembermentGraphPalette : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SDismembermentGraphPalette) {}
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, TSharedPtr<FDismembermentGraphEditor> InGraphEditor)
|
||||
{
|
||||
GraphEditor = InGraphEditor;
|
||||
|
||||
// Create a simple placeholder widget
|
||||
ChildSlot
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(FText::FromString("Dismemberment Graph Palette - Coming Soon"))
|
||||
];
|
||||
}
|
||||
|
||||
private:
|
||||
// The graph editor that owns this palette
|
||||
TWeakPtr<FDismembermentGraphEditor> GraphEditor;
|
||||
};
|
@@ -1,168 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EdGraph/EdGraphSchema.h"
|
||||
#include "DismembermentGraphSchema.generated.h"
|
||||
|
||||
class UDismembermentGraphNode;
|
||||
|
||||
/**
|
||||
* Connection response
|
||||
*/
|
||||
USTRUCT()
|
||||
struct FDismembermentGraphConnectionResponse
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Response type
|
||||
UPROPERTY()
|
||||
int32 Response;
|
||||
|
||||
// Response text
|
||||
UPROPERTY()
|
||||
FText Message;
|
||||
|
||||
// Pin names that would be broken
|
||||
UPROPERTY()
|
||||
TArray<FText> BreakingPins;
|
||||
|
||||
// Constructor
|
||||
FDismembermentGraphConnectionResponse()
|
||||
: Response(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Connection response types
|
||||
*/
|
||||
struct FDismembermentGraphConnectionResponse_K2
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
// No error
|
||||
OK = 0,
|
||||
// Generic error
|
||||
ERROR_INCOMPATIBLE = 1,
|
||||
// Disallowed pin connection
|
||||
ERROR_DISALLOWED = 2,
|
||||
// Self-connection not allowed
|
||||
ERROR_SELF_CONNECTION = 3,
|
||||
// Cycle not allowed
|
||||
ERROR_CYCLE = 4
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Pin type
|
||||
*/
|
||||
USTRUCT()
|
||||
struct FDismembermentGraphPinType
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Pin category
|
||||
UPROPERTY()
|
||||
FName PinCategory;
|
||||
|
||||
// Constructor
|
||||
FDismembermentGraphPinType()
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor with category
|
||||
FDismembermentGraphPinType(const FName& InPinCategory)
|
||||
: PinCategory(InPinCategory)
|
||||
{
|
||||
}
|
||||
|
||||
// Equality operator
|
||||
bool operator==(const FDismembermentGraphPinType& Other) const
|
||||
{
|
||||
return PinCategory == Other.PinCategory;
|
||||
}
|
||||
|
||||
// Inequality operator
|
||||
bool operator!=(const FDismembermentGraphPinType& Other) const
|
||||
{
|
||||
return !(*this == Other);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Dismemberment graph schema
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentGraphSchema : public UEdGraphSchema
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Pin categories
|
||||
static const FName PC_Exec;
|
||||
static const FName PC_Bone;
|
||||
static const FName PC_Cut;
|
||||
static const FName PC_Blood;
|
||||
static const FName PC_Physics;
|
||||
static const FName PC_Organ;
|
||||
static const FName PC_Wound;
|
||||
|
||||
// UEdGraphSchema interface
|
||||
virtual void GetGraphContextActions(FGraphContextMenuBuilder& ContextMenuBuilder) const override;
|
||||
virtual void GetContextMenuActions(UToolMenu* Menu, UGraphNodeContextMenuContext* Context) const override;
|
||||
virtual const FPinConnectionResponse CanCreateConnection(const UEdGraphPin* A, const UEdGraphPin* B) const override;
|
||||
virtual bool TryCreateConnection(UEdGraphPin* A, UEdGraphPin* B) const override;
|
||||
virtual bool ShouldHidePinDefaultValue(UEdGraphPin* Pin) const override;
|
||||
virtual FLinearColor GetPinTypeColor(const FEdGraphPinType& PinType) const override;
|
||||
virtual void BreakNodeLinks(UEdGraphNode& TargetNode) const override;
|
||||
virtual void BreakPinLinks(UEdGraphPin& TargetPin, bool bSendsNodeNotification) const override;
|
||||
virtual void BreakSinglePinLink(UEdGraphPin* SourcePin, UEdGraphPin* TargetPin) const override;
|
||||
virtual void DroppedAssetsOnGraph(const TArray<FAssetData>& Assets, const FVector2D& GraphPosition, UEdGraph* Graph) const override;
|
||||
virtual void DroppedAssetsOnNode(const TArray<FAssetData>& Assets, const FVector2D& GraphPosition, UEdGraphNode* Node) const override;
|
||||
virtual void DroppedAssetsOnPin(const TArray<FAssetData>& Assets, const FVector2D& GraphPosition, UEdGraphPin* Pin) const override;
|
||||
virtual void GetAssetsNodeHoverMessage(const TArray<FAssetData>& Assets, const UEdGraphNode* HoverNode, FString& OutTooltipText, bool& OutOkIcon) const override;
|
||||
virtual void GetAssetsPinHoverMessage(const TArray<FAssetData>& Assets, const UEdGraphPin* HoverPin, FString& OutTooltipText, bool& OutOkIcon) const override;
|
||||
// End of UEdGraphSchema interface
|
||||
|
||||
/**
|
||||
* Check if two pins can be connected
|
||||
* @param PinA - First pin
|
||||
* @param PinB - Second pin
|
||||
* @param OutResponse - Connection response
|
||||
* @return True if the pins can be connected
|
||||
*/
|
||||
bool CanConnectPins(const UEdGraphPin* PinA, const UEdGraphPin* PinB, FDismembermentGraphConnectionResponse& OutResponse) const;
|
||||
|
||||
/**
|
||||
* Check if connecting two pins would create a cycle
|
||||
* @param PinA - First pin
|
||||
* @param PinB - Second pin
|
||||
* @return True if connecting the pins would create a cycle
|
||||
*/
|
||||
bool WouldCreateCycle(const UEdGraphPin* PinA, const UEdGraphPin* PinB) const;
|
||||
|
||||
/**
|
||||
* Get the pin type from a pin
|
||||
* @param Pin - The pin to get the type from
|
||||
* @return The pin type
|
||||
*/
|
||||
static FDismembermentGraphPinType GetPinType(const UEdGraphPin* Pin);
|
||||
|
||||
/**
|
||||
* Get the pin type color
|
||||
* @param PinType - The pin type
|
||||
* @return The pin color
|
||||
*/
|
||||
static FLinearColor GetPinTypeColor(const FDismembermentGraphPinType& PinType);
|
||||
|
||||
/**
|
||||
* Create a new node
|
||||
* @param NodeClass - Class of the node to create
|
||||
* @param ParentGraph - Graph to create the node in
|
||||
* @param NodePosX - X position of the node
|
||||
* @param NodePosY - Y position of the node
|
||||
* @param bSelectNewNode - Whether to select the new node
|
||||
* @return The created node
|
||||
*/
|
||||
static UDismembermentGraphNode* CreateNode(TSubclassOf<UDismembermentGraphNode> NodeClass, UEdGraph* ParentGraph, float NodePosX, float NodePosY, bool bSelectNewNode = true);
|
||||
};
|
@@ -1,170 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "DismembermentPreviewManager.generated.h"
|
||||
|
||||
// Add a log category declaration
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogFLESHPreview, Log, All);
|
||||
|
||||
class UDismembermentGraphNode;
|
||||
class USkeletalMeshComponent;
|
||||
class AActor;
|
||||
class UWorld;
|
||||
class UNiagaraComponent;
|
||||
class UDecalComponent;
|
||||
class UStaticMeshComponent;
|
||||
|
||||
/**
|
||||
* Preview manager for dismemberment effects
|
||||
* Handles real-time preview of dismemberment nodes
|
||||
*/
|
||||
UCLASS()
|
||||
class FLESHEDITOR_API UDismembermentPreviewManager : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
UDismembermentPreviewManager();
|
||||
|
||||
/**
|
||||
* Initialize the preview manager
|
||||
* @param InWorld - The world to create the preview in
|
||||
*/
|
||||
void Initialize(TObjectPtr<UWorld> InWorld);
|
||||
|
||||
/**
|
||||
* Clean up the preview manager
|
||||
*/
|
||||
void Cleanup();
|
||||
|
||||
/**
|
||||
* Set the target actor for preview
|
||||
* @param InActor - The actor to preview on
|
||||
*/
|
||||
void SetTargetActor(TObjectPtr<AActor> InActor);
|
||||
|
||||
/**
|
||||
* Preview a node
|
||||
* @param Node - The node to preview
|
||||
* @return True if the preview was successful
|
||||
*/
|
||||
bool PreviewNode(TObjectPtr<UDismembermentGraphNode> Node);
|
||||
|
||||
/**
|
||||
* Clear the current preview
|
||||
*/
|
||||
void ClearPreview();
|
||||
|
||||
/**
|
||||
* Update the preview
|
||||
* @param DeltaTime - Time since last update
|
||||
*/
|
||||
void Tick(float DeltaTime);
|
||||
|
||||
/**
|
||||
* Get the target actor
|
||||
* @return The target actor
|
||||
*/
|
||||
TObjectPtr<AActor> GetTargetActor() const { return TargetActor; }
|
||||
|
||||
/**
|
||||
* Get the target skeletal mesh component
|
||||
* @return The target skeletal mesh component
|
||||
*/
|
||||
TObjectPtr<USkeletalMeshComponent> GetTargetSkeletalMesh() const { return TargetSkeletalMesh; }
|
||||
|
||||
private:
|
||||
// The world to create the preview in
|
||||
UPROPERTY()
|
||||
TObjectPtr<UWorld> World;
|
||||
|
||||
// The target actor
|
||||
UPROPERTY()
|
||||
TObjectPtr<AActor> TargetActor;
|
||||
|
||||
// The target skeletal mesh component
|
||||
UPROPERTY()
|
||||
TObjectPtr<USkeletalMeshComponent> TargetSkeletalMesh;
|
||||
|
||||
// The currently previewed node
|
||||
UPROPERTY()
|
||||
TObjectPtr<UDismembermentGraphNode> PreviewedNode;
|
||||
|
||||
// Preview components
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UNiagaraComponent>> PreviewNiagaraComponents;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UDecalComponent>> PreviewDecalComponents;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<TObjectPtr<UStaticMeshComponent>> PreviewStaticMeshComponents;
|
||||
|
||||
// Preview cut plane mesh
|
||||
UPROPERTY()
|
||||
TObjectPtr<UStaticMeshComponent> PreviewCutPlaneMesh;
|
||||
|
||||
// Preview bone selections
|
||||
UPROPERTY()
|
||||
TArray<FName> PreviewBoneSelections;
|
||||
|
||||
// Preview cut locations
|
||||
UPROPERTY()
|
||||
TArray<FTransform> PreviewCutTransforms;
|
||||
|
||||
// Preview blood effect locations
|
||||
UPROPERTY()
|
||||
TArray<FTransform> PreviewBloodEffectTransforms;
|
||||
|
||||
// Preview organ locations
|
||||
UPROPERTY()
|
||||
TArray<FTransform> PreviewOrganTransforms;
|
||||
|
||||
// Preview wound locations
|
||||
UPROPERTY()
|
||||
TArray<FTransform> PreviewWoundTransforms;
|
||||
|
||||
// Find the target skeletal mesh component
|
||||
bool FindTargetSkeletalMesh();
|
||||
|
||||
// Preview a cut node
|
||||
bool PreviewCutNode(TObjectPtr<class UDismembermentGraphNodeCut> CutNode);
|
||||
|
||||
// Preview a bone select node
|
||||
bool PreviewBoneSelectNode(TObjectPtr<class UDismembermentGraphNodeBoneSelect> BoneSelectNode);
|
||||
|
||||
// Preview a blood effect node
|
||||
bool PreviewBloodEffectNode(TObjectPtr<class UDismembermentGraphNodeBloodEffect> BloodEffectNode);
|
||||
|
||||
// Preview a physics node
|
||||
bool PreviewPhysicsNode(TObjectPtr<class UDismembermentGraphNodePhysics> PhysicsNode);
|
||||
|
||||
// Preview an organ node
|
||||
bool PreviewOrganNode(TObjectPtr<class UDismembermentGraphNodeOrgan> OrganNode);
|
||||
|
||||
// Preview a wound node
|
||||
bool PreviewWoundNode(TObjectPtr<class UDismembermentGraphNodeWound> WoundNode);
|
||||
|
||||
// Create a preview cut plane mesh
|
||||
TObjectPtr<UStaticMeshComponent> CreatePreviewCutPlaneMesh(const FVector& Location, const FVector& Direction, float Width, float Depth, UMaterialInterface* Material);
|
||||
|
||||
// Create a preview blood effect
|
||||
TObjectPtr<UNiagaraComponent> CreatePreviewBloodEffect(const FVector& Location, UNiagaraSystem* BloodEffect, float BloodAmount, float BloodPressure);
|
||||
|
||||
// Create a preview blood pool
|
||||
TObjectPtr<UDecalComponent> CreatePreviewBloodPool(const FVector& Location, float Size, UMaterialInterface* Material);
|
||||
|
||||
// Create a preview organ
|
||||
TObjectPtr<UStaticMeshComponent> CreatePreviewOrgan(UStaticMesh* OrganMesh, UMaterialInterface* OrganMaterial, const FName& AttachBoneName, const FVector& RelativeLocation, const FRotator& RelativeRotation, const FVector& RelativeScale);
|
||||
|
||||
// Create a preview wound
|
||||
TObjectPtr<UDecalComponent> CreatePreviewWound(const FVector& Location, float Size, UMaterialInterface* Material);
|
||||
|
||||
// Clear all preview components
|
||||
void ClearPreviewComponents();
|
||||
};
|
@@ -1,68 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "SGraphNode.h"
|
||||
|
||||
class UDismembermentGraphNode;
|
||||
|
||||
/**
|
||||
* Visual representation of a dismemberment graph node
|
||||
*/
|
||||
class FLESHEDITOR_API SDismembermentGraphNode : public SGraphNode
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SDismembermentGraphNode) {}
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, UEdGraphNode* InNode);
|
||||
|
||||
// SGraphNode interface
|
||||
virtual void UpdateGraphNode() override;
|
||||
virtual void CreatePinWidgets() override;
|
||||
virtual void AddPin(const TSharedRef<SGraphPin>& PinToAdd) override;
|
||||
virtual TSharedPtr<SToolTip> GetComplexTooltip() override;
|
||||
virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
|
||||
virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
|
||||
virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
|
||||
virtual void OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
|
||||
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
|
||||
// End of SGraphNode interface
|
||||
|
||||
protected:
|
||||
// Get the dismemberment graph node
|
||||
UDismembermentGraphNode* GetDismembermentGraphNode() const;
|
||||
|
||||
// Get the node title widget
|
||||
TSharedRef<SWidget> GetNodeTitleWidget();
|
||||
|
||||
// Get the node body widget
|
||||
TSharedRef<SWidget> GetNodeBodyWidget();
|
||||
|
||||
// Get the node preview widget
|
||||
TSharedRef<SWidget> GetNodePreviewWidget();
|
||||
|
||||
// Node color
|
||||
FSlateColor GetNodeColor() const;
|
||||
|
||||
// Node title color
|
||||
FSlateColor GetNodeTitleColor() const;
|
||||
|
||||
// Node title text
|
||||
FText GetNodeTitle() const;
|
||||
|
||||
// Node category text
|
||||
FText GetNodeCategory() const;
|
||||
|
||||
// Node description text
|
||||
FText GetNodeDescription() const;
|
||||
|
||||
// Is the node selected
|
||||
bool IsNodeSelected() const;
|
||||
|
||||
// Is the node hovered
|
||||
bool IsNodeHovered() const;
|
||||
|
||||
private:
|
||||
// Is the node hovered
|
||||
bool bIsHovered;
|
||||
};
|
@@ -1,120 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "EditorViewportClient.h"
|
||||
#include "SEditorViewport.h"
|
||||
|
||||
class UDismembermentPreviewManager;
|
||||
class USkeletalMesh;
|
||||
class AActor;
|
||||
class FPreviewScene;
|
||||
class SDismembermentPreviewViewportClient;
|
||||
|
||||
/**
|
||||
* Viewport for previewing dismemberment effects
|
||||
*/
|
||||
class FLESHEDITOR_API SDismembermentPreviewViewport : public SEditorViewport
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SDismembermentPreviewViewport)
|
||||
{}
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Constructs the viewport widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~SDismembermentPreviewViewport();
|
||||
|
||||
/**
|
||||
* Set the preview manager
|
||||
* @param InPreviewManager - The preview manager to use
|
||||
*/
|
||||
void SetPreviewManager(UDismembermentPreviewManager* InPreviewManager);
|
||||
|
||||
/**
|
||||
* Set the preview skeletal mesh
|
||||
* @param InSkeletalMesh - The skeletal mesh to preview
|
||||
*/
|
||||
void SetPreviewSkeletalMesh(USkeletalMesh* InSkeletalMesh);
|
||||
|
||||
/**
|
||||
* Get the preview actor
|
||||
* @return The preview actor
|
||||
*/
|
||||
AActor* GetPreviewActor() const;
|
||||
|
||||
/**
|
||||
* Refresh the viewport
|
||||
*/
|
||||
void RefreshViewport();
|
||||
|
||||
protected:
|
||||
// SEditorViewport interface
|
||||
virtual TSharedRef<FEditorViewportClient> MakeEditorViewportClient() override;
|
||||
virtual void OnFocusViewportToSelection() override;
|
||||
virtual bool IsVisible() const override;
|
||||
// End of SEditorViewport interface
|
||||
|
||||
private:
|
||||
// The preview scene
|
||||
TSharedPtr<FPreviewScene> PreviewScene;
|
||||
|
||||
// The viewport client
|
||||
TSharedPtr<SDismembermentPreviewViewportClient> ViewportClient;
|
||||
|
||||
// The preview manager
|
||||
TObjectPtr<UDismembermentPreviewManager> PreviewManager;
|
||||
|
||||
// The preview actor
|
||||
TObjectPtr<AActor> PreviewActor;
|
||||
|
||||
// Create the preview actor
|
||||
void CreatePreviewActor();
|
||||
|
||||
// Update the preview actor
|
||||
void UpdatePreviewActor();
|
||||
};
|
||||
|
||||
/**
|
||||
* Viewport client for previewing dismemberment effects
|
||||
*/
|
||||
class SDismembermentPreviewViewportClient : public FEditorViewportClient
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param InPreviewScene - The preview scene
|
||||
* @param InViewportWidget - The viewport widget
|
||||
*/
|
||||
SDismembermentPreviewViewportClient(FPreviewScene* InPreviewScene, const TWeakPtr<SDismembermentPreviewViewport>& InViewportWidget);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~SDismembermentPreviewViewportClient();
|
||||
|
||||
// FEditorViewportClient interface
|
||||
virtual void Tick(float DeltaSeconds) override;
|
||||
virtual void Draw(const FSceneView* View, FPrimitiveDrawInterface* PDI) override;
|
||||
virtual void DrawCanvas(FViewport& InViewport, FSceneView& View, FCanvas& Canvas) override;
|
||||
// End of FEditorViewportClient interface
|
||||
|
||||
/**
|
||||
* Set the preview manager
|
||||
* @param InPreviewManager - The preview manager to use
|
||||
*/
|
||||
void SetPreviewManager(UDismembermentPreviewManager* InPreviewManager);
|
||||
|
||||
private:
|
||||
// The viewport widget
|
||||
TWeakPtr<SDismembermentPreviewViewport> ViewportWidget;
|
||||
|
||||
// The preview manager
|
||||
TObjectPtr<UDismembermentPreviewManager> PreviewManager;
|
||||
};
|
@@ -3,20 +3,31 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "Toolkits/AssetEditorToolkit.h"
|
||||
#include "Widgets/Docking/SDockTab.h"
|
||||
#include "BooleanCutTool.h"
|
||||
#include "EditorUndoClient.h"
|
||||
#include "Widgets/SViewport.h"
|
||||
#include "EditorViewportClient.h"
|
||||
#include "Widgets/Input/SSearchBox.h"
|
||||
#include "Slate/SceneViewport.h"
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
#include "Styling/SlateStyleRegistry.h"
|
||||
|
||||
// Forward declaration for BooleanCutTool
|
||||
class FBooleanCutTool;
|
||||
|
||||
#include "Logging/LogMacros.h"
|
||||
#include "FLESHGraph/FLESHCompiler.h"
|
||||
#include "FLESHGraph/FLESHExecutor.h"
|
||||
|
||||
class SDockTab;
|
||||
class SGraphEditor;
|
||||
class SPropertyTreeView;
|
||||
class SAssetBrowser;
|
||||
class SMatrixInputWidget;
|
||||
class FFLESHViewportClient;
|
||||
class FSceneViewport;
|
||||
class UVisceraNodeObject;
|
||||
class FDismembermentEditor;
|
||||
|
||||
// Forward declaration
|
||||
class FFLESHViewportClient;
|
||||
|
||||
// Define log category
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogFLESHEditor, Log, All);
|
||||
|
||||
@@ -203,7 +214,9 @@ public:
|
||||
virtual FText GetBaseToolkitName() const override;
|
||||
virtual FString GetWorldCentricTabPrefix() const override;
|
||||
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
||||
// End of FAssetEditorToolkit interface
|
||||
// Override FAssetEditorToolkit methods with correct parameter types
|
||||
virtual void OnToolkitHostingStarted(const TSharedRef<class IToolkit>& InToolkit) override;
|
||||
virtual void OnToolkitHostingFinished(const TSharedRef<class IToolkit>& InToolkit) override;
|
||||
|
||||
// FEditorUndoClient interface
|
||||
virtual void PostUndo(bool bSuccess) override;
|
||||
@@ -219,12 +232,22 @@ public:
|
||||
UObject* GetEditingObject() const { return EditingObject; }
|
||||
|
||||
// Add DismembermentEditor related tab spawners
|
||||
TSharedRef<SDockTab> SpawnTab_LayerSystem(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_LayerSystemPanel(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_PhysicsSettings(const FSpawnTabArgs& Args);
|
||||
|
||||
// Create DismembermentEditor related widgets
|
||||
TSharedRef<SBorder> CreateLayerSystemWidget();
|
||||
TSharedRef<SBorder> CreatePhysicsSettingsWidget();
|
||||
TSharedRef<SWidget> CreateNodeTreeWidget();
|
||||
|
||||
// Generate node tree row
|
||||
TSharedRef<ITableRow> OnGenerateNodeTreeRow(TSharedPtr<FVisceraNodeItem> Item, const TSharedRef<STableViewBase>& OwnerTable);
|
||||
|
||||
// Get node tree children
|
||||
void OnGetNodeTreeChildren(TSharedPtr<FVisceraNodeItem> Item, TArray<TSharedPtr<FVisceraNodeItem>>& OutChildren);
|
||||
|
||||
// Open node tree right-click menu
|
||||
TSharedPtr<SWidget> OnNodeTreeContextMenuOpening();
|
||||
|
||||
private:
|
||||
// Tab spawners
|
||||
@@ -234,6 +257,9 @@ private:
|
||||
TSharedRef<SDockTab> SpawnTab_MatrixEditor(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_GraphEditor(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_Toolbar(const FSpawnTabArgs& Args);
|
||||
// Additional tab spawners
|
||||
TSharedRef<SDockTab> SpawnTab_DismembermentGraph(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_NodeTree(const FSpawnTabArgs& Args);
|
||||
|
||||
// Create viewport widget
|
||||
TSharedRef<SWidget> CreateViewportWidget();
|
||||
@@ -256,7 +282,7 @@ private:
|
||||
// Create command list
|
||||
void CreateCommandList();
|
||||
|
||||
// Extend toolbar with custom buttons
|
||||
// Extend toolbar
|
||||
void ExtendToolbar();
|
||||
|
||||
// Generate bone tree row
|
||||
@@ -273,6 +299,18 @@ private:
|
||||
|
||||
// Build viscera node tree
|
||||
void BuildVisceraNodeTree();
|
||||
|
||||
// Count total nodes in a tree recursively
|
||||
int32 CountNodes(TSharedPtr<FVisceraNodeItem> Node);
|
||||
|
||||
// 从父节点中递归移除节点
|
||||
bool RemoveNodeFromParent(TSharedPtr<FVisceraNodeItem> ParentNode, TSharedPtr<FVisceraNodeItem> NodeToRemove);
|
||||
|
||||
// 递归复制节点
|
||||
void CopyNodeRecursive(TSharedPtr<FVisceraNodeItem> SourceNode, TSharedPtr<FVisceraNodeItem> TargetParentNode);
|
||||
|
||||
// 查找节点的父节点并添加复制的节点
|
||||
bool AddCopyToParent(TSharedPtr<FVisceraNodeItem> CurrentNode, TSharedPtr<FVisceraNodeItem> NodeToFind, TSharedPtr<FVisceraNodeItem> NodeCopy);
|
||||
|
||||
// Tree view generation methods
|
||||
TSharedRef<ITableRow> OnGenerateNodeRow(TSharedPtr<FVisceraNodeItem> InItem, const TSharedRef<STableViewBase>& OwnerTable);
|
||||
@@ -299,6 +337,15 @@ private:
|
||||
void OnSavePreset();
|
||||
void OnLoadPreset();
|
||||
|
||||
// 按钮点击事件处理
|
||||
FReply OnResetCameraClicked();
|
||||
FReply OnToggleWireframeClicked();
|
||||
FReply OnToggleBonesClicked();
|
||||
FReply OnImportModelClicked();
|
||||
FReply OnSavePresetClicked();
|
||||
FReply OnLoadPresetClicked();
|
||||
FReply OnBooleanCutClicked();
|
||||
|
||||
// Viewport widget
|
||||
TSharedPtr<class SViewport> ViewportWidget;
|
||||
|
||||
@@ -350,13 +397,8 @@ private:
|
||||
// Scene viewport
|
||||
TSharedPtr<FSceneViewport> Viewport;
|
||||
|
||||
// Viewport related methods
|
||||
FReply OnResetCameraClicked();
|
||||
FReply OnToggleWireframeClicked();
|
||||
FReply OnToggleBonesClicked();
|
||||
|
||||
// The object being edited
|
||||
UObject* EditingObject;
|
||||
TObjectPtr<UObject> EditingObject;
|
||||
|
||||
// Tab IDs
|
||||
static const FName ViewportTabId;
|
||||
@@ -368,9 +410,7 @@ private:
|
||||
static const FName LayerSystemTabId;
|
||||
static const FName PhysicsSettingsTabId;
|
||||
static const FName DismembermentGraphTabId;
|
||||
|
||||
// Is the editor initialized?
|
||||
bool bIsInitialized;
|
||||
static const FName NodeTreeTabId;
|
||||
|
||||
// New DismembermentEditor related Widgets
|
||||
TSharedPtr<SBorder> LayerSystemWidget;
|
||||
@@ -378,4 +418,57 @@ private:
|
||||
|
||||
// Error handling method
|
||||
void HandleEditorError(const FText& ErrorMessage);
|
||||
|
||||
// Layer names for dropdown
|
||||
TArray<TSharedPtr<FString>> LayerNames;
|
||||
|
||||
// Layer descriptions for tooltips
|
||||
TMap<FString, FString> LayerDescriptions;
|
||||
|
||||
// Layer visibility states
|
||||
TMap<FString, bool> LayerVisibility;
|
||||
|
||||
// Node tree root nodes
|
||||
TArray<TSharedPtr<FVisceraNodeItem>> NodeTreeRoots;
|
||||
|
||||
// Get node tree root nodes
|
||||
const TArray<TSharedPtr<FVisceraNodeItem>>& GetNodeTreeRoots() const { return NodeTreeRoots; }
|
||||
|
||||
// Get currently selected node
|
||||
TSharedPtr<FVisceraNodeItem> GetSelectedNodeItem() const { return SelectedNodeItem; }
|
||||
|
||||
// Make these methods public so they can be accessed by FFLESHViewportClient
|
||||
friend class FFLESHViewportClient;
|
||||
|
||||
// Node search filter text
|
||||
FText NodeSearchText;
|
||||
|
||||
// Filtered node tree roots
|
||||
TArray<TSharedPtr<FVisceraNodeItem>> FilteredNodeTreeRoots;
|
||||
|
||||
// Check if a node matches the search filter
|
||||
bool DoesNodeMatchFilter(const TSharedPtr<FVisceraNodeItem>& Node) const;
|
||||
|
||||
// Apply search filter to node tree
|
||||
void ApplySearchFilter();
|
||||
|
||||
// Reset search filter
|
||||
void ResetSearchFilter();
|
||||
|
||||
// Handle node search text changes
|
||||
void OnNodeSearchTextChanged(const FText& InFilterText);
|
||||
|
||||
// Bone tree items
|
||||
TArray<TSharedPtr<FBoneTreeItem>> BoneTreeRoots;
|
||||
|
||||
// Boolean cut tool
|
||||
TSharedPtr<class FBooleanCutTool> BooleanCutTool;
|
||||
|
||||
// FLESH Compiler
|
||||
UPROPERTY()
|
||||
UFLESHCompiler* FLESHCompiler;
|
||||
|
||||
// FLESH Executor
|
||||
UPROPERTY()
|
||||
UFLESHExecutor* FLESHExecutor;
|
||||
};
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
void OpenFLESHEditorCommand();
|
||||
|
||||
/** Open FLESH Editor */
|
||||
void OpenFLESHEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, UObject* ObjectToEdit);
|
||||
void OpenFLESHEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, TObjectPtr<UObject> ObjectToEdit);
|
||||
|
||||
private:
|
||||
/** Plugin command list */
|
||||
|
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;
|
||||
};
|
@@ -28,6 +28,18 @@ public:
|
||||
/** Handle mouse clicks - new API */
|
||||
virtual bool InputKey(const FInputKeyEventArgs& EventArgs) override;
|
||||
|
||||
/** Override mouse movement handling to provide camera controls similar to asset editor */
|
||||
virtual bool InputAxis(FViewport* InViewport, int32 ControllerId, FKey Key, float Delta, float DeltaTime, int32 NumSamples = 1, bool bGamepad = false) override;
|
||||
|
||||
/** Load and display objects from NodeTree */
|
||||
void LoadNodesFromNodeTree();
|
||||
|
||||
/** Update objects displayed in the viewport */
|
||||
void UpdateVisibleNodes();
|
||||
|
||||
/** Focus on the selected object */
|
||||
void FocusOnSelectedNode();
|
||||
|
||||
/** Reset camera */
|
||||
void ResetCamera();
|
||||
|
||||
@@ -52,4 +64,7 @@ private:
|
||||
|
||||
/** Preview scene for the viewport */
|
||||
TSharedPtr<FPreviewScene> PreviewScene;
|
||||
|
||||
/** Recursively load node and its children */
|
||||
void LoadNodeRecursive(TSharedPtr<FVisceraNodeItem> Node, USceneComponent* ParentComponent);
|
||||
};
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "FLESH/Public/BooleanCutTool.h" // Added ECapMeshMethod enum reference
|
||||
#include "VisceraNodeObject.generated.h"
|
||||
|
||||
// Forward declarations
|
||||
|
Reference in New Issue
Block a user