From 9a1bb17923d6b93c867448e3601d73fe7f269ed8 Mon Sep 17 00:00:00 2001 From: sgustafso Date: Sun, 23 Jun 2019 23:27:56 -0700 Subject: [PATCH] Changing 'pointIndices' attribute of BlendShape schema from uint[] to int[] This makes the property more consistent with other indexing properties in core schemas, at the expense of additional runtime boundary testing. Fixes #858 (Internal change: 1979602) --- pxr/usd/lib/usdSkel/blendShape.cpp | 20 +++++-- pxr/usd/lib/usdSkel/blendShape.h | 4 +- pxr/usd/lib/usdSkel/blendShapeQuery.cpp | 59 +++++++++++++------ pxr/usd/lib/usdSkel/blendShapeQuery.h | 4 +- pxr/usd/lib/usdSkel/generatedSchema.usda | 2 +- pxr/usd/lib/usdSkel/schema.usda | 2 +- .../baseline/blendshapes.baked.usda | 12 ++-- .../testUsdSkelBakeSkinning/blendshapes.usda | 12 ++-- pxr/usd/lib/usdSkel/utils.cpp | 10 ++-- pxr/usd/lib/usdSkel/utils.h | 2 +- pxr/usd/lib/usdSkel/wrapBlendShape.cpp | 2 +- pxr/usd/lib/usdSkel/wrapBlendShapeQuery.cpp | 2 +- 12 files changed, 82 insertions(+), 49 deletions(-) diff --git a/pxr/usd/lib/usdSkel/blendShape.cpp b/pxr/usd/lib/usdSkel/blendShape.cpp index 89369f1b09..d9ad87ee30 100644 --- a/pxr/usd/lib/usdSkel/blendShape.cpp +++ b/pxr/usd/lib/usdSkel/blendShape.cpp @@ -146,7 +146,7 @@ UsdAttribute UsdSkelBlendShape::CreatePointIndicesAttr(VtValue const &defaultValue, bool writeSparsely) const { return UsdSchemaBase::_CreateAttr(UsdSkelTokens->pointIndices, - SdfValueTypeNames->UIntArray, + SdfValueTypeNames->IntArray, /* custom = */ false, SdfVariabilityUniform, defaultValue, @@ -265,12 +265,20 @@ UsdSkelBlendShape::ValidatePointIndices(TfSpan indices, std::string* reason) { for (size_t i = 0; i < indices.size(); ++i) { - const unsigned pointIndex = indices[i]; - if (pointIndex >= numPoints) { + const int pointIndex = indices[i]; + if (pointIndex >= 0) { + if (ARCH_UNLIKELY(static_cast(pointIndex) >= numPoints)) { + if (reason) { + *reason = TfStringPrintf( + "Index [%d] at element %td >= numPoints [%zu]", + pointIndex, i, numPoints); + } + return false; + } + } else { if (reason) { - *reason = TfStringPrintf( - "Index [%d] at element %td >= numPoints [%zu]", - pointIndex, i, numPoints); + *reason = TfStringPrintf("Index [%d] at element %td < 0", + pointIndex, i); } return false; } diff --git a/pxr/usd/lib/usdSkel/blendShape.h b/pxr/usd/lib/usdSkel/blendShape.h index 6b3d7360a4..1dd7890bd4 100644 --- a/pxr/usd/lib/usdSkel/blendShape.h +++ b/pxr/usd/lib/usdSkel/blendShape.h @@ -209,8 +209,8 @@ class UsdSkelBlendShape : public UsdTyped /// authored, the number of elements must be equal to the number of elements /// in the *offsets* array. /// - /// \n C++ Type: VtArray - /// \n Usd Type: SdfValueTypeNames->UIntArray + /// \n C++ Type: VtArray + /// \n Usd Type: SdfValueTypeNames->IntArray /// \n Variability: SdfVariabilityUniform /// \n Fallback Value: No Fallback USDSKEL_API diff --git a/pxr/usd/lib/usdSkel/blendShapeQuery.cpp b/pxr/usd/lib/usdSkel/blendShapeQuery.cpp index bd8da72429..77dc36deea 100644 --- a/pxr/usd/lib/usdSkel/blendShapeQuery.cpp +++ b/pxr/usd/lib/usdSkel/blendShapeQuery.cpp @@ -149,10 +149,10 @@ UsdSkelBlendShapeQuery::GetBlendShapeIndex(size_t subShapeIndex) const -std::vector +std::vector UsdSkelBlendShapeQuery::ComputeBlendShapePointIndices() const { - std::vector indices(_blendShapes.size()); + std::vector indices(_blendShapes.size()); WorkParallelForN( _blendShapes.size(), @@ -163,7 +163,27 @@ UsdSkelBlendShapeQuery::ComputeBlendShapePointIndices() const // XXX: Some null blend shapes may be stored on _blendShapes // to preserve the 'blendShapeTargets' order. if (blendShape.shape) { - blendShape.shape.GetPointIndicesAttr().Get(&indices[i]); + VtValue val; + if (blendShape.shape.GetPointIndicesAttr().Get(&val)) { + if (val.IsHolding()) { + indices[i] = val.UncheckedGet(); + } else if (val.IsHolding()) { + // Backwards-compatibility: + // pointIndices used to be a uint[], + // but was changed to a int[]. + // Convert the old value type. + const VtUIntArray& uindices = + val.UncheckedGet(); + indices[i].resize(uindices.size()); + + auto dst = TfMakeSpan(indices[i]); + for (size_t i = 0; i < dst.size(); ++i) { + const unsigned index = uindices[i]; + dst[i] = index >= 0 ? + static_cast(index) : 0; + } + } + } } } }); @@ -346,7 +366,7 @@ UsdSkelBlendShapeQuery::ComputeDeformedPoints( const TfSpan subShapeWeights, const TfSpan blendShapeIndices, const TfSpan subShapeIndices, - const std::vector& blendShapePointIndices, + const std::vector& blendShapePointIndices, const std::vector& subShapePointOffsets, TfSpan points) const { @@ -418,30 +438,30 @@ _ComputeRangesFromCounts(const TfSpan& counts, /// sufficient to satisfy the given shapes. size_t _ComputeApproximateNumPointsForShapes( - const std::vector& indicesPerBlendShape, + const std::vector& indicesPerBlendShape, const std::vector& offsetsPerSubShape) { // Get the max index across all of the shapes. - unsigned maxIndex = + int maxIndex = WorkParallelReduceN( 0, indicesPerBlendShape.size(), - [&indicesPerBlendShape](size_t start, size_t end, unsigned init) { - for (auto i = start; i < end; ++i) { - for (auto index : indicesPerBlendShape[i]) { + [&indicesPerBlendShape](size_t start, size_t end, int init) { + for (size_t i = start; i < end; ++i) { + for (int index : indicesPerBlendShape[i]) { init = std::max(init, index); } } return init; }, - [](unsigned lhs, unsigned rhs) { + [](int lhs, int rhs) { return std::max(lhs, rhs); }); // Also take the sizes of sub-shapes into account, for non-indexed shapes. for (const auto& offsets : offsetsPerSubShape) { - maxIndex = std::max(maxIndex, static_cast(offsets.size())); + maxIndex = std::max(maxIndex, static_cast(offsets.size())); } - return maxIndex + 1; + return maxIndex > 0 ? maxIndex + 1 : 0; } @@ -462,7 +482,7 @@ UsdSkelBlendShapeQuery::ComputePackedShapeTable( return false; } - const std::vector indicesPerBlendShape = + const std::vector indicesPerBlendShape = ComputeBlendShapePointIndices(); const std::vector offsetsPerSubShape = @@ -501,8 +521,10 @@ UsdSkelBlendShapeQuery::ComputePackedShapeTable( } } else { // Blend shape is sparse. Only increment indexed points. - for (const unsigned index : indices) { - TF_AXIOM(index < numOffsetsPerPoint.size()); + for (const int index : indices) { + TF_DEV_AXIOM(index >= 0 && + static_cast(index) < + numOffsetsPerPoint.size()); numOffsetsPerPoint[index] += numSubShapes; } } @@ -545,7 +567,7 @@ UsdSkelBlendShapeQuery::ComputePackedShapeTable( for (size_t pi = 0; pi < offsets.size(); ++pi) { const GfVec3f& offset = offsets[pi]; - TF_AXIOM(pi < nextOffsetIndexPerPoint.size()); + TF_DEV_AXIOM(pi < nextOffsetIndexPerPoint.size()); const unsigned offsetIndex = nextOffsetIndexPerPoint[pi]; dst[offsetIndex] = GfVec4f(offset[0], offset[1], offset[2], @@ -556,7 +578,10 @@ UsdSkelBlendShapeQuery::ComputePackedShapeTable( } else { // Must take indices into account. for (size_t j = 0; j < indices.size(); ++j) { - const unsigned pointIndex = indices[j]; + const int pointIndex = indices[j]; + TF_DEV_AXIOM(pointIndex >= 0 && + static_cast(pointIndex) < + nextOffsetIndexPerPoint.size()); const GfVec3f& offset = offsets[j]; diff --git a/pxr/usd/lib/usdSkel/blendShapeQuery.h b/pxr/usd/lib/usdSkel/blendShapeQuery.h index 05a519ed77..3fde921296 100644 --- a/pxr/usd/lib/usdSkel/blendShapeQuery.h +++ b/pxr/usd/lib/usdSkel/blendShapeQuery.h @@ -81,7 +81,7 @@ class UsdSkelBlendShapeQuery /// ComputeSubShapes(). /// Since the _pointIndices_ property of blend shapes is optional, /// some of the arrays may be empty. - USDSKEL_API std::vector + USDSKEL_API std::vector ComputeBlendShapePointIndices() const; /// Compute an array holding the point offsets of all sub-shapes. @@ -124,7 +124,7 @@ class UsdSkelBlendShapeQuery const TfSpan subShapeWeights, const TfSpan blendShapeIndices, const TfSpan subShapeIndices, - const std::vector& blendShapePointIndices, + const std::vector& blendShapePointIndices, const std::vector& subShapePointOffsets, TfSpan points) const; diff --git a/pxr/usd/lib/usdSkel/generatedSchema.usda b/pxr/usd/lib/usdSkel/generatedSchema.usda index fa37a112a7..c0b9ab463b 100644 --- a/pxr/usd/lib/usdSkel/generatedSchema.usda +++ b/pxr/usd/lib/usdSkel/generatedSchema.usda @@ -405,7 +405,7 @@ class BlendShape "BlendShape" ( doc = """**Required property**. Position offsets which, when added to the base pose, provides the target shape.""" ) - uniform uint[] pointIndices ( + uniform int[] pointIndices ( doc = """**Optional property**. Indices into the original mesh that correspond to the values in *offsets* and of any inbetween shapes. If authored, the number of elements must be equal to the number of elements diff --git a/pxr/usd/lib/usdSkel/schema.usda b/pxr/usd/lib/usdSkel/schema.usda index 016fffb78f..c12dc56216 100644 --- a/pxr/usd/lib/usdSkel/schema.usda +++ b/pxr/usd/lib/usdSkel/schema.usda @@ -279,7 +279,7 @@ class BlendShape "BlendShape" ( base pose, provides the normals of the target shape.""" ) - uniform uint[] pointIndices ( + uniform int[] pointIndices ( doc = """**Optional property**. Indices into the original mesh that correspond to the values in *offsets* and of any inbetween shapes. If authored, the number of elements must be equal to the number of elements diff --git a/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/baseline/blendshapes.baked.usda b/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/baseline/blendshapes.baked.usda index 57c49ba05a..4834a83ad7 100644 --- a/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/baseline/blendshapes.baked.usda +++ b/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/baseline/blendshapes.baked.usda @@ -548,13 +548,13 @@ def Xform "TestPlane" def BlendShape "targetA" { uniform vector3f[] offsets = [(0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 88, 89, 91, 92, 99, 100, 102, 103, 110, 111, 113, 114] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 88, 89, 91, 92, 99, 100, 102, 103, 110, 111, 113, 114] } def BlendShape "targetB" { uniform vector3f[] offsets = [(0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0)] - uniform uint[] pointIndices = [0, 1, 3, 4, 11, 12, 14, 15, 22, 23, 25, 26, 33, 34, 36, 37, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120] + uniform int[] pointIndices = [0, 1, 3, 4, 11, 12, 14, 15, 22, 23, 25, 26, 33, 34, 36, 37, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120] } def BlendShape "targetC" @@ -566,7 +566,7 @@ def Xform "TestPlane" weight = 1.5 ) uniform vector3f[] offsets = [(-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, -1.6621925e-8), (-8, 10.999964, -2.8394425e-9), (-9, 10, 0), (-10, 9.000036, 2.8394425e-9), (-11, 8.0000725, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetD" @@ -575,7 +575,7 @@ def Xform "TestPlane" weight = 0.5 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetE" @@ -584,7 +584,7 @@ def Xform "TestPlane" weight = 1.5 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetF" @@ -593,7 +593,7 @@ def Xform "TestPlane" weight = -0.499 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115] } } diff --git a/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/blendshapes.usda b/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/blendshapes.usda index 7d39b1fc86..bf60bd320f 100644 --- a/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/blendshapes.usda +++ b/pxr/usd/lib/usdSkel/testenv/testUsdSkelBakeSkinning/blendshapes.usda @@ -285,13 +285,13 @@ def SkelRoot "TestPlane" def BlendShape "targetA" { uniform vector3f[] offsets = [(0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 11.999916, 0), (0, 11.999958, 0), (0, 12, 0), (0, 12.000042, 0), (0, 12.000084, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, 12, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0), (0, -0.00007343292, 0), (0, -0.00004720688, 0), (0, 0.00004196167, 0), (0, 0.00008392334, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 88, 89, 91, 92, 99, 100, 102, 103, 110, 111, 113, 114] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 88, 89, 91, 92, 99, 100, 102, 103, 110, 111, 113, 114] } def BlendShape "targetB" { uniform vector3f[] offsets = [(0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -0.00006341934, 0), (0, -0.000040769577, 0), (0, 0.000036239624, 0), (0, 0.00007247925, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12.0000725, 0), (0, -12.000036, 0), (0, -12, 0), (0, -11.999964, 0), (0, -11.9999275, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0), (0, -12, 0)] - uniform uint[] pointIndices = [0, 1, 3, 4, 11, 12, 14, 15, 22, 23, 25, 26, 33, 34, 36, 37, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120] + uniform int[] pointIndices = [0, 1, 3, 4, 11, 12, 14, 15, 22, 23, 25, 26, 33, 34, 36, 37, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120] } def BlendShape "targetC" @@ -303,7 +303,7 @@ def SkelRoot "TestPlane" weight = 1.5 ) uniform vector3f[] offsets = [(-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, -1.6621925e-8), (-8, 10.999964, -2.8394425e-9), (-9, 10, 0), (-10, 9.000036, 2.8394425e-9), (-11, 8.0000725, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.9999275, 0), (-8, 10.999964, 0), (-9, 10, 0), (-10, 9.000036, 0), (-11, 8.0000725, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetD" @@ -312,7 +312,7 @@ def SkelRoot "TestPlane" weight = 0.5 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetE" @@ -321,7 +321,7 @@ def SkelRoot "TestPlane" weight = 1.5 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117] } def BlendShape "targetF" @@ -330,7 +330,7 @@ def SkelRoot "TestPlane" weight = -0.499 ) uniform vector3f[] offsets = [(-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, -1.6621925e-8), (-8, 10.999981, -2.8394425e-9), (-9, 10, 0), (-10, 9.000019, 2.8394425e-9), (-11, 8.000038, 1.0568328e-8), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, -5.9604645e-8), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0), (-7, 11.999962, 0), (-8, 10.999981, 0), (-9, 10, 0), (-10, 9.000019, 0), (-11, 8.000038, 0), (0, 0, 0)] - uniform uint[] pointIndices = [0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115] + uniform int[] pointIndices = [0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115] } } diff --git a/pxr/usd/lib/usdSkel/utils.cpp b/pxr/usd/lib/usdSkel/utils.cpp index 1c7ad46097..59a7d0b059 100644 --- a/pxr/usd/lib/usdSkel/utils.cpp +++ b/pxr/usd/lib/usdSkel/utils.cpp @@ -1656,7 +1656,7 @@ namespace { bool UsdSkel_ApplyIndexedBlendShape(const float weight, const TfSpan offsets, - const TfSpan indices, + const TfSpan indices, TfSpan points) { TRACE_FUNCTION(); @@ -1669,8 +1669,8 @@ UsdSkel_ApplyIndexedBlendShape(const float weight, [&](size_t start, size_t end) { for (size_t i = start; i < end; ++i) { - const unsigned index = indices[i]; - if (static_cast(index) < points.size()) { + const int index = indices[i]; + if (index >= 0 && static_cast(index) < points.size()) { points[index] += offsets[i]*weight; } else { // XXX: If one offset index is bad, an asset has probably @@ -1713,7 +1713,7 @@ UsdSkel_ApplyNonIndexedBlendShape(const float weight, bool UsdSkelApplyBlendShape(const float weight, const TfSpan offsets, - const TfSpan indices, + const TfSpan indices, TfSpan points) { // Early out if weights are zero. @@ -1951,7 +1951,7 @@ _BakeSkinnedPoints(const UsdPrim& prim, const UsdSkelBindingAPI binding(prim); const UsdSkelBlendShapeQuery blendShapeQuery(binding); // Cache the offsets and point indices of all blend shapes. - const std::vector blendShapePointIndices = + const std::vector blendShapePointIndices = blendShapeQuery.ComputeBlendShapePointIndices(); const std::vector subShapePointOffsets = blendShapeQuery.ComputeSubShapePointOffsets(); diff --git a/pxr/usd/lib/usdSkel/utils.h b/pxr/usd/lib/usdSkel/utils.h index dbd9cad2fe..1d5fb32a24 100644 --- a/pxr/usd/lib/usdSkel/utils.h +++ b/pxr/usd/lib/usdSkel/utils.h @@ -599,7 +599,7 @@ USDSKEL_API bool UsdSkelApplyBlendShape(const float weight, const TfSpan offsets, - const TfSpan indices, + const TfSpan indices, TfSpan points); diff --git a/pxr/usd/lib/usdSkel/wrapBlendShape.cpp b/pxr/usd/lib/usdSkel/wrapBlendShape.cpp index 61c08f2061..5f7cff2858 100644 --- a/pxr/usd/lib/usdSkel/wrapBlendShape.cpp +++ b/pxr/usd/lib/usdSkel/wrapBlendShape.cpp @@ -67,7 +67,7 @@ static UsdAttribute _CreatePointIndicesAttr(UsdSkelBlendShape &self, object defaultVal, bool writeSparsely) { return self.CreatePointIndicesAttr( - UsdPythonToSdfType(defaultVal, SdfValueTypeNames->UIntArray), writeSparsely); + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->IntArray), writeSparsely); } } // anonymous namespace diff --git a/pxr/usd/lib/usdSkel/wrapBlendShapeQuery.cpp b/pxr/usd/lib/usdSkel/wrapBlendShapeQuery.cpp index 6bfab4fcb4..6edc219bb7 100644 --- a/pxr/usd/lib/usdSkel/wrapBlendShapeQuery.cpp +++ b/pxr/usd/lib/usdSkel/wrapBlendShapeQuery.cpp @@ -75,7 +75,7 @@ _ComputeDeformedPoints(const UsdSkelBlendShapeQuery& self, { return self.ComputeDeformedPoints( subShapeWeights, blendShapeIndices, subShapeIndices, - _PyListToVector(blendShapePointIndices), + _PyListToVector(blendShapePointIndices), _PyListToVector(subShapePointOffsets), points); }