Loading...
Searching...
No Matches
UsdSkelBlendShapeQuery Class Reference

Helper class used to resolve blend shape weights, including inbetweens. More...

#include <blendShapeQuery.h>

Public Member Functions

USDSKEL_API UsdSkelBlendShapeQuery (const UsdSkelBindingAPI &binding)
 
bool IsValid () const
 Return true if this query is valid.
 
 operator bool () const
 Boolean conversion operator. Equivalent to IsValid().
 
const UsdPrimGetPrim () const
 Returns the prim the blend shapes apply to.
 
USDSKEL_API UsdSkelBlendShape GetBlendShape (size_t blendShapeIndex) const
 Returns the blend shape corresponding to blendShapeIndex.
 
USDSKEL_API UsdSkelInbetweenShape GetInbetween (size_t subShapeIndex) const
 Returns the inbetween shape corresponding to sub-shape i, if any.
 
USDSKEL_API size_t GetBlendShapeIndex (size_t subShapeIndex) const
 Returns the blend shape index corresponding to the i'th sub-shape.
 
size_t GetNumBlendShapes () const
 
size_t GetNumSubShapes () const
 
USDSKEL_API std::vector< VtIntArray > ComputeBlendShapePointIndices () const
 Compute an array holding the point indices of all shapes.
 
USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapePointOffsets () const
 Compute an array holding the point offsets of all sub-shapes.
 
USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapeNormalOffsets () const
 Compute an array holding the normal offsets of all sub-shapes.
 
USDSKEL_API bool ComputeSubShapeWeights (const TfSpan< const float > &weights, VtFloatArray *subShapeWeights, VtUIntArray *blendShapeIndices, VtUIntArray *subShapeIndices) const
 Compute the resolved weights for all sub-shapes bound to this prim.
 
USDSKEL_API bool ComputeFlattenedSubShapeWeights (const TfSpan< const float > &weights, VtFloatArray *subShapeWeights) const
 Compute a flattened array of weights for all sub-shapes.
 
USDSKEL_API bool ComputeDeformedPoints (const TfSpan< const float > subShapeWeights, const TfSpan< const unsigned > blendShapeIndices, const TfSpan< const unsigned > subShapeIndices, const std::vector< VtIntArray > &blendShapePointIndices, const std::vector< VtVec3fArray > &subShapePointOffsets, TfSpan< GfVec3f > points) const
 Deform points using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShapeIndices.
 
USDSKEL_API bool ComputeDeformedNormals (const TfSpan< const float > subShapeWeights, const TfSpan< const unsigned > blendShapeIndices, const TfSpan< const unsigned > subShapeIndices, const std::vector< VtIntArray > &blendShapePointIndices, const std::vector< VtVec3fArray > &subShapeNormalOffsets, TfSpan< GfVec3f > noramls) const
 Deform normals using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShapeIndices.
 
USDSKEL_API bool ComputePackedShapeTable (VtVec4fArray *offsets, VtVec2iArray *ranges) const
 Compute a packed shape table combining all sub-shapes.
 
USDSKEL_API std::string GetDescription () const
 

Detailed Description

Helper class used to resolve blend shape weights, including inbetweens.

Definition at line 49 of file blendShapeQuery.h.

Member Function Documentation

◆ ComputeBlendShapePointIndices()

USDSKEL_API std::vector< VtIntArray > ComputeBlendShapePointIndices ( ) const

Compute an array holding the point indices of all shapes.

This is indexed by the blendShapeIndices returned by ComputeSubShapes(). Since the pointIndices property of blend shapes is optional, some of the arrays may be empty.

◆ ComputeDeformedNormals()

USDSKEL_API bool ComputeDeformedNormals ( const TfSpan< const float >  subShapeWeights,
const TfSpan< const unsigned >  blendShapeIndices,
const TfSpan< const unsigned >  subShapeIndices,
const std::vector< VtIntArray > &  blendShapePointIndices,
const std::vector< VtVec3fArray > &  subShapeNormalOffsets,
TfSpan< GfVec3f noramls 
) const

Deform normals using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShapeIndices.

The blendShapePointIndices and blendShapeNormalOffsets arrays both provide the pre-computed normal offsets and indices of each sub-shape, as computed by ComputeBlendShapePointIndices() and ComputeSubShapeNormalOffsets(). This is equivalent to ComputeDeformedPoints(), except that the resulting points are normalized after deformation.

◆ ComputeDeformedPoints()

