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