25 Commits

Author SHA1 Message Date
katie caputo
b936494618 Modeling Tools: Places Mesh Element Selection Gizmo in Object Frame Mode at selected component(s) pivot rather than at object's pivot
#JIRA UE-206515
#rb lonnie.li

[CL 31571303 by katie caputo in 5.4 branch]
2024-02-16 13:05:19 -05:00
katie caputo
65f49dec9c Modeling Tools: Adds 'Local Frame Mode' toggle in the Mesh Element Selection Toolbar Settings so users can edit with the gizmo based either on the selected geometry only or on the entire object
#JIRA UE-202681
#rb lonnie.li, nickolas.drake

[CL 31126159 by katie caputo in 5.4 branch]
2024-02-02 10:54:38 -05:00
nickolas drake
9fe266cccd MeshElementSelection: Make selectable mesh elements visible.
When we have a valid topology type (Triangle or Poly, not None), we render selectable mesh elements.

Added AccumulateElementsFromPredicate to the GeometrySelector interface which allows a predicate function to filter which geometry elements ought to be included in the provided FGeometrySelectionElements. The predicate is aware of the type of element (vert, edge, tri) and the selected element ID (which is a single value encoding the topology ID and the element ID). The predicate returns true for elements to include and false for elements to exclude. Internally, this function builds transient vert, edge, and tri selections with this predicate and then accumulates all selection elements into the provided FGeometrySelectionElements.

#rb lonnie.li
#jira UE-202674

[CL 30862050 by nickolas drake in 5.4 branch]
2024-01-24 16:25:45 -05:00
jimmy andrews
7e1b8e46d9 add concept of saving-on-clear/restoring the selection manager's selection, so that tools can restore the before-tool selection if the tool is cancelled, or if the tool otherwise did not change the underlying meshes.
+ add a callback to the modeling editor mode so it can know whether a tool was cancelled, and make the modeling mode use the selection manager's new save-on-clear/restore feature automatically when its tools are cancelled.

 + make some tools (normals, tangents, inspector) restore the before-tool-start selection after tool use via a utility function, since they shouldn't change mesh IDs that the selection relies on.

#jira UE-195948
#rb Ryan.Schmidt

[CL 29027037 by jimmy andrews in ue5-main branch]
2023-10-23 22:46:23 -04:00
ryan schmidt
826eb71a04 ModelingMode: selection system bugfixes & improvements.
Add DynamicMeshSelector::UpdateAfterGeometryEdit API. StaticMeshSelector implementation updates static mesh after an Edit instead of emitting MeshChange on temporary DynamicMesh.
Delete and Retriangulate Commands now use this API instead of directly emitting transaction, so now these commands work properly on Static Meshes.

FStaticMeshComponentSelectorFactory::CanBuildForTarget now only allows UStaticMeshComponent specifically, filtering out subclasses. This is not ideal but I don't know what else we can do for now, there are many subclasses like ISMC, SplineMeshComponent, etc, that will not work w/ the Selection system. Also now filtering out Engine assets and cooked assets.

ModelingToolsEditorMode now listens for blueprint pre-compiles, and when this occurs, clears the active selection and selection targets. This is necessary because if the selection Component was part of a BP, on recompile it is re-instanced and the old pointer goes stale. Possibly can handle this better or at a more granular level, but clearing the selection is safest. This currently results in things not being undoable because the FChange transactions are on the "old" UDynamicMesh that no longer exists.

UModelingToolsEditorMode::UpdateSelectionManagerOnEditorSelectionChange now does a more thorough job of inspecting the current Actor/Component selection to find Components that could work w/ the selection system.

#rb lonnie.li

[CL 26133067 by ryan schmidt in ue5-main branch]
2023-06-20 16:23:43 -04:00
ryan schmidt
8937f914fa ModelingMode: avoid a crash on shutdown when DynamicMeshActor is selected, due to TargetCache being modified during iteration
#rb none
#preflight 644af8701150e908d05a0976

