Commit Graph

144 Commits

Author SHA1 Message Date
Ryan Schmidt
b02f4829db ModelingTools: DynamicMeshActor support Tools and Settings.
- 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]
2021-06-23 22:13:32 -04:00
Michael Noland
ed64a12074 ModelingTools: Initialized some uninitialized struct members to fix a startup warning (soon to be an error)
#fyi Ryan.Schmidt

[CL 16752148 by Michael Noland in ue5-main branch]
2021-06-22 20:31:45 -04:00
Ryan Schmidt
34e50c3aa1 GeometryFramework: move UDynamicMesh and DynamicMeshComponent to new Runtime/Experimental/GeometryFramework module
#rb none
#rnx
#jira none
#preflight 60d16e6ca81904000135e6d4

[CL 16744295 by Ryan Schmidt in ue5-main branch]
2021-06-22 12:10:24 -04:00
Ryan Schmidt
6497a53181 ModelingComponents: Add DynamicMeshActor
- ADynamicMeshActor type has a UDynamicMeshComponent subobject (similar to StaticMeshActor)
- Add IPersistentDynamicMeshSource, a ToolTarget Interface for accessing a UDynamicMesh
- Add UDynamicMeshComponentToolTarget, a UToolTarget implementing the above as well as various standard interfaces, to allow Tools to operate on an external DynamicMeshComponent
- Update UE::ToolTarget:: helper functions that get/commit via DynamicMesh to handle IPersistentDynamicMeshSource directly, instead of going via existing MeshDescription/DynamicMesh interfaces. Add UE::ToolTarget::SetSourceObjectVisible() helper function.
- Add support for creating DynamicMeshActors in UCreateMeshObjectTypeProperties and UEditorModelingObjectsCreationAPI
- register UDynamicMeshComponentToolTargetFactory in ModelingToolsEditorMode
- Rename existing internal ADynamicMeshActor to AOldDynamicMeshActor. Does not appear to be in use and will be removed in a future CL.

#rb lonnie.li
#rnx
#jira none
#preflight 60d0effc367e6700014c2e89

[CL 16735093 by Ryan Schmidt in ue5-main branch]
2021-06-21 18:08:56 -04:00
Ryan Schmidt
5d58a012cd ModelingComponents: add support for a UBodySetup and Complex Collision to DynamicMeshComponent
#rb none
#rnx
#jira none
#preflight 60cfb14471002f0001696afa

[CL 16724446 by Ryan Schmidt in ue5-main branch]
2021-06-20 18:09:19 -04:00
Ryan Schmidt
da254f4c8b ModelingComponents: Add UBaseDynamicmeshComponent::SetShadowsEnabled() and UPreviewMesh::SetShadowsEnabled() wrapper, and update Tools that are directly modifying the bCastDynamicShadow variable on Components. That doesn't work as it doesn't update the SceneProxy, and is currently causing crashes. ::SetShadowsEnabled() forces a full immediate rebuild of the SceneProxy, which is very heavy but seems to be required.
#rb david.hill
#rnx
#jira UE-118344
#preflight 60cb7d3a9f12370001350352

[CL 16715096 by Ryan Schmidt in ue5-main branch]
2021-06-17 19:18:23 -04:00
Ryan Schmidt
1a178fa774 ModelingTools: clean up old PDI-based mesh edge rendering in Weld, Generate Polygroups, Remesh, Simplify. Replace with usage of UMeshElementsVisualizer and/or UPreviewGeometry. Also clean up includes and port to UE::ToolTarget:: APIs.
UMeshElementsVisualizer::SetMeshAccessFunction() now takes a TFunction with a TFunctionRef argument, instead of with a FDynamicMesh3* argument. This allows the UMeshElementsVisualizer to access the target mesh via the ProcessMesh()-style call on a UPreviewMesh, UDynamicMesh, etc, rather than receiving direct pointer access. See UWeldMeshEdgesTool::Setup() for example usage.

Add UMeshOpPreviewWithBackgroundCompute::ProcessCurrentMesh(), which forwards to the embedded UPreviewMesh::ProcessMesh()  (which can be used with the above)

Add UE::ToolTarget::GetMeshDescriptionCopy() to ModelingToolTargetUtil, similar to existing DynamicMesh variant that will auto-compute tangents if necessary.

#rb none
#rnx
#jira none
#preflight 60c8def586ce760001d8de51
#fyi semion.piskarev

[CL 16679472 by Ryan Schmidt in ue5-main branch]
2021-06-15 17:05:25 -04:00
ryan schmidt
dd142ab4b2 ModelingComponents: improve handling of thin objects in FMeshSceneAdapter. Add Weld step before connected components. Per-Instance transforms are now extracted outside of Component-level processing, and 'thin' detection is now tested under this transform set, for each connected component. This improves handling of (eg) extreme scaling applied to create thin instances. Check AABB dimensions in IsThinPlanarSubMesh() before using normals, this handles many thin parts that are not "box-like" (will still not work if part is rotated). Seed points now generated on offset surfaces, if required, to avoid failures in surface rootfinding. Add support for filtering tiny objects (enabled in ApproximateActorsImpl, for 10% of voxel dimension)
#rb none
#rnx
#preflight 60c844582da78400011f4ef7


#ROBOMERGE-SOURCE: CL 16670139
#ROBOMERGE-BOT: (v834-16658389)

[CL 16670142 by ryan schmidt in ue5-main branch]
2021-06-15 02:47:13 -04:00
Ryan Schmidt
e196c256e4 GeometryProcessing: remove forwarding headers used in GeometryCore transition, and update all affected includes.
#rb none
#rnx
#jira none
#preflight 60c52c5db9446100014da02d

[CL 16653115 by Ryan Schmidt in ue5-main branch]
2021-06-13 00:35:22 -04:00
Ryan Schmidt
f45388ffbe Rename USimpleDynamicMeshComponent to UDynamicMeshComponent. Move ModelingComponents Components and SceneProxys to /Components subdirectory.
#rb none
#rnx
#jira none
#preflight 60c4451f5c10070001ae0537

[CL 16652187 by Ryan Schmidt in ue5-main branch]
2021-06-12 14:28:52 -04:00
Ryan Schmidt
fdf11b67d2 ModelingComponents: Clean up DynamicMeshComponent API. Update Component and Proxy handling of Tangents to use Attribute Overlay if available. Update affected Tools and also convert most of the affected Tools to use UE::ToolTarget helper functions.
- Add UE::ToolTarget::CommitMaterialSetUpdate() and ::CommitDynamicMeshUpdate(). ::GetDynamicMeshCopy() can now return tangents if requested.
- Add IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). Default implementation does nothing, UStaticMeshComponentToolTarget implementation initializes auto-generated MeshDescription attributes. Used in ::GetDynamicMeshCopy() to get tangents (but requires a MeshDescription copy).
- Clean up handling of Tangents in Simple/OctreeDynamicMeshComponent. Add local MakeTangentsFunc() to generate the Tangents lambda, handle different cases and no-tangents fallbacks consistently.
- UDynamicMesh: add optional info arguments to EditMesh() and ChangeInfo struct. Add support for deferring change events from Edit funcs.
- Remove UBaseDynamicMeshComponent::InitializeMesh(), ::Bake() APIs, and add ::SetMesh(). Implement in Simple/Octree implementations, update all Tools that used those APIs.
- Add USimpleDynamicMeshComponent::ProcessMesh(), EditMesh(). These are now the preferred ways to read/write mesh.
- Update USimpleDynamicMeshComponent tangents handling. Externally-computed tangents are now taken directly from the FDynamicMesh3 attribute set. Autogenerated tangents are still computed and stored in an internal FMeshTangentsf, but this is no longer exposed for external updates.
- Remove UPreviewMesh pass-through functions for Tangents access, InitializeMesh() and Bake(). Add ProcessMesh()
- Update all affected Tools. In most cases these Tools have also been converted to use ModelingToolTargetUtil functions, instead of direct ToolTarget interface casting.

#rb none
#rnx
#jira none
#preflight 60c3e71d3e1b3c00015668af

[CL 16650666 by Ryan Schmidt in ue5-main branch]
2021-06-11 22:39:18 -04:00
nathan mitchell
76430ea10f UVEditor: Adding multiple selection to MeshSelectionMechanic
#rb michael.balzer
#rnx
#jira UETOOL-3692

