Skip to content

Commit

Permalink
Check guards before calling deduplication functions
Browse files Browse the repository at this point in the history
DeduplicateAttributeValues and DeduplicatePointIds do not
exist in Draco builds that have attribute deduplication
disabled. So, we need to avoid calling these functions
if the feature macro is not present.

Fixes PixarAnimationStudios#1671

(Internal change: 2211625)
  • Loading branch information
sunyab authored and pixar-oss committed Jan 26, 2022
1 parent e6d4796 commit 18cb128
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pxr/usd/plugin/usdDraco/exportTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
#include "pxr/usd/usdGeom/mesh.h"
#include "pxr/base/vt/types.h"

#include <draco/core/macros.h>
#include <draco/mesh/mesh.h>


PXR_NAMESPACE_OPEN_SCOPE


bool UsdDracoExportTranslator::Translate(
const UsdGeomMesh &usdMesh,
draco::Mesh *dracoMesh,
Expand Down Expand Up @@ -365,9 +364,14 @@ void UsdDracoExportTranslator::_SetPointMapsToMesh() {
}

void UsdDracoExportTranslator::_Deduplicate() const {
#ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED
if (!_posOrder.HasPointAttribute())
_dracoMesh->DeduplicateAttributeValues();
#endif

#ifdef DRACO_ATTRIBUTE_INDICES_DEDUPLICATION_SUPPORTED
_dracoMesh->DeduplicatePointIds();
#endif
}

// Polygon reconstruction attribute is associated with every triangle corner and
Expand Down Expand Up @@ -408,5 +412,4 @@ inline bool UsdDracoExportTranslator::_IsNewEdge(
return triIndex != triCount - 1 && triCorner == 1;
}


PXR_NAMESPACE_CLOSE_SCOPE

0 comments on commit 18cb128

Please sign in to comment.