更新 Source/FLESH/Private/BooleanCutTool.cpp

This commit is contained in:
2025-04-21 18:00:35 +08:00
parent e6123f4d16
commit 8b73b03fcb

View File

@@ -60,8 +60,8 @@ TArray<UStaticMesh*> UBooleanCutTool::CutStaticMesh(UStaticMesh* TargetMesh, con
// TODO: Implement GeometryScripting-based cutting
UStaticMesh* PositiveMesh = NewObject<UStaticMesh>(this);
UStaticMesh* NegativeMesh = NewObject<UStaticMesh>(this);
UStaticMesh* PositiveMesh = NewObject<UStaticMesh>(this, TEXT("PositiveStaticMesh"));
UStaticMesh* NegativeMesh = NewObject<UStaticMesh>(this, TEXT("NegativeStaticMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -70,8 +70,8 @@ TArray<UStaticMesh*> UBooleanCutTool::CutStaticMesh(UStaticMesh* TargetMesh, con
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback cutting method"));
// Simple implementation that just duplicates the mesh
UStaticMesh* PositiveMesh = NewObject<UStaticMesh>(this);
UStaticMesh* NegativeMesh = NewObject<UStaticMesh>(this);
UStaticMesh* PositiveMesh = NewObject<UStaticMesh>(this, TEXT("PositiveFallbackMesh"));
UStaticMesh* NegativeMesh = NewObject<UStaticMesh>(this, TEXT("NegativeFallbackMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -125,9 +125,9 @@ FMultiLayerCutResult UBooleanCutTool::CutMultiLayerMesh(USkeletalMesh* OuterMesh
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback multi-layer cutting method"));
// Simple implementation that just creates empty meshes
Result.OuterMesh = NewObject<UStaticMesh>(this);
Result.InnerMesh = NewObject<UStaticMesh>(this);
Result.CapMesh = NewObject<UStaticMesh>(this);
Result.OuterMesh = NewObject<UStaticMesh>(this, TEXT("OuterFallbackMesh"));
Result.InnerMesh = NewObject<UStaticMesh>(this, TEXT("InnerFallbackMesh"));
Result.CapMesh = NewObject<UStaticMesh>(this, TEXT("CapFallbackMesh"));
#endif
return Result;
@@ -148,14 +148,14 @@ UStaticMesh* UBooleanCutTool::CreateTriangleFanCapMesh(const TArray<FVector>& In
// TODO: Implement triangle fan cap mesh with GeometryScripting
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this);
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this, TEXT("TriangleFanCapMesh"));
return CapMesh;
#else
// Fallback implementation without GeometryScripting
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback triangle fan cap mesh method"));
// Create a simple procedural mesh component
UProceduralMeshComponent* ProcMesh = NewObject<UProceduralMeshComponent>();
UProceduralMeshComponent* ProcMesh = NewObject<UProceduralMeshComponent>(this, TEXT("CutPlaneMesh"));
// Calculate center point
FVector Center = FVector::ZeroVector;
@@ -207,7 +207,7 @@ UStaticMesh* UBooleanCutTool::CreateTriangleFanCapMesh(const TArray<FVector>& In
Triangles.Add(1);
// Create a static mesh from the procedural mesh
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this);
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this, TEXT("TriangleFanCapMesh"));
// TODO: Convert procedural mesh to static mesh
// This would normally require GeometryScripting, so we'll just return the empty mesh for now
@@ -233,8 +233,8 @@ TArray<USkeletalMesh*> UBooleanCutTool::CutSkeletalMesh(USkeletalMesh* TargetMes
// TODO: Implement GeometryScripting-based cutting
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this, TEXT("PositiveSkeletalMesh"));
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this, TEXT("NegativeSkeletalMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -243,8 +243,8 @@ TArray<USkeletalMesh*> UBooleanCutTool::CutSkeletalMesh(USkeletalMesh* TargetMes
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback cutting method for skeletal mesh"));
// Simple implementation that just duplicates the mesh
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this, TEXT("PositiveFallbackMesh"));
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this, TEXT("NegativeFallbackMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -270,8 +270,8 @@ TArray<UProceduralMeshComponent*> UBooleanCutTool::CutProceduralMesh(UProcedural
// TODO: Implement GeometryScripting-based cutting
UProceduralMeshComponent* PositiveMesh = NewObject<UProceduralMeshComponent>(this);
UProceduralMeshComponent* NegativeMesh = NewObject<UProceduralMeshComponent>(this);
UProceduralMeshComponent* PositiveMesh = NewObject<UProceduralMeshComponent>(this, TEXT("PositiveProcMesh"));
UProceduralMeshComponent* NegativeMesh = NewObject<UProceduralMeshComponent>(this, TEXT("NegativeProcMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -280,8 +280,8 @@ TArray<UProceduralMeshComponent*> UBooleanCutTool::CutProceduralMesh(UProcedural
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback cutting method for procedural mesh"));
// Simple implementation that just duplicates the mesh
UProceduralMeshComponent* PositiveMesh = NewObject<UProceduralMeshComponent>(this);
UProceduralMeshComponent* NegativeMesh = NewObject<UProceduralMeshComponent>(this);
UProceduralMeshComponent* PositiveMesh = NewObject<UProceduralMeshComponent>(this, TEXT("PositiveFallbackMesh"));
UProceduralMeshComponent* NegativeMesh = NewObject<UProceduralMeshComponent>(this, TEXT("NegativeFallbackMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -313,8 +313,8 @@ TArray<USkeletalMesh*> UBooleanCutTool::CutWithBoneAxis(USkeletalMesh* TargetMes
// TODO: Implement GeometryScripting-based bone-guided cutting
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this, TEXT("PositiveSkeletalMesh"));
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this, TEXT("NegativeSkeletalMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -323,8 +323,8 @@ TArray<USkeletalMesh*> UBooleanCutTool::CutWithBoneAxis(USkeletalMesh* TargetMes
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback bone-guided cutting method"));
// Simple implementation that just duplicates the mesh
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this);
USkeletalMesh* PositiveMesh = NewObject<USkeletalMesh>(this, TEXT("PositiveFallbackMesh"));
USkeletalMesh* NegativeMesh = NewObject<USkeletalMesh>(this, TEXT("NegativeFallbackMesh"));
Result.Add(PositiveMesh);
Result.Add(NegativeMesh);
@@ -348,14 +348,14 @@ UStaticMesh* UBooleanCutTool::CreateTessellatedCapMesh(const TArray<FVector>& In
// TODO: Implement tessellated cap mesh with GeometryScripting
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this);
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this, TEXT("TessellatedCapMesh"));
return CapMesh;
#else
// Fallback implementation without GeometryScripting
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback tessellated cap mesh method"));
// Simple implementation that creates a basic cap mesh
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this);
UStaticMesh* CapMesh = NewObject<UStaticMesh>(this, TEXT("TessellatedCapMesh"));
// TODO: Implement basic tessellation without GeometryScripting
@@ -372,14 +372,14 @@ UStaticMesh* UBooleanCutTool::CreateCutPlaneMesh(const FCutPlane& CutPlane)
// TODO: Implement cut plane mesh with GeometryScripting
UStaticMesh* PlaneMesh = NewObject<UStaticMesh>(this);
UStaticMesh* PlaneMesh = NewObject<UStaticMesh>(this, TEXT("CutPlaneMesh"));
return PlaneMesh;
#else
// Fallback implementation without GeometryScripting
UE_LOG(LogTemp, Log, TEXT("FLESH: BooleanCutTool - Using fallback cut plane mesh method"));
// Simple implementation that creates a basic plane mesh
UStaticMesh* PlaneMesh = NewObject<UStaticMesh>(this);
UStaticMesh* PlaneMesh = NewObject<UStaticMesh>(this, TEXT("CutPlaneMesh"));
// TODO: Implement basic plane mesh without GeometryScripting