[CL 16645760 by nathan mitchell in ue5-main branch]
2021-06-11 15:36:05 -04:00
Ryan Schmidt
b62db3ed4d ModelingComponents: Add UDynamicMesh class, wraps FDynamicMesh3 in a UObject. Use as mesh storage inside SimpleDynamicMeshComponent and OctreeDynamicMeshComponent. Clean up SimpleDynamicMeshComponent and BaseDynamicMeshComponent API and headers.
#rb david.hill
#rnx
#jira none
#preflight 60c15e9cc612640001ac7350

[CL 16632323 by Ryan Schmidt in ue5-main branch]
2021-06-10 18:37:34 -04:00
semion piskarev
657650fe05 UVEditor: Added live preview to UV editor. To support this, did major refactoring in the way that the UV editor supplies its tools with input. Also added scaling of islands and tweaked the used material to make gizmo more visible.
#rb Brooke.Hubert, Lonnie.Li, Michael.Balzer
#rnx
#jira UETOOL-3111, UETOOL-3574

[CL 16618600 by semion piskarev in ue5-main branch]
2021-06-09 23:53:59 -04:00
semion piskarev
3cb0babc20 MeshModelingTools: Added tool targets that operate on static and skeletal mesh assets without an underlying component, and refactored to use the same code. Also changed the dynamic mesh shared pointers in the tool targets to be thread safe ones.
#rb Ryan.Schmidt
#jira none
#rnx

[CL 16615477 by semion piskarev in ue5-main branch]
2021-06-09 19:21:27 -04:00
semion piskarev
b58ce73afc MeshModelingTools: Tweaking UMeshOpPreviewWithBackgroundCompute to allow calculations to be cancelled without shutting down the preview entirely, and to allow the op generator to be swapped out. This will be useful when sharing a preview object between tools or tool mechanics.
#rb Tyson.Brochu
#rnx
#jira none

[CL 16606486 by semion piskarev in ue5-main branch]
2021-06-09 11:53:46 -04:00
semion piskarev
cf40dc417f MeshModelingTools: Tweaked tool target requirements object storage default and added a convenience function to add requirements. Also added several comments in places.
#rb Lonnie.Li, Tyson.Brochu
#rnx
#jira none

[CL 16606399 by semion piskarev in ue5-main branch]
2021-06-09 11:50:54 -04:00
Ryan Schmidt
da355de8a2 ModelingTools: Add basic Transfer Mesh Tool that can copy a mesh from one object to another. Add UE::ToolTarget::CommitMeshDescriptionUpdate() helper function.
#rb none
#rnx
#jira none
#preflight 60bf147e0c76f90001db699e

[CL 16583974 by Ryan Schmidt in ue5-main branch]
2021-06-08 03:51:23 -04:00
ryan schmidt
a8da674d2c ApproximateActors: Implement support for detection of thin-slabs (ie thin planar meshes that are not single-sided) in FMeshSceneAdapter. Add support for sub-mesh instancing, to reduce number of times that repeated meshes are unique'd when used with the same scaling transform. Reorganize computation so that spatial builds are processed in decreasing-mesh-size order, and do other parallel improvements, such that time to process a large assembly (total ~2.2b triangles from 37k instances of 415 unique meshes w/~44m unique triangles) reduces from 58s to 22s (with ~10s of this time being loading source mesh data) on 64-core threadripper.
#rb none
#rnx
[FYI] sebastien.lussier
#preflight 60beff3593a9d300017c2be8


#ROBOMERGE-OWNER: ryan.schmidt
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 16583724
#ROBOMERGE-BOT: (v828-16531559)
#ROBOMERGE-CONFLICT from-shelf

[CL 16583791 by ryan schmidt in ue5-main branch]
2021-06-08 02:55:00 -04:00
Ryan Schmidt
75a21c9bb9 ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop

#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5