[CL 25238944 by ryan schmidt in ue5-main branch]
2023-04-28 16:01:06 -04:00
ryan schmidt
2046684122 ModelingMode: support IGeometrySelector::Sleep() and ::Restore() failing in GeometrySelectionManager. FBaseDynamicMeshSelector will now fail to sleep if TargetMesh is not valid. SupportsSleep() now also checks for valid target mesh.
#rb jimmy.andrews
#jira UE-184089
#preflight 644953476b589f8b367c7f7a

[CL 25204039 by ryan schmidt in ue5-main branch]
2023-04-26 14:35:53 -04:00
matija kecman
7b090b69c0 Add Geometry Selection visualization to Normals tool
#jira UE-183457
#preflight 64492eecb208f61af87912db
#rb ryan.schmidt

[CL 25199891 by matija kecman in ue5-main branch]
2023-04-26 11:54:13 -04:00
ryan schmidt
2f30bc1c16 ModelingMode: updates to selection system.
Selection enable/disable can now be toggled dynamically via mode settings popup, toolbar will hide/show based on current setting state.
GeometrySelectionManager is now always created. New Mode function GetMeshElementSelectionSystemEnabled() indicates whether selection is currently enabled, when disabled active targets will not be tracked.
Selection Toolbar icons now are disabled while in a Tool (as selection system is not active then)
New Static Mesh Assets and Volumes created using Modeling Tools now default to unlocked, via new functions on StaticMeshSelector / Volume Selector.
Unlocked Asset/Volume sets are cleared on level change
Added cvars modeling.Selection.EnableStaticMeshLocking and modeling.Selection.EnableVolumeLocking which can be used to fully disable lock-ability of StaticMesh/Volume (default true)
shortened some names of tool group tabs, as labels are now shown and long names make the bar wider
Added a few toast notifications for when setting state changes require a mode or editor restart.
#rb none
#preflight 64426fabb14f1faacff6921d

[CL 25149511 by ryan schmidt in ue5-main branch]
2023-04-21 14:04:50 -04:00
ryan schmidt
d83ee312b8 ModelingMode: bring back in-viewport selection toolbar. Add concept of Locking to IGeometrySelector, have StaticMeshSelector and VolumeSelector default to locked. Add util functions to check/manipulate locking state to UGeometrySelectionManager. Add locked-state indicator/button to selection toolbar.
#preflight 642df231c6769c608209676a
#rnx

[CL 24979045 by ryan schmidt in ue5-main branch]
2023-04-10 12:36:37 -04:00
ryan schmidt
3880554a59 ModelingMode: preliminary support for selection transform visualization for Volumes and Static Meshes, and other minor improvements.
Add IGeometrySelectionTransformer::PreviewRender() API, for rendering info during selection transforms. Currently being called by  UGeometrySelectionManager::DebugRender() for active transforms.
FBasicDynamicMeshSelectionTransformer implements PreviewRender, draws selected mesh edges (tris as edges) and vertices, as well as affected edge ROI.
FDynamicMeshPolygroupTransformer overrides this behavior and draws polygroup edges/verts and edge ROI

FStaticMeshSelector and FVolumeSelector now create FDynamicMeshPolygroupTransformer for polygroup selections

FBasicDynamicMeshSelectionTransformer::bEnableSelectionTransformDrawing flag controls whether this edge drawing is enabled. Disabled on DynamicMeshComponent, enabled on StaticMesh and Volume.

Add Normals recomputation during tri and polygroup transforms in FBasicDynamicMeshSelectionTransformer and FDynamicMeshPolygroupTransformer

Add FGroupTopologyDeformer::EnumerateROIEdges() util function to support above

#rb none
#preflight 641cd27bc44ce895fc62f724

[CL 24780655 by ryan schmidt in ue5-main branch]
2023-03-24 12:08:43 -04:00
ryan schmidt
af5699f133 ModelingTools: improve handling of invalid input selections to PolyEd Tool
Add UGeometrySelectionManager::GetActiveSelectionInfo, returns info about current selection w/o having to copy selection
Override UEditMeshPolygonsActionModeToolBuilder::CanBuildTool, use this new function to do specific per-action filtering to limit to supported input selection types
UEditMeshPolygonsSelectionModeToolBuilder::InitializeNewTool() now filters UI panels for current input selection if available, update Selection-palette PolyEd button to use this builder instead
#jira UE-176168
#preflight 63e2c886c2257e56f413b805
#rb david.hill

