添加 Source/FLESHEditor/Public/VisceraNodeFactory.h

This commit is contained in:
2025-04-21 18:37:31 +08:00
parent d5d633ac68
commit f177912c5e

View File

@@ -0,0 +1,107 @@
#pragma once
#include "CoreMinimal.h"
#include "FLESHEditor.h"
/**
* Node factory class, used to create and configure different types of viscera nodes
*/
class FVisceraNodeFactory
{
public:
/**
* Create soft body node
* @param Name - Node name
* @param DisplayName - Display name
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateSoftBodyNode(const FName& Name, const FString& DisplayName);
/**
* Create anchor node
* @param Name - Node name
* @param DisplayName - Display name
* @param Location - Anchor location
* @param Radius - Anchor radius
* @param Stiffness - Anchor stiffness
* @param BoneName - Bone name
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateAnchorNode(
const FName& Name,
const FString& DisplayName,
const FVector& Location = FVector::ZeroVector,
float Radius = 5.0f,
float Stiffness = 1.0f,
FName BoneName = NAME_None);
/**
* Create line chain node
* @param Name - Node name
* @param DisplayName - Display name
* @param Points - Line chain points
* @param Stiffness - Line chain stiffness
* @param Thickness - Line chain thickness
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateLineChainNode(
const FName& Name,
const FString& DisplayName,
const TArray<FVector>& Points,
float Stiffness = 0.5f,
float Thickness = 1.0f);
/**
* Create tetrahedron node
* @param Name - Node name
* @param DisplayName - Display name
* @param Points - Tetrahedron points
* @param Stiffness - Tetrahedron stiffness
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateTetraNode(
const FName& Name,
const FString& DisplayName,
const TArray<FVector>& Points,
float Stiffness = 0.7f);
/**
* Create plane constraint node
* @param Name - Node name
* @param DisplayName - Display name
* @param Location - Plane location
* @param Normal - Plane normal
* @param Stiffness - Plane stiffness
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreatePlaneNode(
const FName& Name,
const FString& DisplayName,
const FVector& Location = FVector::ZeroVector,
const FVector& Normal = FVector::UpVector,
float Stiffness = 1.0f);
/**
* Create time node
* @param Name - Node name
* @param DisplayName - Display name
* @param SubstepTime - Substep time
* @param SolverIterations - Solver iterations
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateTimeNode(
const FName& Name,
const FString& DisplayName,
float SubstepTime = 0.01667f,
float SolverIterations = 1.0f);
/**
* Create group collisions node
* @param Name - Node name
* @param DisplayName - Display name
* @return Created node
*/
static TSharedPtr<FVisceraNodeItem> CreateGroupCollisionsNode(
const FName& Name,
const FString& DisplayName);
};