[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
Ryan Schmidt
7b214c4a33 MeshModeling: add ModelingObjectsCreationAPI, replaces existing usage of IToolsContextAssetAPI in Modeling Tools/Mode
- add new UModelingObjectsCreationAPI and associated data structures, provides abstract API for creating mesh and texture objects from Tools that is not specifically tied to StaticMesh Actors/Assets
- new helper functions in UE::Modeling:: namespace to simplify usage of an implementation of this API registered in a ContextObjectStore
- add new UEditorModelingObjectsCreationAPI implementation of above, supports hooks for higher level to provide custom paths
- add ModelingModeAssetUtils.h, provides several functions in UE::Modeling:: namespace to be used to implement those hooks (various existing path-determination code is moved here)
- ModelingToolsEditorMode now registers an instance of UEditorModelingObjectsCreationAPI in ContextObjectStore and connects up callbacks to these path functions
- AssetGenerationUtil functions and ModelingModeAssetAPI deleted
- All Tools that previously used IToolsContextAssetAPI updated to use this new system

#rb jimmy.andrews
#rnx
#jira none
#preflight 60b7c2ddae46a1000162729b

[CL 16538450 by Ryan Schmidt in ue5-main branch]
2021-06-02 15:58:00 -04:00
ryan schmidt
2fab582c78 GeometryProcessing:
- extend FImageAdapter to support reading
ModelingComponents::
- Add AssetUtils::ForceVirtualTexturePrefetch(), ::SaveDebugImage() variants to Texture2DUtil
- Add support for debug image writing to WorldRenderCapture and SceneCapturePhotoSet
- FWorldRenderCapture now computes more accurate bounds (visible Components instead of Actors), and does an explicit VirtualTexture prefetch before doing render capture
- FStaticMeshAssetOptions now exposes Nanite settings to allow UStaticMeshes to be created with Nanite already enabled (currently NaniteSettings.PositionPrecision defaults to max)
ApproximateActors:
- IGeometryProcessing_ApproximateActors::FOptions now has settings for enabling Nanite on generated meshes
- ApproximateActorsImpl applies these settings, also enables VT on generated textures if necessary
- FMeshApproximationSettings/FMeshApproximationTool updated w/ new Nanite settings
#rb none
#rnx
#jira none
[FYI] sebastien.lussier
#preflight 60b08323f51cd90001775b98

#ROBOMERGE-OWNER: ryan.schmidt
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 16499613 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v823-16466674)
#ROBOMERGE-CONFLICT from-shelf

[CL 16499647 by ryan schmidt in ue5-main branch]
2021-05-28 02:46:59 -04:00
Ryan Schmidt
9618dc4ff0 ModelingComponents:
- add ModelingToolTargetUtil, contains helper static functions for interacting with ToolTargets without having to manually cast things/etc
- add StoredMeshSelectionUtil, contains helper functions for interacting with stored selections
- USingleSelectionMeshEditingTool now can automatically grab an available stored selection, if it exists
- Add GroupTopologyStorableSelection::GetGroupIDs()
#rb none
#rnx
#jira none
#preflight 60b0282063fc6e000133ed3d
#fyi semion.piskarev, lonnie.li

[CL 16499566 by Ryan Schmidt in ue5-main branch]
2021-05-28 02:09:37 -04:00
ryan schmidt
a36b628de3 ModelingComponents: add support for HDR Emissive capture and texture handling
- FTexture2DBuilder has new EmissiveHDR texture type, uses PF_FloatRGBA/FFloat16Color texture format/buffers in this case. Moved most functions from header to cpp.
- new WorldRenderCapture::CaptureEmissiveFromPosition() implementation captures PreTonemapHDRColor buffer, with showflags config such that only Emissive (and possibly some GI - untested) will be included.
- ApproximateActorsImpl now stores Emissive bake in HDR texture. Update preview material to use Linear Texture Sampler for Emissive, required to use HDR texture
#rb none
#rnx
#jira none
#preflight 60b00ca67e4e6a00018b3960

#ROBOMERGE-SOURCE: CL 16495597 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v823-16466674)

[CL 16495615 by ryan schmidt in ue5-main branch]
2021-05-27 21:27:15 -04:00
ryan schmidt
99cbde8bd3 ModelingComponents: support Packed Metallic/Roughness/Specular (MRS) capture in WorldRenderCapture using custom postprocess render pass. Also support in FSceneCapturePhotoSet. Add Linear Color variant to FTexture2DBuilder.
#rb none
#rnx
#jira none
#preflight 60ade5d11d02bb0001883281

#ROBOMERGE-SOURCE: CL 16465354 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v818-16446889)

[CL 16465367 by ryan schmidt in ue5-main branch]
2021-05-26 03:02:11 -04:00