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]
147 lines
4.6 KiB
C++
147 lines
4.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
#include "BaseBehaviors/BehaviorTargetInterfaces.h"
|
|
#include "ModelingOperators.h" //IDynamicMeshOperatorFactory
|
|
#include "InteractiveTool.h" //UInteractiveToolPropertySet
|
|
#include "InteractiveToolBuilder.h" //UInteractiveToolBuilder
|
|
#include "InteractiveToolChange.h" //FToolCommandChange
|
|
#include "MeshOpPreviewHelpers.h" //FDynamicMeshOpResult
|
|
#include "Properties/MeshMaterialProperties.h"
|
|
#include "PropertySets/CreateMeshObjectTypeProperties.h"
|
|
#include "Properties/RevolveProperties.h"
|
|
|
|
#include "DrawAndRevolveTool.generated.h"
|
|
|
|
class UCollectSurfacePathMechanic;
|
|
class UConstructionPlaneMechanic;
|
|
class UCurveControlPointsMechanic;
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API UDrawAndRevolveToolBuilder : public UInteractiveToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
|
|
virtual UInteractiveTool* BuildTool(const FToolBuilderState& SceneState) const override;
|
|
};
|
|
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API URevolveToolProperties : public URevolveProperties
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
/** Connect the ends of an open profile to the axis to close the top and bottom of the revolved result. Not relevant if profile curve is closed. */
|
|
UPROPERTY(EditAnywhere, Category = RevolveSettings, AdvancedDisplay)
|
|
bool bConnectOpenProfileToAxis = true;
|
|
|
|
/** Determines whether plane control widget snaps to world grid (only relevant if world coordinate mode is active in viewport) .*/
|
|
UPROPERTY(EditAnywhere, Category = DrawPlane)
|
|
bool bSnapToWorldGrid = false;
|
|
|
|
/** Sets the draw plane origin. The revolution axis is the X axis in the plane. */
|
|
UPROPERTY(EditAnywhere, Category = DrawPlane, meta = (
|
|
EditCondition = "bAllowedToEditDrawPlane", HideEditConditionToggle))
|
|
FVector DrawPlaneOrigin = FVector(0, 0, 0);
|
|
|
|
/** Sets the draw plane orientation. The revolution axis is the X axis in the plane. */
|
|
UPROPERTY(EditAnywhere, Category = DrawPlane, meta = (
|
|
EditCondition = "bAllowedToEditDrawPlane", HideEditConditionToggle,
|
|
UIMin = -180, UIMax = 180, ClampMin = -180000, ClampMax = 18000))
|
|
FRotator DrawPlaneOrientation = FRotator(90, 0, 0);
|
|
|
|
/** Enables/disables snapping while editing the profile curve. Also toggled with Shift. */
|
|
UPROPERTY(EditAnywhere, Category = ProfileCurve)
|
|
bool bEnableSnapping = true;
|
|
|
|
// Not user visible- used to disallow draw plane modification.
|
|
UPROPERTY(meta = (TransientToolProperty))
|
|
bool bAllowedToEditDrawPlane = true;
|
|
};
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API URevolveOperatorFactory : public UObject, public UE::Geometry::IDynamicMeshOperatorFactory
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// IDynamicMeshOperatorFactory API
|
|
virtual TUniquePtr<UE::Geometry::FDynamicMeshOperator> MakeNewOperator() override;
|
|
|
|
UPROPERTY()
|
|
UDrawAndRevolveTool* RevolveTool;
|
|
};
|
|
|
|
|
|
/** Draws a profile curve and revolves it around an axis. */
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API UDrawAndRevolveTool : public UInteractiveTool
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual void SetWorld(UWorld* World) { TargetWorld = World; }
|
|
|
|
virtual void RegisterActions(FInteractiveToolActionSet& ActionSet) override;
|
|
virtual void OnPointDeletionKeyPress();
|
|
|
|
virtual bool HasCancel() const override { return true; }
|
|
virtual bool HasAccept() const override { return true; }
|
|
virtual bool CanAccept() const override;
|
|
|
|
virtual void Setup() override;
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
virtual void OnTick(float DeltaTime) override;
|
|
virtual void Render(IToolsContextRenderAPI* RenderAPI) override;
|
|
|
|
virtual void OnPropertyModified(UObject* PropertySet, FProperty* Property) override;
|
|
|
|
protected:
|
|
|
|
UWorld* TargetWorld;
|
|
|
|
FViewCameraState CameraState;
|
|
|
|
// This information is replicated in the user-editable transform in the settings and in the PlaneMechanic
|
|
// plane, but the tool turned out to be much easier to write and edit with this decoupling.
|
|
FVector3d RevolutionAxisOrigin;
|
|
FVector3d RevolutionAxisDirection;
|
|
|
|
bool bProfileCurveComplete = false;
|
|
|
|
void UpdateRevolutionAxis();
|
|
|
|
UPROPERTY()
|
|
UCurveControlPointsMechanic* ControlPointsMechanic = nullptr;
|
|
|
|
UPROPERTY()
|
|
UConstructionPlaneMechanic* PlaneMechanic = nullptr;
|
|
|
|
/** Property set for type of output object (StaticMesh, Volume, etc) */
|
|
UPROPERTY()
|
|
UCreateMeshObjectTypeProperties* OutputTypeProperties;
|
|
|
|
UPROPERTY()
|
|
URevolveToolProperties* Settings = nullptr;
|
|
|
|
UPROPERTY()
|
|
UNewMeshMaterialProperties* MaterialProperties;
|
|
|
|
UPROPERTY()
|
|
UMeshOpPreviewWithBackgroundCompute* Preview = nullptr;
|
|
|
|
void StartPreview();
|
|
|
|
void GenerateAsset(const FDynamicMeshOpResult& Result);
|
|
|
|
friend class URevolveOperatorFactory;
|
|
};
|