Navigation
API > API/Runtime > API/Runtime/GeometryCore
Description
Compact the values of an integer Triangle Attribute, ie so that the attribute values are dense in range 0..N. Useful for (eg) compacting MaterialIDs or Polygroups. Note that this function cannot tell if values were removed from the "end" of the attribute value list. Some care must be taken in calling code to handle this case if using this function to determine whether compaction of other data structures is needed. Currently OldToNewMapOut and NewToOldMapOut are always populated even if the input is compact.
| Name | UE::Geometry::CompactAttributeValues |
| Type | function |
| Header File | /Engine/Source/Runtime/GeometryCore/Public/DynamicMesh/MeshAttributeUtil.h |
| Include Path | #include "DynamicMesh/MeshAttributeUtil.h" |
| Source | /Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/MeshAttributeUtil.cpp |
namespace UE
{
namespace Geometry
{
bool UE::Geometry::CompactAttributeValues
(
const FDynamicMesh3 & Mesh,
TDynamicMeshScalarTriangleAttribute < int32 > & TriangleAttrib,
FInterval1i & OldMaxAttributeRangeOut,
int & NewMaxAttributeValueOut,
TArray < int32 > & OldToNewMapOut,
TArray < int32 > & NewToOldMapOut,
bool & bWasCompactOut
)
}
}
true on success (including if already compact). false if any Attribute Values were negative/InvalidID, cannot compact in this case
Parameters
| Name | Remarks |
|---|---|
| OldMaxAttributeRangeOut | min and max input attribute values, ie pre-compaction |
| NewMaxAttributeValueOut | new max attribute value after compacting. |
| OldToNewMapOut | generated mapping from previous IDs to new IDs (ie size is maximum input attrib value (+1), will contain InvalidID for any compacted values ) |
| NewToOldMapOut | generated mapping from new IDs to previous IDs (ie size is maximum output attribute value (+1), no invalid values) |
| bWasCompactOut | set to true if the attribute set was already compact, IE was not modified by the operation |