Commit Graph

15 Commits

Author SHA1 Message Date
Ryan Durand
28d3d740dd (Integrating from Dev-EngineMerge to Main)
Second batch of remaining Engine copyright updates.

#rnx
#rb none
#jira none

[CL 10871196 by Ryan Durand in Main branch]
2019-12-27 07:44:07 -05:00
Chris Gagnon
8ab0638182 Copying //UE4/Dev-Editor to Dev-Main (//UE4/Dev-Main) for 4.24
#rb none

[CL 9325047 by Chris Gagnon in Main branch]
2019-10-01 20:41:42 -04:00
Chris Gagnon
2e87118a18 Copying //UE4/Dev-Editor to Dev-Main (//UE4/Dev-Main) Interim 4.24.
#rb none

[CL 8614014 by Chris Gagnon in Main branch]
2019-09-10 11:35:20 -04:00
Chris Gagnon
8fc25ea18e Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)
#rb none

[CL 4676797 by Chris Gagnon in Dev-Editor branch]
2019-01-02 14:54:39 -05:00
Ben Marsh
7598af0532 Update copyright notices to 2019.
#rb none
#lockdown Nick.Penwarden

[CL 4662404 by Ben Marsh in Main branch]
2018-12-14 13:41:00 -05:00
Richard TalbotWatkin
24a2a24011 New attribute array API.
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]
2018-07-20 18:58:37 -04:00
projectgheist
27ae5afdcb PR #4726: Update copyright notices to 2018. (Contributed by projectgheist)
#rb none
#lockdown Nick.Penwarden

[CL 4070389 by Ben Marsh in Main branch]
2018-05-14 07:48:19 -04:00
Matt Kuhlenschmidt
68f4525e1b Merging //UE4/Dev-Main to Dev-Geometry (//UE4/Dev-Geometry)
#rb none

[CL 3889612 by Matt Kuhlenschmidt in Dev-Geometry branch]
2018-02-14 14:13:42 -05:00
Richard TalbotWatkin
1c06236042 Total revamp of mesh element attribute model.
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]
2017-12-07 13:02:12 -05:00
Mike Fricker
3b8eff823d Mesh Editor: UI improvements
- Renamed lots of UI text and tooltips to improve UX
- Hid the 'Propagate' and 'Per Instance' buttons until this feature is properly supported
- Flipped radio buttons so they're on top of 'instant' buttons
- Renamed 'Any' to 'Mesh' in the top level UI (meaning, 'any part of the mesh')
- Added group name title text for 'Mesh', 'Polygon', 'Edge', 'Vertex'
- Reversed order of top level buttons, removed 'Select' label
- 'Remove Subdivision Level' now greys out if there is nothing already subdivided
- Fixed lots of non-unity build issues

#codereview richard.talbotwatkin
#rb none

[CL 3509887 by Mike Fricker in Dev-Geometry branch]
2017-06-26 14:00:48 -04:00
Richard TalbotWatkin
ad239e6889 Copying //Tasks/UE4/Dev-Geometry-Refactor to Dev-Geometry (//UE4/Dev-Geometry)
CL 3365379:
Beginnings of 'uber mesh'. Moved mesh description across to UEditableMesh.  Renamed Rendering Vertices to Vertex Instances, they will form a fundamental part of the mesh description, in representing shared vertices.

CL 3365385:
Renamed Sections to PolygonGroups. This prevents confusion between editable mesh sections and rendering sections (from the static mesh). It also means we can potentially open up the concept of 'polygon groups' to represent more than static mesh sections if we wish to.

CL 3365387:
Removed FPolygonRef and flattened Polygons container. Added new methods to act on the entire Polygons container. Added RenderingPolygons, RenderingTriangles, RenderingPolygonGroups containers which will eventually live on the adapter, and which are solely involved in maintaining the render buffers. Fixed Quadrangulate so that it doesn't merge across polygon groups.

