You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Move UCreateMeshObjectTypeProperties to ModelingComponents and update all include sites - Added Editor Modeling Mode settings to Enable/Disable showing DynamicMeshActor creation options, and select default mesh object type. Removed CVarEnableDynamicMeshActors. - Added optional 'Auto' output mesh type to UCreateMeshObjectTypeProperties. This can be used in Tools that have input objects and want to allow optional conversion, but default to 'just use input mesh object type'. - Added ConvertMeshesTool, this does in-place conversion between Mesh Object types for a set of selected objects (Duplicate tool can also do this, but only for a single object, and functionality is expected to further diverge) - Added SplitMeshesTool, decomposes a mesh into parts and creates a new output object for each part - CombineMeshesTool now supports variable output object type. Cleaned up internals. #rb none #rnx #jira none #preflight 60d3bc76b4bb42000195eccf [CL 16768010 by Ryan Schmidt in ue5-main branch]
117 lines
3.3 KiB
C++
117 lines
3.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "BaseTools/SingleSelectionMeshEditingTool.h"
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
#include "Physics/CollisionPropertySets.h"
|
|
#include "PropertySets/CreateMeshObjectTypeProperties.h"
|
|
#include "ExtractCollisionGeometryTool.generated.h"
|
|
|
|
class UPreviewGeometry;
|
|
class UPreviewMesh;
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API UExtractCollisionGeometryToolBuilder : public USingleSelectionMeshEditingToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
|
|
|
protected:
|
|
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const override;
|
|
};
|
|
|
|
|
|
UENUM()
|
|
enum class EExtractCollisionOutputType : uint8
|
|
{
|
|
/** Simple Collision shapes (Box, Sphere, Capsule, Convex) */
|
|
Simple = 0,
|
|
/** Complex Collision Mesh */
|
|
Complex = 1
|
|
};
|
|
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API UExtractCollisionToolProperties : public UInteractiveToolPropertySet
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
/** Type of collision geometry to convert to Mesh */
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
EExtractCollisionOutputType CollisionType = EExtractCollisionOutputType::Simple;
|
|
|
|
/** Whether or not to weld coincident border edges of the Complex Collision Mesh (if possible) */
|
|
UPROPERTY(EditAnywhere, Category = Options, Meta = (EditCondition = "CollisionType == EExtractCollisionOutputType::Complex"))
|
|
bool bWeldEdges = true;
|
|
|
|
/** Whether or not to generate a seperate Mesh Object for each Simple Collision Shape */
|
|
UPROPERTY(EditAnywhere, Category = Options, Meta = (EditCondition = "CollisionType == EExtractCollisionOutputType::Simple"))
|
|
bool bOutputSeparateMeshes = true;
|
|
|
|
/** Show/Hide a preview of the generated mesh (overlaps source mesh) */
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
bool bShowPreview = false;
|
|
|
|
/** Show/Hide input mesh */
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
bool bShowInputMesh = true;
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
* Mesh Inspector Tool for visualizing mesh information
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API UExtractCollisionGeometryTool : public USingleSelectionMeshEditingTool
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
virtual void Setup() override;
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
virtual void OnTick(float DeltaTime) override;
|
|
|
|
virtual bool HasCancel() const override { return true; }
|
|
virtual bool HasAccept() const override { return true; }
|
|
virtual bool CanAccept() const override;
|
|
|
|
protected:
|
|
|
|
/** Property set for type of output object (StaticMesh, Volume, etc) */
|
|
UPROPERTY()
|
|
UCreateMeshObjectTypeProperties* OutputTypeProperties;
|
|
|
|
UPROPERTY()
|
|
UExtractCollisionToolProperties* Settings;
|
|
|
|
UPROPERTY()
|
|
UCollisionGeometryVisualizationProperties* VizSettings = nullptr;
|
|
|
|
UPROPERTY()
|
|
UPhysicsObjectToolPropertySet* ObjectProps;
|
|
|
|
protected:
|
|
UPROPERTY()
|
|
UPreviewGeometry* PreviewElements;
|
|
|
|
UPROPERTY()
|
|
UPreviewMesh* PreviewMesh;
|
|
|
|
// these are TSharedPtr because TPimplPtr cannot currently be added to a TArray?
|
|
TSharedPtr<FPhysicsDataCollection> PhysicsInfo;
|
|
|
|
TArray<UE::Geometry::FDynamicMesh3> CurrentMeshParts;
|
|
UE::Geometry::FDynamicMesh3 CurrentMesh;
|
|
bool bResultValid = false;
|
|
void RecalculateMesh_Simple();
|
|
void RecalculateMesh_Complex();
|
|
|
|
bool bVisualizationDirty = false;
|
|
void UpdateVisualization();
|
|
};
|