This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
animQuery.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_SKEL_ANIM_QUERY_H
8#define PXR_USD_USD_SKEL_ANIM_QUERY_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdSkel/api.h"
14
16#include "pxr/base/vt/types.h"
17
18#include "pxr/usd/sdf/path.h"
19#include "pxr/usd/usd/prim.h"
20#include "pxr/usd/usd/timeCode.h"
21
22
23PXR_NAMESPACE_OPEN_SCOPE
24
25
26class GfMatrix4d;
27class UsdAttribute;
28class UsdSkelCache;
29
30
31TF_DECLARE_REF_PTRS(UsdSkel_AnimQueryImpl);
32
33
38{
39public:
40 USDSKEL_API
42
44 bool IsValid() const { return (bool)_impl; }
45
47 explicit operator bool() const { return IsValid(); }
48
51 friend bool operator==(const UsdSkelAnimQuery& lhs,
52 const UsdSkelAnimQuery& rhs) {
53 return lhs.GetPrim() == rhs.GetPrim();
54 }
55
58 friend bool operator!=(const UsdSkelAnimQuery& lhs,
59 const UsdSkelAnimQuery& rhs) {
60 return !(lhs == rhs);
61 }
62
63 // hash_value overload for std/boost hash.
64 friend size_t hash_value(const UsdSkelAnimQuery& query) {
65 return hash_value(query.GetPrim());
66 }
67
69 USDSKEL_API
71
75 template <typename Matrix4>
76 USDSKEL_API
78 VtArray<Matrix4>* xforms,
80
85 USDSKEL_API
87 VtVec3fArray* translations,
88 VtQuatfArray* rotations,
89 VtVec3hArray* scales,
91
92 USDSKEL_API
93 bool ComputeBlendShapeWeights(
94 VtFloatArray* weights,
96
103 USDSKEL_API
104 bool GetJointTransformTimeSamples(std::vector<double>* times) const;
105
112 USDSKEL_API
114 std::vector<double>* times) const;
115
117 USDSKEL_API
118 bool GetJointTransformAttributes(std::vector<UsdAttribute>* attrs) const;
119
124 USDSKEL_API
126
131 USDSKEL_API
132 bool GetBlendShapeWeightTimeSamples(std::vector<double>* attrs) const;
133
138 USDSKEL_API
140 std::vector<double>* times) const;
141
143 USDSKEL_API
144 bool GetBlendShapeWeightAttributes(std::vector<UsdAttribute>* attrs) const;
145
151 USDSKEL_API
153
158 USDSKEL_API
159 VtTokenArray GetJointOrder() const;
160
163 USDSKEL_API
164 VtTokenArray GetBlendShapeOrder() const;
165
166 USDSKEL_API
167 std::string GetDescription() const;
168
169private:
170 UsdSkelAnimQuery(const UsdSkel_AnimQueryImplRefPtr& impl)
171 : _impl(impl) {}
172
173 UsdSkel_AnimQueryImplRefPtr _impl;
174
175 friend class UsdSkel_CacheImpl;
176};
177
178
179PXR_NAMESPACE_CLOSE_SCOPE
180
181#endif // PXR_USD_USD_SKEL_ANIM_QUERY_H
Defines all the types "TYPED" for which Vt creates a VtTYPEDArray typedef.
A basic mathematical interval class.
Definition: interval.h:33
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:160
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
Class providing efficient queries of primitives that provide skel animation.
Definition: animQuery.h:38
USDSKEL_API bool GetJointTransformTimeSamples(std::vector< double > *times) const
Get the time samples at which values contributing to joint transforms are set.
USDSKEL_API bool GetJointTransformTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Get the time samples at which values contributing to joint transforms are set, over interval.
USDSKEL_API VtTokenArray GetBlendShapeOrder() const
Returns an array of tokens describing the ordering of blend shape channels in the animation.
friend bool operator==(const UsdSkelAnimQuery &lhs, const UsdSkelAnimQuery &rhs)
Equality comparison.
Definition: animQuery.h:51
USDSKEL_API bool BlendShapeWeightsMightBeTimeVarying() const
Return true if it possible, but not certain, that the blend shape weights computed through this anima...
USDSKEL_API bool ComputeJointLocalTransforms(VtArray< Matrix4 > *xforms, UsdTimeCode time=UsdTimeCode::Default()) const
Compute joint transforms in joint-local space.
USDSKEL_API VtTokenArray GetJointOrder() const
Returns an array of tokens describing the ordering of joints in the animation.
USDSKEL_API UsdPrim GetPrim() const
Return the primitive this anim query reads from.
bool IsValid() const
Return true if this query is valid.
Definition: animQuery.h:44
USDSKEL_API bool JointTransformsMightBeTimeVarying() const
Return true if it possible, but not certain, that joint transforms computed through this animation ...
USDSKEL_API bool GetBlendShapeWeightAttributes(std::vector< UsdAttribute > *attrs) const
Get the attributes contributing to blendshape weight computations.
friend bool operator!=(const UsdSkelAnimQuery &lhs, const UsdSkelAnimQuery &rhs)
Inequality comparison.
Definition: animQuery.h:58
USDSKEL_API bool GetJointTransformAttributes(std::vector< UsdAttribute > *attrs) const
Get the attributes contributing to JointTransform computations.
USDSKEL_API bool ComputeJointLocalTransformComponents(VtVec3fArray *translations, VtQuatfArray *rotations, VtVec3hArray *scales, UsdTimeCode time=UsdTimeCode::Default()) const
Compute translation,rotation,scale components of the joint transforms in joint-local space.
USDSKEL_API bool GetBlendShapeWeightTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Get the time samples at which values contributing to blend shape weights are set, over interval.
USDSKEL_API bool GetBlendShapeWeightTimeSamples(std::vector< double > *attrs) const
Get the time samples at which values contributing to blend shape weights have been set.
Thread-safe cache for accessing query objects for evaluating skeletal data.
Definition: cache.h:41
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:67
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:95
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:211
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58