#include "VisceraNodeFactory.h" TSharedPtr FVisceraNodeFactory::CreateSoftBodyNode(const FName& Name, const FString& DisplayName) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("SoftBody"))); // Set default properties Node->BoolProperties.Add(TEXT("EnableSimulation"), true); Node->FloatProperties.Add(TEXT("GravityStrength"), 1.0f); Node->FloatProperties.Add(TEXT("MinFrameSpeed"), 0.0f); Node->FloatProperties.Add(TEXT("MaxFrameSpeed"), 200.0f); Node->FloatProperties.Add(TEXT("ExternalFrameLerp"), 1.0f); Node->FloatProperties.Add(TEXT("InitialGPUInfluence"), 0.5f); Node->FloatProperties.Add(TEXT("SubstepTime"), 0.01667f); Node->FloatProperties.Add(TEXT("SolverIterations"), 1.0f); Node->BoolProperties.Add(TEXT("RecomputeNormals"), true); Node->BoolProperties.Add(TEXT("EnableMultiLayerCutting"), true); Node->FloatProperties.Add(TEXT("CapMethod"), (float)ECapMeshMethod::TriangleFan); return Node; } TSharedPtr FVisceraNodeFactory::CreateAnchorNode( const FName& Name, const FString& DisplayName, const FVector& Location, float Radius, float Stiffness, FName BoneName) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("Anchor"))); // Set properties Node->VectorProperties.Add(TEXT("Location"), Location); Node->FloatProperties.Add(TEXT("Radius"), Radius); Node->FloatProperties.Add(TEXT("Stiffness"), Stiffness); Node->NameProperties.Add(TEXT("BoneName"), BoneName); return Node; } TSharedPtr FVisceraNodeFactory::CreateLineChainNode( const FName& Name, const FString& DisplayName, const TArray& Points, float Stiffness, float Thickness) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("LineChain"))); // Set properties Node->FloatProperties.Add(TEXT("Stiffness"), Stiffness); Node->FloatProperties.Add(TEXT("Thickness"), Thickness); // Add points if (Points.Num() > 0) { Node->PointsArray = Points; } else { // Default add two points Node->PointsArray.Add(FVector(-10.0f, 0.0f, 0.0f)); Node->PointsArray.Add(FVector(10.0f, 0.0f, 0.0f)); } return Node; } TSharedPtr FVisceraNodeFactory::CreateTetraNode( const FName& Name, const FString& DisplayName, const TArray& Points, float Stiffness) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("Tetra"))); // Set properties Node->FloatProperties.Add(TEXT("Stiffness"), Stiffness); // Add points if (Points.Num() >= 4) { Node->PointsArray = Points; } else { // Default add four points to form a tetrahedron Node->PointsArray.Add(FVector(0.0f, 0.0f, 0.0f)); Node->PointsArray.Add(FVector(10.0f, 0.0f, 0.0f)); Node->PointsArray.Add(FVector(0.0f, 10.0f, 0.0f)); Node->PointsArray.Add(FVector(0.0f, 0.0f, 10.0f)); } return Node; } TSharedPtr FVisceraNodeFactory::CreatePlaneNode( const FName& Name, const FString& DisplayName, const FVector& Location, const FVector& Normal, float Stiffness) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("Plane"))); // Set properties Node->VectorProperties.Add(TEXT("Location"), Location); Node->VectorProperties.Add(TEXT("Normal"), Normal); Node->FloatProperties.Add(TEXT("Stiffness"), Stiffness); return Node; } TSharedPtr FVisceraNodeFactory::CreateTimeNode( const FName& Name, const FString& DisplayName, float SubstepTime, float SolverIterations) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("Time"))); // Set properties Node->FloatProperties.Add(TEXT("SubstepTime"), SubstepTime); Node->FloatProperties.Add(TEXT("SolverIterations"), SolverIterations); return Node; } TSharedPtr FVisceraNodeFactory::CreateGroupCollisionsNode( const FName& Name, const FString& DisplayName) { TSharedPtr Node = MakeShareable(new FVisceraNodeItem(Name, DisplayName, TEXT("GroupCollisions"))); // Default properties can be added here return Node; }