CL 3365390:
Started to remove virtuals from EditableMesh. First separation of ubermesh intrinsic properties from implementation details in EditableStaticMesh.

CL 3396167:
Picking out generic functionality from the _Internal methods, moving them into UEditableMesh code, ready to remove the inheritance entirely. Implemented adapter interface (currently living within UEditableStaticMesh) and calling into it from UEditableMesh.

Big revamp to handling of rendering vertices; now exist as vertex instances, which are dynamically shared / split, depending on whether colors / textures are identical. Normal/tangent is handled separately as it is autogenerated. Whether neighboring edges are hard or not determines whether a vertex will be automatically instanced, regardless of other attributes. We infer whether a vertex is 'hard' from whether the mesh is split by hard edges at that point (done by tracing adjacent polygons through only soft edges); hard vertices are always instanced for that poly. This simplifies the autogeneration of normals, as it now simply iterates through stale vertex instances, applying the weighted contribution from each connected polygon.  Polygon normals are now cached as a read-only attribute, to make this process even quicker.

Rewrite of the basic primitive operations (Create/Delete polygon / edges / vertices / vertex instances). Added a new primitive operation to substitute vertex instances on a polygon contour.  Setting edge hardness attribute now potentially instances or deletes vertex instances, as does setting vertex instance attributes.

CL 3396229:
Intermediate check-in (phase 2).

Removed a whole load of dead code. Broke functionality, until InitEditableStaticMesh is rewritten to use the public UEditableMesh API.

CL 3401798:
Intermediate check-in (phase 3).

Implemented a simple alternative to tangent basis generation as MikkTSpace doesn't quite fit our model currently (but with a view to revisiting it in the future; nothing has been removed for now).
Fixed edge hardness setting.
Added missing hash function for FVertexInstanceID.

CL 3403360:
Fixed some bugs in tangent/normal handling. Now correctly includes contributions from adjacent polygons in the same smoothing group but different vertex instance when calculating a vertex instance normal.

CL 3411429:
Fixed a bunch of bugs:
- Fixed issue where adjacent polygons the other side of a UV seam were not contributing to vertex instance normal calculation.
- Fixed various issues where out arrays weren't being reset, and mesh change actions were not being called after setting up the input array.
- Various changes to converting static meshes to editable meshes.
- Removed old ContourVertices arrays from polygon contours; now polygons exclusively use an array of vertex instances.
- Updated natvis to parse new element ID types.

CL 3418022:
More bug fixes:
- Sorted an issue with undo where vertex instance merging / splitting was happening twice, once due to the parent operation, and another time due to the revert transactions which are created.
- Added options to delete orphaned vertex instances in DeletePolygons and other operations which remove vertex instances.
- Fixed issue with SplitEdge due to subtle bug where connected edges were duplicated in a vertex, instead of being added uniquely.
- Changed order that undo items are added to the stack so that the revert operation works smoothly.

CL 3427887:
Fixed issue which occurs in certain circumstances with Split Edge.
Fixed regression which was causing various operations to fail when setting edge hardness.

CL 3430665:
Specify polygon edge hardness policy when creating a polygon. Simplified some existing uses of CreatePolygons. Changed behavior to match original behavior so that only *new* edge IDs are returned by CreatePolygons.

CL 3430927:
Corrected normal/tangent generation for polygons and adjacent polygons.

CL 3431134:
Fixed small issue with remove vertex in certain circumstances.

CL 3446929:
- Added a triangle list to the FMeshPolygon struct, making triangulation a first-class operation instead of an implementation detail.
- Repurposed UEditableStaticMesh as an editable mesh adapter, in a separate class hierarchy.
- Tidied up interfaces
- Moved serialization, compact/uncompact into UEditableMesh
- Currently broken: instance changes. This is pending a rethink on how we scope objects in the assets.

CL 3446954:
Renamed EditableStaticMesh.* to EditableStaticMeshAdapter.* to reflect its new role and place in the class hierarchy.

