HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniProceduralAPI.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 USDHOUDINI_GENERATED_HOUDINIPROCEDURALAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINIPROCEDURALAPI_H
9 
10 /// \file usdHoudini/houdiniProceduralAPI.h
11 
12 #include "pxr/pxr.h"
13 #include "./api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "./tokens.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // HOUDINIPROCEDURALAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniProceduralAPI
37 ///
38 ///
39 class
42 {
43 public:
44  /// Compile time constant representing what kind of schema this class is.
45  ///
46  /// \sa UsdSchemaKind
48 
49  /// Construct a UsdHoudiniHoudiniProceduralAPI on UsdPrim \p prim with
50  /// name \p name . Equivalent to
51  /// UsdHoudiniHoudiniProceduralAPI::Get(
52  /// prim.GetStage(),
53  /// prim.GetPath().AppendProperty(
54  /// "houdiniProcedural:name"));
55  ///
56  /// for a \em valid \p prim, but will not immediately throw an error for
57  /// an invalid \p prim
59  const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken())
60  : UsdAPISchemaBase(prim, /*instanceName*/ name)
61  { }
62 
63  /// Construct a UsdHoudiniHoudiniProceduralAPI on the prim held by \p schemaObj with
64  /// name \p name. Should be preferred over
65  /// UsdHoudiniHoudiniProceduralAPI(schemaObj.GetPrim(), name), as it preserves
66  /// SchemaBase state.
68  const UsdSchemaBase& schemaObj, const TfToken &name)
69  : UsdAPISchemaBase(schemaObj, /*instanceName*/ name)
70  { }
71 
72  /// Destructor.
73  virtual ~UsdHoudiniHoudiniProceduralAPI() override;
74 
75  /// Return a vector of names of all pre-declared attributes for this schema
76  /// class and all its ancestor classes. Does not include attributes that
77  /// may be authored by custom/extended methods of the schemas involved.
78  static const TfTokenVector &
79  GetSchemaAttributeNames(bool includeInherited=true);
80 
81  /// Return a vector of names of all pre-declared attributes for this schema
82  /// class and all its ancestor classes for a given instance name. Does not
83  /// include attributes that may be authored by custom/extended methods of
84  /// the schemas involved. The names returned will have the proper namespace
85  /// prefix.
86  static TfTokenVector
87  GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName);
88 
89  /// Returns the name of this multiple-apply schema instance
90  TfToken GetName() const {
91  return _GetInstanceName();
92  }
93 
94  /// Return a UsdHoudiniHoudiniProceduralAPI holding the prim adhering to this
95  /// schema at \p path on \p stage. If no prim exists at \p path on
96  /// \p stage, or if the prim at that path does not adhere to this schema,
97  /// return an invalid schema object. \p path must be of the format
98  /// <path>.houdiniProcedural:name .
99  ///
100  /// This is shorthand for the following:
101  ///
102  /// \code
103  /// TfToken name = SdfPath::StripNamespace(path.GetToken());
104  /// UsdHoudiniHoudiniProceduralAPI(
105  /// stage->GetPrimAtPath(path.GetPrimPath()), name);
106  /// \endcode
107  ///
109  Get(const UsdStagePtr &stage, const SdfPath &path);
110 
111  /// Return a UsdHoudiniHoudiniProceduralAPI with name \p name holding the
112  /// prim \p prim. Shorthand for UsdHoudiniHoudiniProceduralAPI(prim, name);
114  Get(const UsdPrim &prim, const TfToken &name);
115 
116  /// Return a vector of all named instances of UsdHoudiniHoudiniProceduralAPI on the
117  /// given \p prim.
118  static std::vector<UsdHoudiniHoudiniProceduralAPI>
119  GetAll(const UsdPrim &prim);
120 
121  /// Checks if the given name \p baseName is the base name of a property
122  /// of HoudiniProceduralAPI.
123  static bool
124  IsSchemaPropertyBaseName(const TfToken &baseName);
125 
126  /// Checks if the given path \p path is of an API schema of type
127  /// HoudiniProceduralAPI. If so, it stores the instance name of
128  /// the schema in \p name and returns true. Otherwise, it returns false.
129  static bool
130  IsHoudiniProceduralAPIPath(const SdfPath &path, TfToken *name);
131 
132  /// Returns true if this <b>multiple-apply</b> API schema can be applied,
133  /// with the given instance name, \p name, to the given \p prim. If this
134  /// schema can not be a applied the prim, this returns false and, if
135  /// provided, populates \p whyNot with the reason it can not be applied.
136  ///
137  /// Note that if CanApply returns false, that does not necessarily imply
138  /// that calling Apply will fail. Callers are expected to call CanApply
139  /// before calling Apply if they want to ensure that it is valid to
140  /// apply a schema.
141  ///
142  /// \sa UsdPrim::GetAppliedSchemas()
143  /// \sa UsdPrim::HasAPI()
144  /// \sa UsdPrim::CanApplyAPI()
145  /// \sa UsdPrim::ApplyAPI()
146  /// \sa UsdPrim::RemoveAPI()
147  ///
148  static bool
149  CanApply(const UsdPrim &prim, const TfToken &name,
150  std::string *whyNot=nullptr);
151 
152  /// Applies this <b>multiple-apply</b> API schema to the given \p prim
153  /// along with the given instance name, \p name.
154  ///
155  /// This information is stored by adding "HoudiniProceduralAPI:<i>name</i>"
156  /// to the token-valued, listOp metadata \em apiSchemas on the prim.
157  /// For example, if \p name is 'instance1', the token
158  /// 'HoudiniProceduralAPI:instance1' is added to 'apiSchemas'.
159  ///
160  /// \return A valid UsdHoudiniHoudiniProceduralAPI object is returned upon success.
161  /// An invalid (or empty) UsdHoudiniHoudiniProceduralAPI object is returned upon
162  /// failure. See \ref UsdPrim::ApplyAPI() for
163  /// conditions resulting in failure.
164  ///
165  /// \sa UsdPrim::GetAppliedSchemas()
166  /// \sa UsdPrim::HasAPI()
167  /// \sa UsdPrim::CanApplyAPI()
168  /// \sa UsdPrim::ApplyAPI()
169  /// \sa UsdPrim::RemoveAPI()
170  ///
172  Apply(const UsdPrim &prim, const TfToken &name);
173 
174 protected:
175  /// Returns the kind of schema this class belongs to.
176  ///
177  /// \sa UsdSchemaKind
178  UsdSchemaKind _GetSchemaKind() const override;
179 
180 private:
181  // needs to invoke _GetStaticTfType.
182  friend class UsdSchemaRegistry;
183  static const TfType &_GetStaticTfType();
184 
185  static bool _IsTypedSchema();
186 
187  // override SchemaBase virtuals.
188  const TfType &_GetTfType() const override;
189 
190 public:
191  // --------------------------------------------------------------------- //
192  // HOUDINIPROCEDURALTYPE
193  // --------------------------------------------------------------------- //
194  ///
195  ///
196  /// | ||
197  /// | -- | -- |
198  /// | Declaration | `string houdini:procedural:type = ""` |
199  /// | C++ Type | std::string |
200  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
201  UsdAttribute GetHoudiniProceduralTypeAttr() const;
202 
203  /// See GetHoudiniProceduralTypeAttr(), and also
204  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
205  /// If specified, author \p defaultValue as the attribute's default,
206  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
207  /// the default for \p writeSparsely is \c false.
208  UsdAttribute CreateHoudiniProceduralTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
209 
210 public:
211  // --------------------------------------------------------------------- //
212  // HOUDINIPROCEDURALPATH
213  // --------------------------------------------------------------------- //
214  ///
215  ///
216  /// | ||
217  /// | -- | -- |
218  /// | Declaration | `asset houdini:procedural:path = @@` |
219  /// | C++ Type | SdfAssetPath |
220  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Asset |
221  UsdAttribute GetHoudiniProceduralPathAttr() const;
222 
223  /// See GetHoudiniProceduralPathAttr(), and also
224  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
225  /// If specified, author \p defaultValue as the attribute's default,
226  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
227  /// the default for \p writeSparsely is \c false.
228  UsdAttribute CreateHoudiniProceduralPathAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
229 
230 public:
231  // --------------------------------------------------------------------- //
232  // HOUDINIPROCEDURALARGS
233  // --------------------------------------------------------------------- //
234  ///
235  ///
236  /// | ||
237  /// | -- | -- |
238  /// | Declaration | `string houdini:procedural:args = ""` |
239  /// | C++ Type | std::string |
240  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
241  UsdAttribute GetHoudiniProceduralArgsAttr() const;
242 
243  /// See GetHoudiniProceduralArgsAttr(), and also
244  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
245  /// If specified, author \p defaultValue as the attribute's default,
246  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
247  /// the default for \p writeSparsely is \c false.
248  UsdAttribute CreateHoudiniProceduralArgsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
249 
250 public:
251  // --------------------------------------------------------------------- //
252  // HOUDINIACTIVE
253  // --------------------------------------------------------------------- //
254  ///
255  ///
256  /// | ||
257  /// | -- | -- |
258  /// | Declaration | `bool houdini:active = 1` |
259  /// | C++ Type | bool |
260  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
261  UsdAttribute GetHoudiniActiveAttr() const;
262 
263  /// See GetHoudiniActiveAttr(), and also
264  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
265  /// If specified, author \p defaultValue as the attribute's default,
266  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
267  /// the default for \p writeSparsely is \c false.
268  UsdAttribute CreateHoudiniActiveAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
269 
270 public:
271  // --------------------------------------------------------------------- //
272  // HOUDINIPRIORITY
273  // --------------------------------------------------------------------- //
274  ///
275  ///
276  /// | ||
277  /// | -- | -- |
278  /// | Declaration | `int houdini:priority = 0` |
279  /// | C++ Type | int |
280  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
281  UsdAttribute GetHoudiniPriorityAttr() const;
282 
283  /// See GetHoudiniPriorityAttr(), and also
284  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
285  /// If specified, author \p defaultValue as the attribute's default,
286  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
287  /// the default for \p writeSparsely is \c false.
288  UsdAttribute CreateHoudiniPriorityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
289 
290 public:
291  // --------------------------------------------------------------------- //
292  // HOUDINIANIMATED
293  // --------------------------------------------------------------------- //
294  ///
295  ///
296  /// | ||
297  /// | -- | -- |
298  /// | Declaration | `uniform bool houdini:animated = 0` |
299  /// | C++ Type | bool |
300  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
301  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
302  UsdAttribute GetHoudiniAnimatedAttr() const;
303 
304  /// See GetHoudiniAnimatedAttr(), and also
305  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
306  /// If specified, author \p defaultValue as the attribute's default,
307  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
308  /// the default for \p writeSparsely is \c false.
309  UsdAttribute CreateHoudiniAnimatedAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
310 
311 public:
312  // ===================================================================== //
313  // Feel free to add custom code below this line, it will be preserved by
314  // the code generator.
315  //
316  // Just remember to:
317  // - Close the class declaration with };
318  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
319  // - Close the include guard with #endif
320  // ===================================================================== //
321  // --(BEGIN CUSTOM CODE)--
322 };
323 
325 
326 #endif
#define USDHOUDINI_API
Definition: api.h:23
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdHoudiniHoudiniProceduralAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
Definition: token.h:70
UsdHoudiniHoudiniProceduralAPI(const UsdPrim &prim=UsdPrim(), const TfToken &name=TfToken())
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
TfToken GetName() const
Returns the name of this multiple-apply schema instance.
Definition: value.h:146
Multiple Apply API Schema.