[CL 24068438 by ryan schmidt in ue5-main branch]
2023-02-08 01:21:37 -05:00
ryan schmidt
227ac3d087 ModelingTools: Add OffsetMeshSelectionTool and RetriangulateGeometrySelectionCommand
#preflight 63cb1d78574ab9cae448312c
#rb none

[CL 23803436 by ryan schmidt in ue5-main branch]
2023-01-21 13:02:53 -05:00
ryan schmidt
10924781b2 ModelingMode: add support for Editor Marquee in new Mesh Selection system.
Add IGeometrySelector::UpdateSelectionViaShape() API, takes a FConvexHull to use as selection shape. Implement in DynamicMeshSelector.
Add UGeometrySelectionManager::UpdateSelectionViaConvex() API, calls above
ModelingToolsEditorMode now implements ILegacyEdModeSelectInterface, ::FrustumSelect() implementation calls above w/ frustum convex hull

Hide Marquee drag mode option, set default drag mode to "none"
Add save/restore of selection mode, drag mode, and volume/staticmesh toggles via UModelingToolsModeCustomizationSettings
Remove old selection toggle commands that were replaced w/ combined commands
Call DeleteSelectionCommand in UModelingToolsEditorMode::ProcessEditDelete() if there is an active selection

#preflight 63cac131fa66be4cc33661a9
#rb none

[CL 23796046 by ryan schmidt in ue5-main branch]
2023-01-20 15:30:23 -05:00
ryan schmidt
70ac55822d 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
ryan schmidt
46630c002f ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult

Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode

#rb none
#preflight 63c047f4305002c64170f6a2

