154 lines
4.4 KiB
C++
154 lines
4.4 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/NoExportTypes.h"
|
|
#include "AnatomicalStructureBrush.generated.h"
|
|
|
|
// Forward declarations
|
|
class USkeletalMesh;
|
|
class UStaticMesh;
|
|
|
|
/**
|
|
* Anatomical brush type enumeration
|
|
*/
|
|
UENUM(BlueprintType)
|
|
enum class EAnatomicalBrushType : uint8
|
|
{
|
|
Bone, // Bone brush
|
|
Muscle, // Muscle brush
|
|
Organ, // Organ brush
|
|
Vessel, // Blood vessel brush
|
|
Nerve, // Nerve brush
|
|
Custom // Custom brush
|
|
};
|
|
|
|
/**
|
|
* Anatomical brush settings
|
|
*/
|
|
USTRUCT(BlueprintType)
|
|
struct FAnatomicalBrushSettings
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
// Brush type
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush")
|
|
EAnatomicalBrushType BrushType = EAnatomicalBrushType::Bone;
|
|
|
|
// Brush size
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (ClampMin = "0.1", ClampMax = "100.0"))
|
|
float BrushSize = 10.0f;
|
|
|
|
// Brush strength
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float BrushStrength = 0.5f;
|
|
|
|
// Brush falloff
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float BrushFalloff = 0.5f;
|
|
|
|
// Brush material
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush")
|
|
TObjectPtr<UMaterialInterface> BrushMaterial = nullptr;
|
|
|
|
// Brush mesh
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush")
|
|
TObjectPtr<UStaticMesh> BrushMesh = nullptr;
|
|
|
|
// Enable physics
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush")
|
|
bool bEnablePhysics = true;
|
|
|
|
// Physics density
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (EditCondition = "bEnablePhysics"))
|
|
float PhysicsDensity = 1.0f;
|
|
|
|
// Physics elasticity
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (EditCondition = "bEnablePhysics"))
|
|
float PhysicsElasticity = 0.5f;
|
|
|
|
// Fracture threshold
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FLESH|Brush", meta = (EditCondition = "bEnablePhysics"))
|
|
float FractureThreshold = 100.0f;
|
|
};
|
|
|
|
/**
|
|
* Anatomical structure brush tool class
|
|
* Used for creating and editing anatomical structures in the editor
|
|
*/
|
|
UCLASS(BlueprintType)
|
|
class FLESHEDITOR_API UAnatomicalStructureBrush : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Constructor
|
|
UAnatomicalStructureBrush();
|
|
|
|
/**
|
|
* Initialize the brush
|
|
* @param InSettings - Brush settings
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
void Initialize(const FAnatomicalBrushSettings& InSettings);
|
|
|
|
/**
|
|
* Apply brush to skeletal mesh
|
|
* @param TargetMesh - Target skeletal mesh
|
|
* @param Location - Application location
|
|
* @param Direction - Application direction
|
|
* @param BoneName - Bone name, if specified, only apply to this bone
|
|
* @return Whether the application was successful
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
bool ApplyToSkeletalMesh(USkeletalMesh* TargetMesh, const FVector& Location, const FVector& Direction, FName BoneName = NAME_None);
|
|
|
|
/**
|
|
* Apply brush to static mesh
|
|
* @param TargetMesh - Target static mesh
|
|
* @param Location - Application location
|
|
* @param Direction - Application direction
|
|
* @return Whether the application was successful
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
bool ApplyToStaticMesh(UStaticMesh* TargetMesh, const FVector& Location, const FVector& Direction);
|
|
|
|
/**
|
|
* Set brush type
|
|
* @param BrushType - Brush type
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
void SetBrushType(EAnatomicalBrushType BrushType);
|
|
|
|
/**
|
|
* Set brush size
|
|
* @param Size - Brush size
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
void SetBrushSize(float Size);
|
|
|
|
/**
|
|
* Set brush strength
|
|
* @param Strength - Brush strength
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
void SetBrushStrength(float Strength);
|
|
|
|
/**
|
|
* Get brush settings
|
|
* @return Current brush settings
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "FLESH|Brush")
|
|
FAnatomicalBrushSettings GetBrushSettings() const;
|
|
|
|
private:
|
|
// Brush settings
|
|
UPROPERTY(EditAnywhere, Category = "FLESH|Brush")
|
|
FAnatomicalBrushSettings BrushSettings;
|
|
|
|
// Internal function for creating anatomical structure
|
|
UStaticMesh* CreateAnatomicalStructure(const FVector& Location, const FVector& Direction, float Size);
|
|
|
|
// Internal function for applying physics properties
|
|
void ApplyPhysicsProperties(UStaticMesh* Mesh);
|
|
};
|