All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
animQuery.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_USD_SKEL_ANIM_QUERY_H
25 #define PXR_USD_USD_SKEL_ANIM_QUERY_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdSkel/api.h"
31 
33 #include "pxr/base/vt/types.h"
34 
35 #include "pxr/usd/sdf/path.h"
36 #include "pxr/usd/usd/prim.h"
37 #include "pxr/usd/usd/timeCode.h"
38 
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 
43 class GfMatrix4d;
44 class UsdAttribute;
45 class UsdSkelCache;
46 
47 
48 TF_DECLARE_REF_PTRS(UsdSkel_AnimQueryImpl);
49 
50 
55 {
56 public:
57  USDSKEL_API
58  UsdSkelAnimQuery() {}
59 
61  bool IsValid() const { return (bool)_impl; }
62 
64  explicit operator bool() const { return IsValid(); }
65 
68  friend bool operator==(const UsdSkelAnimQuery& lhs,
69  const UsdSkelAnimQuery& rhs) {
70  return lhs.GetPrim() == rhs.GetPrim();
71  }
72 
75  friend bool operator!=(const UsdSkelAnimQuery& lhs,
76  const UsdSkelAnimQuery& rhs) {
77  return !(lhs == rhs);
78  }
79 
80  // hash_value overload for std/boost hash.
81  friend size_t hash_value(const UsdSkelAnimQuery& query) {
82  return hash_value(query.GetPrim());
83  }
84 
86  USDSKEL_API
87  UsdPrim GetPrim() const;
88 
92  template <typename Matrix4>
93  USDSKEL_API
95  VtArray<Matrix4>* xforms,
96  UsdTimeCode time=UsdTimeCode::Default()) const;
97 
102  USDSKEL_API
104  VtVec3fArray* translations,
105  VtQuatfArray* rotations,
106  VtVec3hArray* scales,
107  UsdTimeCode time=UsdTimeCode::Default()) const;
108 
109  USDSKEL_API
110  bool ComputeBlendShapeWeights(
111  VtFloatArray* weights,
112  UsdTimeCode time=UsdTimeCode::Default()) const;
113 
120  USDSKEL_API
121  bool GetJointTransformTimeSamples(std::vector<double>* times) const;
122 
129  USDSKEL_API
131  std::vector<double>* times) const;
132 
134  USDSKEL_API
135  bool GetJointTransformAttributes(std::vector<UsdAttribute>* attrs) const;
136 
141  USDSKEL_API
143 
148  USDSKEL_API
149  bool GetBlendShapeWeightTimeSamples(std::vector<double>* attrs) const;
150 
155  USDSKEL_API
157  std::vector<double>* times) const;
158 
160  USDSKEL_API
161  bool GetBlendShapeWeightAttributes(std::vector<UsdAttribute>* attrs) const;
162 
168  USDSKEL_API
170 
175  USDSKEL_API
176  VtTokenArray GetJointOrder() const;
177 
180  USDSKEL_API
181  VtTokenArray GetBlendShapeOrder() const;
182 
183  USDSKEL_API
184  std::string GetDescription() const;
185 
186 private:
187  UsdSkelAnimQuery(const UsdSkel_AnimQueryImplRefPtr& impl)
188  : _impl(impl) {}
189 
190  UsdSkel_AnimQueryImplRefPtr _impl;
191 
192  friend class UsdSkel_CacheImpl;
193 };
194 
195 
196 PXR_NAMESPACE_CLOSE_SCOPE
197 
198 #endif // PXR_USD_USD_SKEL_ANIM_QUERY_H
USDSKEL_API VtTokenArray GetJointOrder() const
Returns an array of tokens describing the ordering of joints in the animation.
USDSKEL_API bool GetBlendShapeWeightAttributes(std::vector< UsdAttribute > *attrs) const
Get the attributes contributing to blendshape weight computations.
Standard pointer typedefs.
USDSKEL_API bool GetJointTransformTimeSamples(std::vector< double > *times) const
Get the time samples at which values contributing to joint transforms are set.
Thread-safe cache for accessing query objects for evaluating skeletal data.
Definition: cache.h:57
Class providing efficient queries of primitives that provide skel animation.
Definition: animQuery.h:54
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 bool GetJointTransformAttributes(std::vector< UsdAttribute > *attrs) const
Get the attributes contributing to JointTransform computations.
USDSKEL_API bool ComputeJointLocalTransforms(VtArray< Matrix4 > *xforms, UsdTimeCode time=UsdTimeCode::Default()) const
Compute joint transforms in joint-local space.
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
USDSKEL_API UsdPrim GetPrim() const
Return the primitive this anim query reads from.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
USDSKEL_API bool BlendShapeWeightsMightBeTimeVarying() const
Return true if it possible, but not certain, that the blend shape weights computed through this anima...
USDSKEL_API VtTokenArray GetBlendShapeOrder() const
Returns an array of tokens describing the ordering of blend shape channels in the animation...
USDSKEL_API bool JointTransformsMightBeTimeVarying() const
Return true if it possible, but not certain, that joint transforms computed through this animation qu...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:132
A basic mathematical interval class.
Definition: interval.h:50
friend bool operator==(const UsdSkelAnimQuery &lhs, const UsdSkelAnimQuery &rhs)
Equality comparison.
Definition: animQuery.h:68
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:229
Defines all the types &quot;TYPED&quot; for which Vt creates a VtTYPEDArray typedef.
friend bool operator!=(const UsdSkelAnimQuery &lhs, const UsdSkelAnimQuery &rhs)
Inequality comparison.
Definition: animQuery.h:75
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for &#39;default&#39;.
Definition: timeCode.h:113
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 GetBlendShapeWeightTimeSamples(std::vector< double > *attrs) const
Get the time samples at which values contributing to blend shape weights have been set...
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:75
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...
bool IsValid() const
Return true if this query is valid.
Definition: animQuery.h:61