USDSKEL_API bool ComputeDeformedPoints ( const TfSpan< const float >  subShapeWeights,
const TfSpan< const unsigned >  blendShapeIndices,
const TfSpan< const unsigned >  subShapeIndices,
const std::vector< VtIntArray > &  blendShapePointIndices,
const std::vector< VtVec3fArray > &  subShapePointOffsets,
TfSpan< GfVec3f points 
) const

Deform points using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShapeIndices.

The blendShapePointIndices and blendShapePointOffsets arrays both provide the pre-computed point offsets and indices of each sub-shape, as computed by ComputeBlendShapePointIndices() and ComputeSubShapePointOffsets().

◆ ComputeFlattenedSubShapeWeights()

USDSKEL_API bool ComputeFlattenedSubShapeWeights ( const TfSpan< const float > &  weights,
VtFloatArray *  subShapeWeights 
) const

Compute a flattened array of weights for all sub-shapes.

◆ ComputePackedShapeTable()

USDSKEL_API bool ComputePackedShapeTable ( VtVec4fArray *  offsets,
VtVec2iArray *  ranges 
) const

Compute a packed shape table combining all sub-shapes.

This is intended to help encode blend shapes in a GPU-friendly form. The resulting offsets array holds contiguous runs of offsets for every point. The array holds all of the offsets of every blend shape for point 0, followed by the offset of every blend shape for point 1, and so forth. Offsets are stored as a GfVec4f. The first three components of each offset holds the actual offset value, while the last value holds the sub-shape index, as a float. The sub-shape index can be used to lookup a corresponding weight value in the 'subShapeWeights' array returned by ComputeSubShapeWeights.

◆ ComputeSubShapeNormalOffsets()

USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapeNormalOffsets ( ) const

Compute an array holding the normal offsets of all sub-shapes.

This includes offsets of both primary shapes – those stored directly on a BlendShape primitive – as well as those of inbetween shapes. This is indexed by the subShapeIndices returned by ComputeSubShapeWeights(). Normal offsets are optional. An empty array is stored for shapes that do not specify normal offsets.

◆ ComputeSubShapePointOffsets()

USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapePointOffsets ( ) const

Compute an array holding the point offsets of all sub-shapes.

This includes offsets of both primary shapes – those stored directly on a BlendShape primitive – as well as those of inbetween shapes. This is indexed by the subShapeIndices returned by ComputeSubShapeWeights().

◆ ComputeSubShapeWeights()

USDSKEL_API bool ComputeSubShapeWeights ( const TfSpan< const float > &  weights,
VtFloatArray *  subShapeWeights,
VtUIntArray *  blendShapeIndices,
VtUIntArray *  subShapeIndices 
) const

Compute the resolved weights for all sub-shapes bound to this prim.

The weights values are initial weight values, ordered according to the skel:blendShapeTargets relationship of the prim this query is associated with. If there are any inbetween shapes, a new set of weights is computed, providing weighting of the relevant inbetweens.

All computed arrays shared the same size. Elements of the same index identify which sub-shape of which blend shape a given weight value is mapped to.

◆ GetBlendShape()

USDSKEL_API UsdSkelBlendShape GetBlendShape ( size_t  blendShapeIndex) const

Returns the blend shape corresponding to blendShapeIndex.

◆ GetBlendShapeIndex()

USDSKEL_API size_t GetBlendShapeIndex ( size_t  subShapeIndex) const

Returns the blend shape index corresponding to the i'th sub-shape.

◆ GetInbetween()

USDSKEL_API UsdSkelInbetweenShape GetInbetween ( size_t  subShapeIndex) const

Returns the inbetween shape corresponding to sub-shape i, if any.

◆ GetNumBlendShapes()

size_t GetNumBlendShapes ( ) const
inline

Definition at line 75 of file blendShapeQuery.h.

◆ GetNumSubShapes()

size_t GetNumSubShapes ( ) const
inline

Definition at line 77 of file blendShapeQuery.h.

◆ GetPrim()

const UsdPrim & GetPrim ( ) const
inline

Returns the prim the blend shapes apply to.

Definition at line 64 of file blendShapeQuery.h.

◆ IsValid()

bool IsValid ( ) const
inline

Return true if this query is valid.

Definition at line 58 of file blendShapeQuery.h.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Boolean conversion operator. Equivalent to IsValid().

Definition at line 61 of file blendShapeQuery.h.


The documentation for this class was generated from the following file: