HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bindingSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_BINDING_SCHEMA_H
19 #define PXR_USD_IMAGING_USD_SKEL_IMAGING_BINDING_SCHEMA_H
20 
21 /// \file
22 
24 
25 #include "pxr/imaging/hd/schema.h"
26 
27 // --(BEGIN CUSTOM CODE: Includes)--
28 // --(END CUSTOM CODE: Includes)--
29 
31 
32 // --(BEGIN CUSTOM CODE: Declares)--
33 // --(END CUSTOM CODE: Declares)--
34 
35 #define USD_SKEL_IMAGING_BINDING_SCHEMA_TOKENS \
36  (skelBinding) \
37  (animationSource) \
38  (skeleton) \
39  (joints) \
40  (blendShapes) \
41  (blendShapeTargets) \
42  (hasSkelRoot) \
43  ((skinningMethodPrimvar, "skel:skinningMethod")) \
44  ((geomBindTransformPrimvar, "skel:geomBindTransform")) \
45  ((jointIndicesPrimvar, "skel:jointIndices")) \
46  ((jointWeightsPrimvar, "skel:jointWeights")) \
47 
48 TF_DECLARE_PUBLIC_TOKENS(UsdSkelImagingBindingSchemaTokens, USDSKELIMAGING_API,
50 
51 //-----------------------------------------------------------------------------
52 
53 // Corresponds to UsdSkelBindingAPI.
54 //
55 
57 {
58 public:
59  /// \name Schema retrieval
60  /// @{
61 
62  UsdSkelImagingBindingSchema(HdContainerDataSourceHandle container)
63  : HdSchema(container) {}
64 
65  /// Retrieves a container data source with the schema's default name token
66  /// "skelBinding" from the parent container and constructs a
67  /// UsdSkelImagingBindingSchema instance.
68  /// Because the requested container data source may not exist, the result
69  /// should be checked with IsDefined() or a bool comparison before use.
72  const HdContainerDataSourceHandle &fromParentContainer);
73 
74  /// @}
75 
76 // --(BEGIN CUSTOM CODE: Schema Methods)--
77 // --(END CUSTOM CODE: Schema Methods)--
78 
79  /// \name Member accessor
80  /// @{
81 
82  /// Note that in UsdSkel, the animation comes from the animationSource on
83  /// the Skeleton (which also carries the topology of the skeleton as
84  /// joints). This animationSource is either authored on the Skeleton
85  /// directly (and UsdSkelBindingAPI is applied) or inherited from an
86  /// ancestor of Skeleton (that has UsdSkelBindingAPI applied).
89 
92 
95 
96  /// This is not inherited according to the UsdSkel spec.
99 
100  /// This is not inherited according to the UsdSkel spec.
103 
104  /// Is this prim a descendant of a SkelRoot? Does not correspond to Usd
105  /// attribute and is actually populated by the SkelRoot and not the
106  /// SkelBinding.
109 
110  /// @}
111 
112  /// \name Schema location
113  /// @{
114 
115  /// Returns a token where the container representing this schema is found in
116  /// a container by default.
118  static const TfToken &GetSchemaToken();
119 
120  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
121  /// where the container representing this schema is found by default.
123  static const HdDataSourceLocator &GetDefaultLocator();
124 
125  /// @}
126 
127  /// \name Data source locators for members
128  ///
129  /// The following methods return an HdDataSourceLocator (relative to the
130  /// prim-level data source) where the data source for a member can be found.
131  ///
132  /// This is often useful for checking intersection against the
133  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
134  /// @{
135 
136  /// Prim-level relative data source locator to locate animationSource.
139 
140  /// Prim-level relative data source locator to locate skeleton.
142  static const HdDataSourceLocator &GetSkeletonLocator();
143 
144  /// Prim-level relative data source locator to locate joints.
146  static const HdDataSourceLocator &GetJointsLocator();
147 
148  /// Prim-level relative data source locator to locate blendShapes.
151 
152  /// Prim-level relative data source locator to locate blendShapeTargets.
155 
156  /// Prim-level relative data source locator to locate hasSkelRoot.
159  /// @}
160 
161  /// \name Schema construction
162  /// @{
163 
164  /// \deprecated Use Builder instead.
165  ///
166  /// Builds a container data source which includes the provided child data
167  /// sources. Parameters with nullptr values are excluded. This is a
168  /// low-level interface. For cases in which it's desired to define
169  /// the container with a sparse set of child fields, the Builder class
170  /// is often more convenient and readable.
172  static HdContainerDataSourceHandle
174  const HdPathDataSourceHandle &animationSource,
175  const HdPathDataSourceHandle &skeleton,
176  const HdTokenArrayDataSourceHandle &joints,
177  const HdTokenArrayDataSourceHandle &blendShapes,
178  const HdPathArrayDataSourceHandle &blendShapeTargets,
179  const HdBoolDataSourceHandle &hasSkelRoot
180  );
181 
182  /// \class UsdSkelImagingBindingSchema::Builder
183  ///
184  /// Utility class for setting sparse sets of child data source fields to be
185  /// filled as arguments into BuildRetained. Because all setter methods
186  /// return a reference to the instance, this can be used in the "builder
187  /// pattern" form.
188  class Builder
189  {
190  public:
193  const HdPathDataSourceHandle &animationSource);
196  const HdPathDataSourceHandle &skeleton);
199  const HdTokenArrayDataSourceHandle &joints);
202  const HdTokenArrayDataSourceHandle &blendShapes);
205  const HdPathArrayDataSourceHandle &blendShapeTargets);
208  const HdBoolDataSourceHandle &hasSkelRoot);
209 
210  /// Returns a container data source containing the members set thus far.
212  HdContainerDataSourceHandle Build();
213 
214  private:
215  HdPathDataSourceHandle _animationSource;
216  HdPathDataSourceHandle _skeleton;
218  HdTokenArrayDataSourceHandle _blendShapes;
219  HdPathArrayDataSourceHandle _blendShapeTargets;
220  HdBoolDataSourceHandle _hasSkelRoot;
221 
222  };
223 
224  /// @}
225 };
226 
228 
229 #endif
USDSKELIMAGING_API HdTokenArrayDataSourceHandle GetJoints() const
USDSKELIMAGING_API HdPathDataSourceHandle GetAnimationSource() const
USDSKELIMAGING_API Builder & SetSkeleton(const HdPathDataSourceHandle &skeleton)
HdPathArrayDataSource::Handle HdPathArrayDataSourceHandle
USDSKELIMAGING_API Builder & SetBlendShapes(const HdTokenArrayDataSourceHandle &blendShapes)
USDSKELIMAGING_API HdTokenArrayDataSourceHandle GetBlendShapes() const
This is not inherited according to the UsdSkel spec.
static USDSKELIMAGING_API HdContainerDataSourceHandle BuildRetained(const HdPathDataSourceHandle &animationSource, const HdPathDataSourceHandle &skeleton, const HdTokenArrayDataSourceHandle &joints, const HdTokenArrayDataSourceHandle &blendShapes, const HdPathArrayDataSourceHandle &blendShapeTargets, const HdBoolDataSourceHandle &hasSkelRoot)
UsdSkelImagingBindingSchema(HdContainerDataSourceHandle container)
Definition: bindingSchema.h:62
USDSKELIMAGING_API Builder & SetJoints(const HdTokenArrayDataSourceHandle &joints)
USDSKELIMAGING_API Builder & SetAnimationSource(const HdPathDataSourceHandle &animationSource)
static USDSKELIMAGING_API const TfToken & GetSchemaToken()
HdTokenArrayDataSource::Handle HdTokenArrayDataSourceHandle
Definition: token.h:70
TF_DECLARE_PUBLIC_TOKENS(UsdSkelImagingBindingSchemaTokens, USDSKELIMAGING_API, USD_SKEL_IMAGING_BINDING_SCHEMA_TOKENS)
USDSKELIMAGING_API Builder & SetHasSkelRoot(const HdBoolDataSourceHandle &hasSkelRoot)
HdBoolDataSource::Handle HdBoolDataSourceHandle
static USDSKELIMAGING_API const HdDataSourceLocator & GetAnimationSourceLocator()
Prim-level relative data source locator to locate animationSource.
USDSKELIMAGING_API Builder & SetBlendShapeTargets(const HdPathArrayDataSourceHandle &blendShapeTargets)
USDSKELIMAGING_API HdBoolDataSourceHandle GetHasSkelRoot() const
static USDSKELIMAGING_API const HdDataSourceLocator & GetBlendShapesLocator()
Prim-level relative data source locator to locate blendShapes.
#define USD_SKEL_IMAGING_BINDING_SCHEMA_TOKENS
Definition: bindingSchema.h:35
#define USDSKELIMAGING_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDSKELIMAGING_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
static USDSKELIMAGING_API const HdDataSourceLocator & GetHasSkelRootLocator()
Prim-level relative data source locator to locate hasSkelRoot.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static USDSKELIMAGING_API const HdDataSourceLocator & GetJointsLocator()
Prim-level relative data source locator to locate joints.
static USDSKELIMAGING_API const HdDataSourceLocator & GetSkeletonLocator()
Prim-level relative data source locator to locate skeleton.
static USDSKELIMAGING_API UsdSkelImagingBindingSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
USDSKELIMAGING_API HdPathDataSourceHandle GetSkeleton() const
USDSKELIMAGING_API HdPathArrayDataSourceHandle GetBlendShapeTargets() const
This is not inherited according to the UsdSkel spec.
HdPathDataSource::Handle HdPathDataSourceHandle
static USDSKELIMAGING_API const HdDataSourceLocator & GetDefaultLocator()
static USDSKELIMAGING_API const HdDataSourceLocator & GetBlendShapeTargetsLocator()
Prim-level relative data source locator to locate blendShapeTargets.