- Removed hardcoded element type arrays (Vertices, Edges, Triangles etc.). Mesh element types can now be arbitrarily added, with any number of channels.
- Mesh element containers have a much leaner format; instead of sparse arrays, they are now represented by a simple bitarray, determining whether an index is used or not. Consequently, mesh topology is now entirely described with the attribute system, e.g. edge start and end vertices, triangle vertices, etc.
- Support added for attributes of arbitrary dimensions, e.g. float[4] or int[2].
- Support added for attributes which index into another mesh element container.
- Added FMeshElementIndexer: this is an efficient container for maintaining backward references from one element type to another; for example, edges have an attribute specifying which vertices are at each end (an attribute of type FVertexID[2]). With an indexer, it is possible to look up which edges contain a given vertex, even though this is not explicitly stored. Indexers are designed to do minimal allocations and update lazily and in batch when necessary.
- Added support for preserving UV topology in static meshes. UVs are now a first-class element type which may be indexed directly from triangles.
- Added the facility to access the underlying array in an attribute array directly.
- Triangles now directly reference their vertex, edge and UV IDs. Vertex instances are to be deprecated.
- Changed various systems to be triangle-centric rather than polygon-centric, as this is faster. Triangles are presumed to be the elementary face type in a MeshDescription, even if polygons are still supported. The concept of polygons will be somewhat shifted to mean a group of triangles which should be treated collectively for editing purposes.
- Optimised normal/tangent generation and FBX import.
- Deprecated EditableMesh, MeshEditor and StaticMeshEditorExtension plugins - these are to be removed, but they still have certain hooks in place which need removing.
#rb
[CL 13568702 by Richard TalbotWatkin in ue5-main branch]
#rnx
#rb none
#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)
[CL 10870549 by ryan durand in Main branch]
- Fixed crash when importing model thru VRED importer
- Includes changes to StaticMeshBuilder.cpp made in CL #4369604
#jira UE-64152
#rb Yuriy.ODonnell, Richard.TalbotWatkins
#ROBOMERGE-SOURCE: CL 4407052 in //UE4/Release-4.21/...
#ROBOMERGE-BOT: RELEASE (Release-4.21 -> Release-Staging-4.21)
[CL 4407058 by jeanluc corenthin in Staging-4.21 branch]
Fixed some flaws in the original API, deprecated various methods, and introduced some new features.
- Now attribute arrays are accessed via TAttributesRef or TAttributesView (and corresponding const versions). These value types hold references to attribute arrays, and individual elements can be accessed by their element ID and attribute index. Using a value type is safer than the previous method which required assignment to a const-ref (and not doing so would take a temporary copy of the attribute array).
- The attribute set has been totally flattened, so all attributes of different types are added to the same container. This greatly improves compile times, prevents attributes from being created with the same name but different types, and permits the view feature.
- The class hierarchy has changed to have generic base classes where possible with no particular ElementID type. This reduces the code footprint by no longer generating nearly identical copies of templated methods.
- A TAttributesView allows the user to access an attribute array by the type of their choosing, regardless of its actual type. For example, the Normal attribute may be registered with type FPackedVector, but accessed as if it was an FVector. This allows us to move away from very strong typing, and instead transparently store attributes of a more efficient size, while the user is not affected.
- A transient attribute flag has been added, to denote that a particular attribute should not be saved.
#rb none
[CL 4226081 by Richard TalbotWatkin in Dev-Editor branch]
Attributes now have a number of possible types (FVector, FVector4, FVector2D, float, int, bool, FName, UObject*) and are exposed as individual flat arrays, indexed by element ID. For example, vertex positions are essentially exposed as an array of FVector which can be directly accessed and modified. This has a number of advantages:
- It is completely extensible: new attributes can be created (even by a third party) and added to a mesh description without requiring a serialization version bump, or any change to the parent structures.
- This is more efficient in batch operations which deal with a number of mesh elements in one go.
- These attribute buffers can potentially be passed directly to third-party libraries without requiring any kind of transformation.
- The distinct types allow for a better representation of the attribute being specified, without invalid values being possible (cf representing a bool value in an FVector4).
Attributes also have default values, and a flags field which confers use-specific properties to them. Editable Mesh currently uses this to determine whether an attribute's value can be automatically initialized by lerping the values of its neighbours, as well as for identifying auto-generated attributes such as tangents/normals. This is desirable as it means that even unknown / third-party attributes can potentially be handled transparently by Editable Mesh, without requiring the code to be extended.
Certain higher-level operations in EditableMesh have been optimized to make full use of vertex instances where possible.
The welding/splitting of identical vertex instances has been removed from here, as the aim is to unify this with mesh utility code elsewhere.
Various bug fixes.
#rb Alexis.Matte
[CL 3794563 by Richard TalbotWatkin in Dev-Geometry branch]
- Created new API for accessing mesh elements. They now allow a range-for iteration over element IDs, and a custom container type for elements.
- Beginnings of a new generic attribute system which supports different attribute value types. This provides SoA type attribute containers (so, for example, all vertex positions are held contiguously).
- Revisited polygon groups and materials. Materials are now handled like an attribute of polygon groups, and are represented by a string asset reference, and two slot names (user-given and imported). Added a new basic action to move a polygon from one group to another, and removed the 'assign material to polygon' action. A mesh can now have more than one polygon group with the same material.
- General refactoring and optimization.
#rb Mike.Fricker
[CL 3603104 by Richard TalbotWatkin in Dev-Geometry branch]