Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Public/ToolActivities/PolyEditActivityContext.h
matija kecman d76f894c26 MeshModelingToolset: Fix polygroup edge rendering after undoing a Straighten edge edit in the PolyEd tool
#rb semion.piskarev
#rnx
#jira UE-125122
#preflight 61dc3fe6932a02483cf5cf4e

#ROBOMERGE-AUTHOR: matija.kecman
#ROBOMERGE-SOURCE: CL 18570405 in //UE5/Release-5.0/... via CL 18570415
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18570420 by matija kecman in ue5-release-engine-test branch]
2022-01-11 06:48:50 -05:00

87 lines
3.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DynamicMesh/DynamicMeshAABBTree3.h"
#include "GeometryBase.h"
#include "PolyEditActivityContext.generated.h"
PREDECLARE_GEOMETRY(class FDynamicMesh3);
PREDECLARE_GEOMETRY(class FDynamicMeshChange);
PREDECLARE_GEOMETRY(struct FGroupTopologySelection);
PREDECLARE_GEOMETRY(class FGroupTopology);
class FToolCommandChange;
class UPolyEditCommonProperties;
class UPolygonSelectionMechanic;
class UMeshOpPreviewWithBackgroundCompute;
UCLASS()
class MESHMODELINGTOOLS_API UPolyEditActivityContext : public UObject
{
GENERATED_BODY()
public:
UPROPERTY()
TObjectPtr<UPolyEditCommonProperties> CommonProperties;
/**
* The CurrentMesh is the authoritative current version of the mesh, which would be baked back
* to the asset on accept.
*/
TSharedPtr<UE::Geometry::FDynamicMesh3, ESPMode::ThreadSafe> CurrentMesh;
/**
* The mesh stored in the preview is not authoritative. It may be altered in various ways as the
* user previews potential changes, and may be reset back to CurrentMesh if an activity
* is cancelled.
*/
UPROPERTY()
TObjectPtr<UMeshOpPreviewWithBackgroundCompute> Preview;
/**
* The activity should update CurrentTopology and MeshSpatial if it alters CurrentMesh.
*/
TSharedPtr<UE::Geometry::FGroupTopology, ESPMode::ThreadSafe> CurrentTopology;
TSharedPtr<UE::Geometry::FDynamicMeshAABBTree3, ESPMode::ThreadSafe> MeshSpatial;
bool bTriangleMode = false;
/**
* The activity may use the selection mechanic to get (or alter) the current selection, though
* if selection is just being changed at the end of the activity, it should probably be done
* through EmitCurrentMeshChangeAndUpdate so that it is lumped with the same undo transaction.
*/
UPROPERTY()
TObjectPtr<UPolygonSelectionMechanic> SelectionMechanic;
/**
* Given a change to CurrentMesh (already applied and stored in MeshChangeIn), use this
* function to properly emit it from the host. Be aware that the host will update any
* related data structures at this time (spatial, preview, etc) so that state is consistent
* with undo/redo.
*/
TUniqueFunction<void (const FText& TransactionLabel,
TUniquePtr<UE::Geometry::FDynamicMeshChange> MeshChangeIn,
const UE::Geometry::FGroupTopologySelection& OutputSelection)>
EmitCurrentMeshChangeAndUpdate;
/**
* If an activity starts running, it should use this function to have the host emit an
* appropriate undoable transaction with the given transaction label.
*/
TUniqueFunction<void(const FText& TransactionLabel)> EmitActivityStart;
/**
* Gets broadcast when the CurrentMesh is modified by an undo/redo transaction emitted via
* EmitCurrentMeshChangeAndUpdate. Only activities that issue multiple transactions via
* EmitCurrentMeshChangeAndUpdate during the same invocation need to use this, since a
* transaction that ends immediately after the call will not have to deal with the undo.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnUndoRedo, bool bGroupTopologyChanged);
FOnUndoRedo OnUndoRedo;
};