HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniCanvasCameraAPI.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_HOUDINICANVASCAMERAAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINICANVASCAMERAAPI_H
9 
10 /// \file usdHoudini/houdiniCanvasCameraAPI.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 // HOUDINICANVASCAMERAAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniCanvasCameraAPI
37 ///
38 /// Houdini API schema for setting the distance
39 /// of the canvas from the camera
40 ///
41 class
44 {
45 public:
46  /// Compile time constant representing what kind of schema this class is.
47  ///
48  /// \sa UsdSchemaKind
49  static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
50 
51  /// Construct a UsdHoudiniHoudiniCanvasCameraAPI on UsdPrim \p prim .
52  /// Equivalent to UsdHoudiniHoudiniCanvasCameraAPI::Get(prim.GetStage(), prim.GetPath())
53  /// for a \em valid \p prim, but will not immediately throw an error for
54  /// an invalid \p prim
56  : UsdAPISchemaBase(prim)
57  {
58  }
59 
60  /// Construct a UsdHoudiniHoudiniCanvasCameraAPI on the prim held by \p schemaObj .
61  /// Should be preferred over UsdHoudiniHoudiniCanvasCameraAPI(schemaObj.GetPrim()),
62  /// as it preserves SchemaBase state.
64  : UsdAPISchemaBase(schemaObj)
65  {
66  }
67 
68  /// Destructor.
69  virtual ~UsdHoudiniHoudiniCanvasCameraAPI() override;
70 
71  /// Return a vector of names of all pre-declared attributes for this schema
72  /// class and all its ancestor classes. Does not include attributes that
73  /// may be authored by custom/extended methods of the schemas involved.
74  static const TfTokenVector &
75  GetSchemaAttributeNames(bool includeInherited=true);
76 
77  /// Return a UsdHoudiniHoudiniCanvasCameraAPI holding the prim adhering to this
78  /// schema at \p path on \p stage. If no prim exists at \p path on
79  /// \p stage, or if the prim at that path does not adhere to this schema,
80  /// return an invalid schema object. This is shorthand for the following:
81  ///
82  /// \code
83  /// UsdHoudiniHoudiniCanvasCameraAPI(stage->GetPrimAtPath(path));
84  /// \endcode
85  ///
87  Get(const UsdStagePtr &stage, const SdfPath &path);
88 
89 
90  /// Returns true if this <b>single-apply</b> API schema can be applied to
91  /// the given \p prim. If this schema can not be a applied to the prim,
92  /// this returns false and, if provided, populates \p whyNot with the
93  /// reason it can not be applied.
94  ///
95  /// Note that if CanApply returns false, that does not necessarily imply
96  /// that calling Apply will fail. Callers are expected to call CanApply
97  /// before calling Apply if they want to ensure that it is valid to
98  /// apply a schema.
99  ///
100  /// \sa UsdPrim::GetAppliedSchemas()
101  /// \sa UsdPrim::HasAPI()
102  /// \sa UsdPrim::CanApplyAPI()
103  /// \sa UsdPrim::ApplyAPI()
104  /// \sa UsdPrim::RemoveAPI()
105  ///
106  static bool
107  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
108 
109  /// Applies this <b>single-apply</b> API schema to the given \p prim.
110  /// This information is stored by adding "HoudiniCanvasCameraAPI" to the
111  /// token-valued, listOp metadata \em apiSchemas on the prim.
112  ///
113  /// \return A valid UsdHoudiniHoudiniCanvasCameraAPI object is returned upon success.
114  /// An invalid (or empty) UsdHoudiniHoudiniCanvasCameraAPI object is returned upon
115  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
116  /// resulting in failure.
117  ///
118  /// \sa UsdPrim::GetAppliedSchemas()
119  /// \sa UsdPrim::HasAPI()
120  /// \sa UsdPrim::CanApplyAPI()
121  /// \sa UsdPrim::ApplyAPI()
122  /// \sa UsdPrim::RemoveAPI()
123  ///
125  Apply(const UsdPrim &prim);
126 
127 protected:
128  /// Returns the kind of schema this class belongs to.
129  ///
130  /// \sa UsdSchemaKind
131  UsdSchemaKind _GetSchemaKind() const override;
132 
133 private:
134  // needs to invoke _GetStaticTfType.
135  friend class UsdSchemaRegistry;
136  static const TfType &_GetStaticTfType();
137 
138  static bool _IsTypedSchema();
139 
140  // override SchemaBase virtuals.
141  const TfType &_GetTfType() const override;
142 
143 public:
144  // --------------------------------------------------------------------- //
145  // HOUDINICANVASDISTANCE
146  // --------------------------------------------------------------------- //
147  /// Indicates the canvas distance from the camera.
148  ///
149  /// | ||
150  /// | -- | -- |
151  /// | Declaration | `double houdini:canvasdistance = 1` |
152  /// | C++ Type | double |
153  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
154  UsdAttribute GetHoudiniCanvasdistanceAttr() const;
155 
156  /// See GetHoudiniCanvasdistanceAttr(), and also
157  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
158  /// If specified, author \p defaultValue as the attribute's default,
159  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
160  /// the default for \p writeSparsely is \c false.
161  UsdAttribute CreateHoudiniCanvasdistanceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
162 
163 public:
164  // ===================================================================== //
165  // Feel free to add custom code below this line, it will be preserved by
166  // the code generator.
167  //
168  // Just remember to:
169  // - Close the class declaration with };
170  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
171  // - Close the include guard with #endif
172  // ===================================================================== //
173  // --(BEGIN CUSTOM CODE)--
174 };
175 
177 
178 #endif
#define USDHOUDINI_API
Definition: api.h:23
Single Apply API schema.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:280
UsdSchemaKind
Definition: common.h:112
UsdHoudiniHoudiniCanvasCameraAPI(const UsdPrim &prim=UsdPrim())
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
Definition: value.h:89
UsdHoudiniHoudiniCanvasCameraAPI(const UsdSchemaBase &schemaObj)