[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
christopher waters
0d5b23e2e3 Adding includes to prepare for a header dependency cleanup.
#preflight 63b5e0bfff7b9ad7030f0f81

[CL 23581920 by christopher waters in ue5-main branch]
2023-01-04 17:07:40 -05:00
ryan schmidt
74b3c229b3 ModelingMode: Mesh Element Selection system evolution.
Refactor most of FDynamicMeshSelector into FDynamicMeshSelectorBase, FDynamicMeshSelector is now a subclass.
Move the DynamicMeshTransformer from cpp to FBasicDynamicMeshSelectionTransformer in header.
Add FVolumeSelector and FStaticMeshSelector which are derived from FBaseDynamicMeshSelector.
Add ability to filter selection queries/edits by TopologyID in FGeometrySelectionEditor. This is necesary for polygroup and polygroup-edge selections as their encoding includes an arbitrary TriangleID paired w/ the TopologyID.
UGeometrySelectionManager now manages this TopologyID filtering on selection editors it creates/updates
Add concept of "Tracked" selection changes to UGeometrySelectionManager, allows a single selection FChange to be constructed incrementally, eg like with a brush. Add a variant of raycast-selection-update that can be run inside a tracked change.
#rb none
#preflight 6388f0cf4b2f03a7d761ccef

[CL 23361634 by ryan schmidt in ue5-main branch]
2022-12-01 16:11:52 -05:00
ryan schmidt
ffc51ff78c ModelingMode: new selection system improvements.
Introduced FGeometrySelectionHitQueryConfig (GeometrySelection.h), this provides information about the active selection mode. FGeometrySelectionEditor now tracks active FGeometrySelectionHitQueryConfig.
IGeometrySelector hit-testing/processing functions now take a struct FWorldRayQueryInfo that combines a FRay3d with FViewCameraState, to allow for (eg) snapping wrt the active camera/etc
Added FGeometrySelectionPreview, this is a utility subclass of FGeometrySelectionEditor that is used for selection-preview highlighting, relative to a base FGeometrySelectionEditor
Added IGeometrySelector::GetSelectionPreviewForRaycast() which is used to accumulate a preview of what might be selected in a FGeometrySelectionPreview. AccumulateSelectionElements() can also now accumulate 'preview' geometry, and FDynamicMeshSelector uses this to provide the edge-loop of a facegroup for it's preview (as providing all triangles is too expensive for hover highlighting on hires meshes).
Added support for hover-highlighting mechanic in UGeometrySelectionManager and UModelingSelectionInteraction
FDynamicMeshSelector now creates a GroupEdgeSegmentTree for polygroup edges. This allows for better selection interaction, eg no dependency on the edge-adjacent triangles.
Added AreSelectionsIdentical() function in GeometrySelectionUtil.h
#rb none
#preflight 638145b318176c67c2785280

[CL 23300258 by ryan schmidt in ue5-main branch]
2022-11-28 19:15:40 -05:00
bryan sefcik
4b8a83790a Updated to use UE_INLINE_GENERATED_CPP_BY_NAME.
#jira
#preflight 637c388f170bc34a93587526

[CL 23244381 by bryan sefcik in ue5-main branch]
2022-11-22 20:17:33 -05:00
henrik karlsson
b5b86c796c This change is a strategical submit for a coming change that removes lots of includes in headers that are included by many files. This change contains adding of includes in files that previously got those includes transitively from other inclkudes
#preflight 6355d4940313c24974b2107b
#rb none

[CL 22783162 by henrik karlsson in ue5-main branch]
2022-10-26 12:57:32 -04:00
Ryan Schmidt
c793d4bfa8 SelectionManager: modify Shutdown() to handle clearing active targets itself, as calling ClearActiveTargets() on editor shutdown can result in error if Component is already destroyed
#rb none
#preflight 62d976e53122bf80ae015983

[CL 21203457 by Ryan Schmidt in ue5-main branch]
2022-07-21 12:52:31 -04:00
Ryan Schmidt
6032c02f0e ModelingMode: add Delete command for current Mesh Selection
ToolsFramework:
add UInteractiveCommand and UInteractiveCommandArguments types, base classes for 'interactive commands' which are intended to be used for atomic actions, ie stateless, no user interaction, etc
ModelingComponents:
add UGeometrySelectionEditCommand/Arguments, this is a UInteractiveCommand that uses a FGeometrySelection as an argument
add UGeometrySelectionManager::CanExecuteSelectionCommand() and ExecuteSelectionCommand()

MeshModelingTools:
add UDeleteGeometrySelectionCommand, deletes selected mesh geometry by converting input selection to list of triangles

ModelingToolsEditorMode:
add Delete command to ModelingMode and UI. ModelingToolsEditorMode currently is keeping active command set alive via new UModelingToolsEditorMode::ModelingModeCommands member.

#rb none
#preflight 62d195b9a66919b6701d89a8

[CL 21113757 by Ryan Schmidt in ue5-main branch]
2022-07-15 13:49:13 -04:00
Ryan Schmidt
9ccacbd088 ModelingComponents: fix mismatched loctext key
#rb none
#preflight skip

[CL 20900253 by Ryan Schmidt in ue5-main branch]
2022-06-30 14:13:04 -04:00
Ryan Schmidt
96bcffd475 ModelingComponents: add new geometric-element Selection system
GeometrySelection.h/cpp: FGeometrySelection, FGeometrySelectionEditor, representation and manipulation of a generic element-level selection, stored as a set of uint64. Editor makes changes to Selection while tracking deltas.
GeometrySelectionUtil.h/cpp: utility and helper functions for editing/processing a mesh+selection
GeometrySelector.h: FGeometryIdentifier type used to identify target objects with element-level selection support. IGeometrySelector interface that defines API for element selection for a type of target object. Factory type for spawing instances. IGeometrySelectionTransformer interface that defines API for element-level transformation
GeometrySelectionManager.h/cpp: UGeometrySelectionManager that maintains set of 'active targets' with associated Selector, Selection, and SelectionEditor, and provides high-level API for creating and querying element selections, 3D transforms of selections, selection undo/redo, and (currently) limited debug rendering
GeometrySelectionChanges.h/cpp: FChange types for element selection changes
DynamicMeshSelector.h/cpp: implementation of IGeometrySelector for UDynamicMesh/Component

#rb jimmy.andrews
#preflight 62bdb9cbb024a2608c38b72d

[CL 20896967 by Ryan Schmidt in ue5-main branch]
2022-06-30 12:09:44 -04:00