2019-12-27 09:26:59 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-10-01 20:41:42 -04:00
# include "UVProjectionTool.h"
# include "InteractiveToolManager.h"
2021-03-11 11:40:03 -04:00
# include "ToolTargetManager.h"
2021-12-09 14:46:09 -05:00
# include "SceneQueries/SceneSnappingManager.h"
2021-05-31 22:15:32 -04:00
# include "ToolBuilderUtil.h"
# include "ToolSetupUtil.h"
# include "BaseBehaviors/SingleClickBehavior.h"
# include "BaseGizmos/TransformGizmoUtil.h"
# include "ModelingToolTargetUtil.h"
# include "Selection/StoredMeshSelectionUtil.h"
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
# include "Selections/GeometrySelectionUtil.h"
2021-05-31 22:15:32 -04:00
# include "DynamicMesh/DynamicMesh3.h"
# include "DynamicMesh/DynamicMeshAABBTree3.h"
# include "DynamicMesh/MeshIndexUtil.h"
# include "MeshRegionBoundaryLoops.h"
# include "Parameterization/DynamicMeshUVEditor.h"
# include "Operations/MeshConvexHull.h"
# include "MinVolumeBox3.h"
2022-12-15 18:17:12 -05:00
# include "ToolTargetManager.h"
2023-06-22 09:28:20 -04:00
# include "PropertySets/GeometrySelectionVisualizationProperties.h"
# include "Selection/GeometrySelectionVisualization.h"
2022-12-15 18:17:12 -05:00
2021-03-11 11:40:03 -04:00
2022-09-28 01:06:15 -04:00
# include UE_INLINE_GENERATED_CPP_BY_NAME(UVProjectionTool)
2021-03-09 19:33:56 -04:00
using namespace UE : : Geometry ;
2019-10-01 20:41:42 -04:00
# define LOCTEXT_NAMESPACE "UUVProjectionTool"
/*
* ToolBuilder
*/
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
USingleTargetWithSelectionTool * UUVProjectionToolBuilder : : CreateNewTool ( const FToolBuilderState & SceneState ) const
2021-03-11 11:40:03 -04:00
{
2021-05-31 22:15:32 -04:00
return NewObject < UUVProjectionTool > ( SceneState . ToolManager ) ;
2021-03-11 11:40:03 -04:00
}
2022-12-15 18:17:12 -05:00
bool UUVProjectionToolBuilder : : CanBuildTool ( const FToolBuilderState & SceneState ) const
{
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
return USingleTargetWithSelectionToolBuilder : : CanBuildTool ( SceneState ) & &
2022-12-15 18:17:12 -05:00
SceneState . TargetManager - > CountSelectedAndTargetableWithPredicate ( SceneState , GetTargetRequirements ( ) ,
[ ] ( UActorComponent & Component ) { return ToolBuilderUtil : : ComponentTypeCouldHaveUVs ( Component ) ; } ) > 0 ;
}
2021-05-31 22:15:32 -04:00
/*
* Propert Sets
*/
void UUVProjectionToolEditActions : : PostAction ( EUVProjectionToolActions Action )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
if ( ParentTool . IsValid ( ) )
{
ParentTool - > RequestAction ( Action ) ;
}
2019-10-01 20:41:42 -04:00
}
/*
* Tool
*/
void UUVProjectionTool : : Setup ( )
{
UInteractiveTool : : Setup ( ) ;
2021-05-31 22:15:32 -04:00
UE : : ToolTarget : : HideSourceObject ( Target ) ;
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
BasicProperties = NewObject < UUVProjectionToolProperties > ( this ) ;
2020-01-27 20:11:15 -05:00
BasicProperties - > RestoreProperties ( this ) ;
2021-05-31 22:15:32 -04:00
BasicProperties - > GetOnModified ( ) . AddLambda ( [ this ] ( UObject * , FProperty * ) { Preview - > InvalidateResult ( ) ; } ) ;
2020-01-27 20:11:15 -05:00
2021-05-31 22:15:32 -04:00
// initialize input mesh
InitializeMesh ( ) ;
2019-10-01 20:41:42 -04:00
// initialize the PreviewMesh+BackgroundCompute object
UpdateNumPreviews ( ) ;
2021-05-31 22:15:32 -04:00
UVChannelProperties = NewObject < UMeshUVChannelProperties > ( this ) ;
UVChannelProperties - > RestoreProperties ( this ) ;
UVChannelProperties - > Initialize ( InputMesh . Get ( ) , false ) ;
UVChannelProperties - > ValidateSelection ( true ) ;
UVChannelProperties - > WatchProperty ( UVChannelProperties - > UVChannel , [ this ] ( const FString & NewValue )
{
2021-11-18 20:41:17 -05:00
MaterialSettings - > UpdateUVChannels ( UVChannelProperties - > UVChannelNamesList . IndexOfByKey ( UVChannelProperties - > UVChannel ) ,
UVChannelProperties - > UVChannelNamesList ) ;
2021-05-31 22:15:32 -04:00
Preview - > InvalidateResult ( ) ;
OnMaterialSettingsChanged ( ) ;
} ) ;
MaterialSettings = NewObject < UExistingMeshMaterialProperties > ( this ) ;
MaterialSettings - > RestoreProperties ( this ) ;
MaterialSettings - > GetOnModified ( ) . AddLambda ( [ this ] ( UObject * , FProperty * )
{
OnMaterialSettingsChanged ( ) ;
} ) ;
EditActions = NewObject < UUVProjectionToolEditActions > ( this ) ;
EditActions - > Initialize ( this ) ;
AddToolPropertySource ( UVChannelProperties ) ;
AddToolPropertySource ( BasicProperties ) ;
AddToolPropertySource ( EditActions ) ;
AddToolPropertySource ( MaterialSettings ) ;
OnMaterialSettingsChanged ( ) ;
2019-10-01 20:41:42 -04:00
// set up visualizers
ProjectionShapeVisualizer . LineColor = FLinearColor : : Red ;
ProjectionShapeVisualizer . LineThickness = 2.0 ;
2021-05-31 22:15:32 -04:00
// initialize Gizmo
2022-01-29 14:37:53 -05:00
FTransform3d GizmoPositionWorld ( WorldBounds . Center ( ) ) ;
2021-05-31 22:15:32 -04:00
TransformProxy = NewObject < UTransformProxy > ( this ) ;
TransformProxy - > SetTransform ( ( FTransform ) GizmoPositionWorld ) ;
TransformProxy - > OnTransformChanged . AddUObject ( this , & UUVProjectionTool : : TransformChanged ) ;
TransformGizmo = UE : : TransformGizmoUtil : : CreateCustomTransformGizmo (
GetToolManager ( ) , ETransformGizmoSubElements : : StandardTranslateRotate , this ) ;
TransformGizmo - > SetActiveTarget ( TransformProxy , GetToolManager ( ) ) ;
InitialDimensions = BasicProperties - > Dimensions ;
2022-11-16 11:37:21 -05:00
bInitialProportionalDimensions = BasicProperties - > bProportionalDimensions ;
2021-05-31 22:15:32 -04:00
InitialTransform = TransformGizmo - > GetGizmoTransform ( ) ;
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
ApplyInitializationMode ( ) ;
2022-11-16 11:37:21 -05:00
// Some lambdas for proportional dimension changes
auto OnProportionalDimensionsChanged = [ this ] ( bool bNewValue )
{
if ( bNewValue ) { CachedDimensions = BasicProperties - > Dimensions ; }
bTransformModified = true ;
} ;
auto ApplyProportionalDimensions = [ this ] ( FVector & NewVector , FVector & CachedVector )
{
// Determines which component of the vector is being changed by looking at which component is
// most different from the previous values
const FVector Difference = NewVector - CachedVector ;
const int32 DifferenceMaxElementIndex = MaxAbsElementIndex ( Difference ) ;
// Readability aliases
const double & NewComponent = NewVector [ DifferenceMaxElementIndex ] ;
const double & ChangedComponent = CachedVector [ DifferenceMaxElementIndex ] ;
// If the component we are changing is 0 (or very close to it), then just set all components to new component,
// effectively setting the vector's direction to (1, 1, 1) and scaling according to the new value
const double ScaleFactor = NewComponent / ChangedComponent ;
NewVector = FMath : : Abs ( ChangedComponent ) < UE_KINDA_SMALL_NUMBER ? FVector ( NewComponent ) : CachedVector * ScaleFactor ;
CachedVector = NewVector ;
} ;
2021-05-31 22:15:32 -04:00
// start watching for dimensions changes
2022-11-16 11:37:21 -05:00
DimensionsWatcher = BasicProperties - > WatchProperty ( BasicProperties - > Dimensions , [ this , & ApplyProportionalDimensions ] ( FVector )
{
if ( BasicProperties - > bProportionalDimensions )
{
ApplyProportionalDimensions ( BasicProperties - > Dimensions , CachedDimensions ) ;
BasicProperties - > SilentUpdateWatcherAtIndex ( DimensionsWatcher ) ;
}
bTransformModified = true ;
} ) ;
DimensionsModeWatcher = BasicProperties - > WatchProperty ( BasicProperties - > bProportionalDimensions , OnProportionalDimensionsChanged ) ;
2021-05-31 22:15:32 -04:00
BasicProperties - > WatchProperty ( BasicProperties - > Initialization , [ this ] ( EUVProjectionToolInitializationMode NewMode ) { OnInitializationModeChanged ( ) ; } ) ;
BasicProperties - > SilentUpdateWatched ( ) ;
2022-11-16 11:37:21 -05:00
OnProportionalDimensionsChanged ( true ) ; // Initialize CachedDimensions
2023-02-04 00:32:56 -05:00
// Allow the user to change the Initialization mode and have it affect the current run of the tool, as long as they do it before modifying the transform
bTransformModified = false ;
2021-05-31 22:15:32 -04:00
// click to set plane behavior
SetPlaneCtrlClickBehaviorTarget = MakeUnique < FSelectClickedAction > ( ) ;
2021-12-09 14:46:09 -05:00
SetPlaneCtrlClickBehaviorTarget - > SnapManager = USceneSnappingManager : : Find ( GetToolManager ( ) ) ;
2021-05-31 22:15:32 -04:00
SetPlaneCtrlClickBehaviorTarget - > OnClickedPositionFunc = [ this ] ( const FHitResult & Hit )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
UpdatePlaneFromClick ( FVector3d ( Hit . ImpactPoint ) , FVector3d ( Hit . ImpactNormal ) , SetPlaneCtrlClickBehaviorTarget - > bShiftModifierToggle ) ;
} ;
SetPlaneCtrlClickBehaviorTarget - > InvisibleComponentsToHitTest . Add ( UE : : ToolTarget : : GetTargetComponent ( Target ) ) ;
ClickToSetPlaneBehavior = NewObject < USingleClickInputBehavior > ( ) ;
ClickToSetPlaneBehavior - > ModifierCheckFunc = FInputDeviceState : : IsCtrlKeyDown ;
ClickToSetPlaneBehavior - > Modifiers . RegisterModifier ( FSelectClickedAction : : ShiftModifier , FInputDeviceState : : IsShiftKeyDown ) ;
ClickToSetPlaneBehavior - > Initialize ( SetPlaneCtrlClickBehaviorTarget . Get ( ) ) ;
AddInputBehavior ( ClickToSetPlaneBehavior ) ;
2023-06-22 09:28:20 -04:00
if ( HasGeometrySelection ( ) )
{
GeometrySelectionVizProperties = NewObject < UGeometrySelectionVisualizationProperties > ( this ) ;
GeometrySelectionVizProperties - > RestoreProperties ( this ) ;
AddToolPropertySource ( GeometrySelectionVizProperties ) ;
GeometrySelectionVizProperties - > Initialize ( this ) ;
GeometrySelectionVizProperties - > bEnableShowTriangleROIBorder = true ;
GeometrySelectionVizProperties - > SelectionElementType = static_cast < EGeometrySelectionElementType > ( GeometrySelection . ElementType ) ;
GeometrySelectionVizProperties - > SelectionTopologyType = static_cast < EGeometrySelectionTopologyType > ( GeometrySelection . TopologyType ) ;
GeometrySelectionViz = NewObject < UPreviewGeometry > ( this ) ;
GeometrySelectionViz - > CreateInWorld ( GetTargetWorld ( ) , WorldTransform ) ;
UE : : Geometry : : InitializeGeometrySelectionVisualization (
GeometrySelectionViz ,
GeometrySelectionVizProperties ,
* InputMesh ,
GeometrySelection ,
nullptr ,
nullptr ,
TriangleROI . Get ( ) ) ;
}
2021-05-31 22:15:32 -04:00
// probably already done
Preview - > InvalidateResult ( ) ;
2020-09-24 00:43:27 -04:00
2021-02-08 17:02:09 -04:00
SetToolDisplayName ( LOCTEXT ( " ToolName " , " UV Projection " ) ) ;
2020-09-24 00:43:27 -04:00
GetToolManager ( ) - > DisplayMessage (
2022-09-26 15:18:48 -04:00
LOCTEXT ( " UVProjectionToolDescription " , " Generate UVs for a Mesh by projecting onto simple geometric shapes. Ctrl+click to reposition shape. Shift+Ctrl+click to reposition shape without reorienting. Face selections can be made in the PolyEdit and TriEdit Tools. " ) ,
2020-09-24 00:43:27 -04:00
EToolMessageLevel : : UserNotification ) ;
2019-10-01 20:41:42 -04:00
}
void UUVProjectionTool : : UpdateNumPreviews ( )
{
2021-05-31 22:15:32 -04:00
OperatorFactory = NewObject < UUVProjectionOperatorFactory > ( ) ;
OperatorFactory - > Tool = this ;
Preview = NewObject < UMeshOpPreviewWithBackgroundCompute > ( OperatorFactory ) ;
2022-01-28 10:18:10 -05:00
Preview - > Setup ( GetTargetWorld ( ) , OperatorFactory ) ;
2021-10-07 22:25:54 -04:00
ToolSetupUtil : : ApplyRenderingConfigurationToPreview ( Preview - > PreviewMesh , Target ) ;
2021-05-31 22:15:32 -04:00
Preview - > OnMeshUpdated . AddUObject ( this , & UUVProjectionTool : : OnMeshUpdated ) ;
2021-06-11 22:42:32 -04:00
Preview - > PreviewMesh - > SetTangentsMode ( EDynamicMeshComponentTangentsMode : : AutoCalculated ) ;
2021-05-31 22:15:32 -04:00
FComponentMaterialSet MaterialSet = UE : : ToolTarget : : GetMaterialSet ( Target , false ) ;
Preview - > ConfigureMaterials ( MaterialSet . Materials ,
ToolSetupUtil : : GetDefaultWorkingMaterial ( GetToolManager ( ) )
) ;
Preview - > PreviewMesh - > UpdatePreview ( InputMesh . Get ( ) ) ;
Preview - > PreviewMesh - > SetTransform ( ( FTransform ) WorldTransform ) ;
Preview - > SetVisibility ( true ) ;
EdgeRenderer = NewObject < UPreviewGeometry > ( this ) ;
2022-01-28 10:18:10 -05:00
EdgeRenderer - > CreateInWorld ( GetTargetWorld ( ) , ( FTransform ) WorldTransform ) ;
2019-10-01 20:41:42 -04:00
}
2022-01-28 18:40:54 -05:00
void UUVProjectionTool : : OnShutdown ( EToolShutdownType ShutdownType )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
UVChannelProperties - > SaveProperties ( this ) ;
BasicProperties - > SavedDimensions = BasicProperties - > Dimensions ;
2022-11-16 11:37:21 -05:00
BasicProperties - > bSavedProportionalDimensions = BasicProperties - > bProportionalDimensions ;
2021-05-31 22:15:32 -04:00
BasicProperties - > SavedTransform = TransformGizmo - > GetGizmoTransform ( ) ;
2020-01-27 20:11:15 -05:00
BasicProperties - > SaveProperties ( this ) ;
MaterialSettings - > SaveProperties ( this ) ;
2021-05-31 22:15:32 -04:00
EdgeRenderer - > Disconnect ( ) ;
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
// Restore (unhide) the source meshes
UE : : ToolTarget : : ShowSourceObject ( Target ) ;
FDynamicMeshOpResult Result = Preview - > Shutdown ( ) ;
2019-10-01 20:41:42 -04:00
if ( ShutdownType = = EToolShutdownType : : Accept )
{
2021-05-31 22:15:32 -04:00
GetToolManager ( ) - > BeginUndoTransaction ( LOCTEXT ( " UVProjectionToolTransactionName " , " Project UVs " ) ) ;
FDynamicMesh3 * NewDynamicMesh = Result . Mesh . Get ( ) ;
if ( ensure ( NewDynamicMesh ) )
{
UE : : ToolTarget : : CommitDynamicMeshUVUpdate ( Target , NewDynamicMesh ) ;
}
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
if ( HasGeometrySelection ( ) )
{
UE : : Geometry : : SetToolOutputGeometrySelectionForTarget ( this , Target , GetGeometrySelection ( ) ) ;
}
2021-05-31 22:15:32 -04:00
GetToolManager ( ) - > EndUndoTransaction ( ) ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
GetToolManager ( ) - > GetPairedGizmoManager ( ) - > DestroyAllGizmosByOwner ( this ) ;
TransformGizmo = nullptr ;
TransformProxy = nullptr ;
2023-06-22 09:28:20 -04:00
Super : : OnShutdown ( ShutdownType ) ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : RequestAction ( EUVProjectionToolActions ActionType )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
if ( bHavePendingAction )
{
return ;
}
PendingAction = ActionType ;
bHavePendingAction = true ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
2019-10-04 14:13:21 -04:00
TUniquePtr < FDynamicMeshOperator > UUVProjectionOperatorFactory : : MakeNewOperator ( )
2019-10-01 20:41:42 -04:00
{
2019-10-04 14:13:21 -04:00
TUniquePtr < FUVProjectionOp > Op = MakeUnique < FUVProjectionOp > ( ) ;
2021-05-31 22:15:32 -04:00
Op - > ProjectionMethod = Tool - > BasicProperties - > ProjectionType ;
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
Op - > MeshToProjectionSpace = Tool - > WorldTransform ;
Op - > ProjectionBox = Tool - > GetProjectionBox ( ) ;
2021-12-02 15:04:36 -05:00
Op - > CylinderSplitAngle = Tool - > BasicProperties - > CylinderSplitAngle ;
Op - > BlendWeight = Tool - > BasicProperties - > ExpMapNormalBlending ;
Op - > SmoothingRounds = Tool - > BasicProperties - > ExpMapSmoothingSteps ;
Op - > SmoothingAlpha = Tool - > BasicProperties - > ExpMapSmoothingAlpha ;
2021-05-31 22:15:32 -04:00
2021-12-02 15:04:36 -05:00
Op - > UVRotationAngleDeg = Tool - > BasicProperties - > Rotation ;
Op - > UVScale = ( FVector2f ) Tool - > BasicProperties - > Scale ;
Op - > UVTranslate = ( FVector2f ) Tool - > BasicProperties - > Translation ;
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
Op - > OriginalMesh = Tool - > InputMesh ;
Op - > TriangleROI = Tool - > TriangleROI ;
Op - > UseUVLayer = Tool - > UVChannelProperties - > GetSelectedChannelIndex ( true ) ;
Op - > SetResultTransform ( Tool - > WorldTransform ) ;
2019-10-01 20:41:42 -04:00
return Op ;
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : InitializeMesh ( )
{
InputMesh = MakeShared < FDynamicMesh3 , ESPMode : : ThreadSafe > ( ) ;
* InputMesh = UE : : ToolTarget : : GetDynamicMeshCopy ( Target ) ;
WorldTransform = UE : : ToolTarget : : GetLocalToWorldTransform ( Target ) ;
// initialize triangle ROI if one exists
TriangleROI = MakeShared < TArray < int32 > , ESPMode : : ThreadSafe > ( ) ;
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
if ( HasGeometrySelection ( ) )
2021-05-31 22:15:32 -04:00
{
ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.
ExtrudeMeshSelectionTool now emits output selection.
Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.
port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI
deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.
Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.
#rb none
#preflight 63c84fa2b065224750b9831f
[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00
const FGeometrySelection & InputSelection = GetGeometrySelection ( ) ;
UE : : Geometry : : EnumerateSelectionTriangles ( InputSelection , * InputMesh ,
[ & ] ( int32 TriangleID ) { TriangleROI - > Add ( TriangleID ) ; } ) ;
2021-05-31 22:15:32 -04:00
TriangleROISet . Append ( * TriangleROI ) ;
}
VertexROI = MakeShared < TArray < int32 > , ESPMode : : ThreadSafe > ( ) ;
UE : : Geometry : : TriangleToVertexIDs ( InputMesh . Get ( ) , * TriangleROI , * VertexROI ) ;
InputMeshROISpatial = MakeShared < FDynamicMeshAABBTree3 , ESPMode : : ThreadSafe > ( InputMesh . Get ( ) , false ) ;
if ( TriangleROI - > Num ( ) > 0 )
{
InputMeshROISpatial - > Build ( * TriangleROI ) ;
}
else
{
InputMeshROISpatial - > Build ( ) ;
}
WorldBounds = ( VertexROI - > Num ( ) > 0 ) ?
FAxisAlignedBox3d : : MakeBoundsFromIndices ( * VertexROI , [ this ] ( int32 Index ) { return WorldTransform . TransformPosition ( InputMesh - > GetVertex ( Index ) ) ; } )
: FAxisAlignedBox3d : : MakeBoundsFromIndices ( InputMesh - > VertexIndicesItr ( ) , [ this ] ( int32 Index ) { return WorldTransform . TransformPosition ( InputMesh - > GetVertex ( Index ) ) ; } ) ;
BasicProperties - > Dimensions = ( FVector ) WorldBounds . Diagonal ( ) ;
}
2021-12-02 15:04:36 -05:00
FOrientedBox3d UUVProjectionTool : : GetProjectionBox ( ) const
2021-05-31 22:15:32 -04:00
{
2021-12-02 15:04:36 -05:00
const FFrame3d BoxFrame ( TransformProxy - > GetTransform ( ) ) ;
2022-11-16 11:37:21 -05:00
const FVector3d BoxDimensions = 0.5 * BasicProperties - > Dimensions ;
2021-12-02 15:04:36 -05:00
return FOrientedBox3d ( BoxFrame , BoxDimensions ) ;
2021-05-31 22:15:32 -04:00
}
2019-10-01 20:41:42 -04:00
void UUVProjectionTool : : Render ( IToolsContextRenderAPI * RenderAPI )
{
ProjectionShapeVisualizer . bDepthTested = false ;
ProjectionShapeVisualizer . BeginFrame ( RenderAPI , CameraState ) ;
2021-08-26 09:31:28 -04:00
UE : : Geometry : : FOrientedBox3d PrimBox = GetProjectionBox ( ) ;
2021-05-31 22:15:32 -04:00
FVector MinCorner = ( FVector ) - PrimBox . Extents ;
FVector MaxCorner = ( FVector ) PrimBox . Extents ;
float Width = MaxCorner . X - MinCorner . X ;
float Depth = MaxCorner . Y - MinCorner . Y ;
float Height = MaxCorner . Z - MinCorner . Z ;
FTransform UseTransform = PrimBox . Frame . ToFTransform ( ) ;
if ( BasicProperties - > ProjectionType = = EUVProjectionMethod : : Cylinder )
{
UseTransform . SetScale3D ( FVector ( Width , Depth , 1.0f ) ) ;
}
ProjectionShapeVisualizer . SetTransform ( UseTransform ) ;
switch ( BasicProperties - > ProjectionType )
{
case EUVProjectionMethod : : Box :
ProjectionShapeVisualizer . DrawWireBox ( FBox ( MinCorner , MaxCorner ) ) ;
break ;
case EUVProjectionMethod : : Cylinder :
ProjectionShapeVisualizer . DrawWireCylinder ( FVector ( 0 , 0 , - Height * 0.5f ) , FVector ( 0 , 0 , 1 ) , 0.5f , Height , 16 ) ;
break ;
case EUVProjectionMethod : : Plane :
ProjectionShapeVisualizer . DrawSquare ( FVector ( 0 , 0 , 0 ) , FVector ( Width , 0 , 0 ) , FVector ( 0 , Depth , 0 ) ) ;
break ;
case EUVProjectionMethod : : ExpMap :
ProjectionShapeVisualizer . DrawSquare ( FVector ( 0 , 0 , 0 ) , FVector ( Width , 0 , 0 ) , FVector ( 0 , Depth , 0 ) ) ;
break ;
2019-10-01 20:41:42 -04:00
}
ProjectionShapeVisualizer . EndFrame ( ) ;
}
2022-11-16 11:37:21 -05:00
void UUVProjectionTool : : OnPropertyModified ( UObject * PropertySet , FProperty * Property )
{
if ( PropertySet = = BasicProperties & & BasicProperties - > bProportionalDimensions )
{
// We are silencing all watchers if Property corresponds to an FVector UProperty because this indicates that
// the "Reset to Default" button was pressed. If individual components are modified instead, then Property will
// not be castable to an FStructProperty
const FStructProperty * StructProperty = CastField < FStructProperty > ( Property ) ;
if ( StructProperty ! = nullptr & & StructProperty - > Struct - > GetName ( ) = = FString ( " Vector " ) )
{
CachedDimensions = BasicProperties - > Dimensions ;
BasicProperties - > SilentUpdateWatcherAtIndex ( DimensionsWatcher ) ;
}
}
}
2020-04-18 18:42:59 -04:00
void UUVProjectionTool : : OnTick ( float DeltaTime )
2019-10-01 20:41:42 -04:00
{
2023-06-22 09:28:20 -04:00
Super : : OnTick ( DeltaTime ) ;
2021-05-31 22:15:32 -04:00
if ( bHavePendingAction )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
ApplyAction ( PendingAction ) ;
bHavePendingAction = false ;
PendingAction = EUVProjectionToolActions : : NoAction ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
Preview - > Tick ( DeltaTime ) ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : OnMaterialSettingsChanged ( )
2019-10-01 20:41:42 -04:00
{
MaterialSettings - > UpdateMaterials ( ) ;
2020-03-05 14:27:21 -05:00
2021-05-31 22:15:32 -04:00
UMaterialInterface * OverrideMaterial = MaterialSettings - > GetActiveOverrideMaterial ( ) ;
if ( OverrideMaterial ! = nullptr )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
Preview - > OverrideMaterial = OverrideMaterial ;
}
else
{
Preview - > OverrideMaterial = nullptr ;
2019-10-01 20:41:42 -04:00
}
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : OnMeshUpdated ( UMeshOpPreviewWithBackgroundCompute * PreviewCompute )
{
const FColor UVSeamColor ( 15 , 240 , 15 ) ;
const float UVSeamThickness = 2.0f ;
const float UVSeamDepthBias = 0.1f * ( float ) ( WorldBounds . DiagonalLength ( ) * 0.01 ) ;
const FDynamicMesh3 * UseMesh = Preview - > PreviewMesh - > GetMesh ( ) ;
const FDynamicMeshUVOverlay * UVOverlay = UseMesh - > Attributes ( ) - > GetUVLayer ( UVChannelProperties - > GetSelectedChannelIndex ( true ) ) ;
2021-12-02 15:04:36 -05:00
auto AppendSeamEdge = [ UseMesh , UVSeamColor , UVSeamThickness , UVSeamDepthBias ] ( int32 eid , TArray < FRenderableLine > & LinesOut ) {
2021-05-31 22:15:32 -04:00
FVector3d A , B ;
UseMesh - > GetEdgeV ( eid , A , B ) ;
LinesOut . Add ( FRenderableLine ( ( FVector ) A , ( FVector ) B , UVSeamColor , UVSeamThickness , UVSeamDepthBias ) ) ;
} ;
if ( TriangleROI - > Num ( ) > 0 )
{
EdgeRenderer - > CreateOrUpdateLineSet ( TEXT ( " UVSeams " ) , UseMesh - > MaxEdgeID ( ) , [ & ] ( int32 eid , TArray < FRenderableLine > & LinesOut ) {
FIndex2i EdgeT = UseMesh - > GetEdgeT ( eid ) ;
2021-07-27 18:18:06 -04:00
if ( UseMesh - > IsEdge ( eid ) & & TriangleROISet . Contains ( EdgeT . A ) & & TriangleROISet . Contains ( EdgeT . B ) & & UVOverlay - > IsSeamEdge ( eid ) )
2021-05-31 22:15:32 -04:00
{
AppendSeamEdge ( eid , LinesOut ) ;
}
} , 1 ) ;
}
else
{
EdgeRenderer - > CreateOrUpdateLineSet ( TEXT ( " UVSeams " ) , UseMesh - > MaxEdgeID ( ) , [ & ] ( int32 eid , TArray < FRenderableLine > & LinesOut ) {
2021-07-27 18:18:06 -04:00
if ( UseMesh - > IsEdge ( eid ) & & UVOverlay - > IsSeamEdge ( eid ) )
2021-05-31 22:15:32 -04:00
{
AppendSeamEdge ( eid , LinesOut ) ;
}
} , 1 ) ;
}
}
2022-01-07 00:14:44 -05:00
void UUVProjectionTool : : UpdatePlaneFromClick ( const FVector3d & Position , const FVector3d & Normal , bool bTransitionOnly )
2021-05-31 22:15:32 -04:00
{
FFrame3d CurrentFrame ( TransformProxy - > GetTransform ( ) ) ;
CurrentFrame . Origin = Position ;
2022-01-07 00:14:44 -05:00
if ( bTransitionOnly = = false )
2021-05-31 22:15:32 -04:00
{
CurrentFrame . AlignAxis ( 2 , Normal ) ;
}
TransformGizmo - > SetNewGizmoTransform ( CurrentFrame . ToFTransform ( ) ) ;
Preview - > InvalidateResult ( ) ;
bTransformModified = true ;
2020-03-05 14:27:21 -05:00
}
2019-10-01 20:41:42 -04:00
void UUVProjectionTool : : TransformChanged ( UTransformProxy * Proxy , FTransform Transform )
{
2021-05-31 22:15:32 -04:00
Preview - > InvalidateResult ( ) ;
bTransformModified = true ;
2019-10-01 20:41:42 -04:00
}
bool UUVProjectionTool : : CanAccept ( ) const
{
2021-05-31 22:15:32 -04:00
if ( ! Preview - > HaveValidResult ( ) )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
return false ;
2019-10-01 20:41:42 -04:00
}
2020-11-24 18:42:39 -04:00
return Super : : CanAccept ( ) ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : OnInitializationModeChanged ( )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
bool bWasTransformModified = bTransformModified ;
if ( ! bTransformModified )
2019-10-01 20:41:42 -04:00
{
2021-05-31 22:15:32 -04:00
ApplyInitializationMode ( ) ;
bTransformModified = bWasTransformModified ;
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
}
2019-10-01 20:41:42 -04:00
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : ApplyInitializationMode ( )
{
switch ( BasicProperties - > Initialization )
{
case EUVProjectionToolInitializationMode : : Default :
BasicProperties - > Dimensions = InitialDimensions ;
TransformGizmo - > SetNewGizmoTransform ( InitialTransform ) ;
break ;
case EUVProjectionToolInitializationMode : : UsePrevious :
{
bool bHavePrevious = ( BasicProperties - > SavedDimensions ! = FVector : : ZeroVector ) ;
BasicProperties - > Dimensions = ( bHavePrevious ) ? BasicProperties - > SavedDimensions : InitialDimensions ;
TransformGizmo - > SetNewGizmoTransform ( ( bHavePrevious ) ? BasicProperties - > SavedTransform : InitialTransform ) ;
}
break ;
case EUVProjectionToolInitializationMode : : AutoFit :
ApplyAction_AutoFit ( false ) ;
break ;
case EUVProjectionToolInitializationMode : : AutoFitAlign :
ApplyAction_AutoFit ( true ) ;
break ;
}
2019-10-01 20:41:42 -04:00
}
2021-05-31 22:15:32 -04:00
void UUVProjectionTool : : ApplyAction ( EUVProjectionToolActions ActionType )
{
switch ( ActionType )
{
case EUVProjectionToolActions : : AutoFit :
ApplyAction_AutoFit ( false ) ;
break ;
case EUVProjectionToolActions : : AutoFitAlign :
ApplyAction_AutoFit ( true ) ;
break ;
case EUVProjectionToolActions : : Reset :
ApplyAction_Reset ( ) ;
break ;
2021-12-02 15:04:36 -05:00
case EUVProjectionToolActions : : NoAction :
break ;
2021-05-31 22:15:32 -04:00
}
}
void UUVProjectionTool : : ApplyAction_AutoFit ( bool bAlign )
{
// get current transform
FFrame3d AlignFrame ( TransformGizmo - > GetGizmoTransform ( ) ) ;
TArray < FVector3d > Points ;
if ( VertexROI - > Num ( ) > 0 )
{
CollectVertexPositions ( * InputMesh , * VertexROI , Points ) ;
}
else
{
CollectVertexPositions ( * InputMesh , InputMesh - > VertexIndicesItr ( ) , Points ) ;
}
// auto-compute orientation if desired
if ( bAlign )
{
if ( BasicProperties - > ProjectionType = = EUVProjectionMethod : : Plane | | BasicProperties - > ProjectionType = = EUVProjectionMethod : : Box | | BasicProperties - > ProjectionType = = EUVProjectionMethod : : Cylinder )
{
// compute min-volume box
2021-08-26 09:31:28 -04:00
UE : : Geometry : : FOrientedBox3d MinBoundingBox ;
2021-05-31 22:15:32 -04:00
FMinVolumeBox3d MinBoxCalc ;
bool bMinBoxOK = MinBoxCalc . SolveSubsample ( Points . Num ( ) , 1000 ,
[ & ] ( int32 Index ) { return WorldTransform . TransformPosition ( Points [ Index ] ) ; } , false , nullptr ) ;
if ( bMinBoxOK & & MinBoxCalc . IsSolutionAvailable ( ) )
{
MinBoxCalc . GetResult ( MinBoundingBox ) ;
}
else
{
2021-08-26 09:31:28 -04:00
MinBoundingBox = UE : : Geometry : : FOrientedBox3d ( WorldBounds ) ;
2021-05-31 22:15:32 -04:00
}
AlignFrame = MinBoundingBox . Frame ;
}
else if ( BasicProperties - > ProjectionType = = EUVProjectionMethod : : ExpMap )
{
int32 VertexID ;
if ( TriangleROI - > Num ( ) > 0 )
{
FDynamicMeshUVEditor : : EstimateGeodesicCenterFrameVertex ( * InputMesh , * TriangleROI , AlignFrame , VertexID ) ;
AlignFrame . Transform ( WorldTransform ) ;
}
else
{
FDynamicMeshUVEditor : : EstimateGeodesicCenterFrameVertex ( * InputMesh , AlignFrame , VertexID ) ;
AlignFrame . Transform ( WorldTransform ) ;
}
}
}
// fit bounds to current frame
FAxisAlignedBox3d FitBounds = FAxisAlignedBox3d : : MakeBoundsFromIndices ( Points . Num ( ) , [ this , & Points , & AlignFrame ] ( int32 Index )
{
return AlignFrame . ToFramePoint ( WorldTransform . TransformPosition ( Points [ Index ] ) ) ; }
) ;
if ( BasicProperties - > ProjectionType = = EUVProjectionMethod : : Plane | | BasicProperties - > ProjectionType = = EUVProjectionMethod : : Box | | BasicProperties - > ProjectionType = = EUVProjectionMethod : : Cylinder )
{
FVector3d ShiftCenter = AlignFrame . FromFramePoint ( FitBounds . Center ( ) ) ;
AlignFrame . Origin = ShiftCenter ;
}
BasicProperties - > Dimensions = 2.0f * ( FVector ) FitBounds . Extents ( ) ;
if ( DimensionsWatcher > = 0 )
{
BasicProperties - > SilentUpdateWatcherAtIndex ( DimensionsWatcher ) ;
}
2021-12-02 15:04:36 -05:00
if ( DimensionsModeWatcher > = 0 )
{
BasicProperties - > SilentUpdateWatcherAtIndex ( DimensionsModeWatcher ) ;
}
2021-05-31 22:15:32 -04:00
// update Gizmo
TransformGizmo - > SetNewGizmoTransform ( AlignFrame . ToFTransform ( ) ) ;
}
void UUVProjectionTool : : ApplyAction_Reset ( )
{
bool bWasTransformModified = bTransformModified ;
ApplyInitializationMode ( ) ;
bTransformModified = bWasTransformModified ;
}
2019-10-01 20:41:42 -04:00
# undef LOCTEXT_NAMESPACE
2022-09-28 01:06:15 -04:00