CL 3449133:
Fixed issue with splitting vertices due to the wrong polygon ID being used by GetPolygonsInSameSmoothingGroup. Also fixed an error where the list being iterated was potentially being mutated by the split operation.

CL 3449362:
Fixed ChangePolygonsVertexInstances to fix up the triangle list after replacing vertex instances. Not sure where this code went!

CL 3458823:
- Deferred normals calculation until the end of the transaction for efficiency
- Fixed a bug in inserting edge loops
- Fixed a bug in splitting vertex instances when hardening an edge
- Moved verbose logging into a LogEditableMesh category.

CL 3461128:
Included a bunch of required header files (IWYU).

CL 3464397:
Change to handling of triangulation and normal/tangent generation. Now this is done as a deferred process during EndTransaction. This achieves three goals:
 1) Polygons are not repeatedly triangulated unnecessarily as a consequence of suboperations.
 2) We are able to calculate and cache the polygon tangent basis upfront, which is then used for every connected vertex instance tangent basis - this is quickerthan repeatedly calculating it each time it's needed.
 3) We no longer need to treat triangulation or vertex generation as a special FChange. Instead it is rolled into the FStartOrEndTransaction change. Hence we can remove the awkward code which was triangulating polygons before or after other actions, depending on whether undo was being processed.
Note: seem to have introduced a bug which is getting the tangents subtly wrong in certain cases; need to investigate.

CL 3465738:
Fixed regression introduced in tangent calculations. Results now match previous version. Stripped out redundant code, and removed superfluous logging. When building the editable mesh, the tangent basis for all polygons is now precached.

CL 3465744:
Removed old debugging code.

CL 3472569:
Reinstated Compact (currently after every topology-changing transaction; will make it much more infrequent when I'm sure it works perfectly). Made some changes to fixing up element IDs. Added a new method in the Adapter interface to reindex elements on compact/uncompact.

CL 3476078:
Fixed issue when loading edited meshes. They now must always have their render mesh rebuilt on PostLoad. (This seems to arise from the way the circular dependency between Engine and MeshEditingRuntime has been resolved).

CL 3476104:
Reinstated instanced editable meshes.

CL 3484401:
Added missing file (EditableMeshAdapter.h)

CL 3484699:
Added new adapter method OnCreateEmptyVertexRange, now needed again by extrude (I removed this action, but Mike's new extrude requires it)

#codereview Mike.Fricker
#rb none

[CL 3490308 by Richard TalbotWatkin in Dev-Geometry branch]
2017-06-14 16:31:26 -04:00
Mike Fricker
7393418ddd Split Polygon: Don't split unless pointer is close to an edge or vertex
#rb none

[CL 3433801 by Mike Fricker in Dev-Geometry branch]
2017-05-10 17:14:38 -04:00
Mike Fricker
afdeb07c42 Split Polygon: Avoid creating colinear and degenerate triangles when splitting polygons
#rb none

[CL 3433530 by Mike Fricker in Dev-Geometry branch]
2017-05-10 16:00:26 -04:00
Mike Fricker
a2f51107dd Mesh Editor: Improved Split Polygon tool
- Split Polygon will now figure out the best split line based off the direction you drag from the starting edge or vertex
- Fixed issue where wrong vertex to connect to could be selected
- You can now connect to the end of an edge that is next to a disqualified vertex

#rb none

[CL 3433068 by Mike Fricker in Dev-Geometry branch]
2017-05-10 13:31:05 -04:00
Mike Fricker
799020ab55 Mesh Editor: Split Polygon
- Added first pass at new "Split Polygon" feature.
- You can select any mesh element, then click and drag to split an adjacent polygon by dragging to an opposing edge or vertex.
- Currently it uses the closest edge to the point the mouse is hovering over.  This will be improved in the future.
- Undo/Redo is fully supported.  Works in VR Mode, also.

#codereview richard.talbotwatkin
#rb none

[CL 3430404 by Mike Fricker in Dev-Geometry branch]
2017-05-09 09:44:26 -04:00