HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniViewportGuideAPI.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_HOUDINIVIEWPORTGUIDEAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINIVIEWPORTGUIDEAPI_H
9 
10 /// \file usdHoudini/houdiniViewportGuideAPI.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 // HOUDINIVIEWPORTGUIDEAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniViewportGuideAPI
37 ///
38 /// Houdini API schema for controlling light and camera guides
39 /// in the LOP viewport.
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 UsdHoudiniHoudiniViewportGuideAPI on UsdPrim \p prim .
52  /// Equivalent to UsdHoudiniHoudiniViewportGuideAPI::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 UsdHoudiniHoudiniViewportGuideAPI on the prim held by \p schemaObj .
61  /// Should be preferred over UsdHoudiniHoudiniViewportGuideAPI(schemaObj.GetPrim()),
62  /// as it preserves SchemaBase state.
64  : UsdAPISchemaBase(schemaObj)
65  {
66  }
67 
68  /// Destructor.
69  virtual ~UsdHoudiniHoudiniViewportGuideAPI() 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 UsdHoudiniHoudiniViewportGuideAPI 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  /// UsdHoudiniHoudiniViewportGuideAPI(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 "HoudiniViewportGuideAPI" to the
111  /// token-valued, listOp metadata \em apiSchemas on the prim.
112  ///
113  /// \return A valid UsdHoudiniHoudiniViewportGuideAPI object is returned upon success.
114  /// An invalid (or empty) UsdHoudiniHoudiniViewportGuideAPI 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  // HOUDINIGUIDESCALE
146  // --------------------------------------------------------------------- //
147  /// Scales the guide geometry drawn in the Houdini viewport
148  /// for this primitive.
149  ///
150  /// | ||
151  /// | -- | -- |
152  /// | Declaration | `float houdini:guidescale = 1` |
153  /// | C++ Type | float |
154  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
155  UsdAttribute GetHoudiniGuidescaleAttr() const;
156 
157  /// See GetHoudiniGuidescaleAttr(), and also
158  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
159  /// If specified, author \p defaultValue as the attribute's default,
160  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
161  /// the default for \p writeSparsely is \c false.
162  UsdAttribute CreateHoudiniGuidescaleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
163 
164 public:
165  // --------------------------------------------------------------------- //
166  // HOUDINIINVIEWERMENU
167  // --------------------------------------------------------------------- //
168  /// If true, then this light or camera will appear in the
169  /// viewport's Look Through Camera menu.
170  ///
171  /// | ||
172  /// | -- | -- |
173  /// | Declaration | `uniform bool houdini:inviewermenu = 1` |
174  /// | C++ Type | bool |
175  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
176  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
177  UsdAttribute GetHoudiniInviewermenuAttr() const;
178 
179  /// See GetHoudiniInviewermenuAttr(), and also
180  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
181  /// If specified, author \p defaultValue as the attribute's default,
182  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
183  /// the default for \p writeSparsely is \c false.
184  UsdAttribute CreateHoudiniInviewermenuAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
185 
186 public:
187  // ===================================================================== //
188  // Feel free to add custom code below this line, it will be preserved by
189  // the code generator.
190  //
191  // Just remember to:
192  // - Close the class declaration with };
193  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
194  // - Close the include guard with #endif
195  // ===================================================================== //
196  // --(BEGIN CUSTOM CODE)--
197 };
198 
200 
201 #endif
#define USDHOUDINI_API
Definition: api.h:23
UsdHoudiniHoudiniViewportGuideAPI(const UsdPrim &prim=UsdPrim())
Single Apply API schema.
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdHoudiniHoudiniViewportGuideAPI(const UsdSchemaBase &schemaObj)
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
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
Definition: value.h:146