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 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_HOUDINIVIEWPORTGUIDEAPI_H
25 #define USDHOUDINI_GENERATED_HOUDINIVIEWPORTGUIDEAPI_H
26 
27 /// \file usdHoudini/houdiniViewportGuideAPI.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 // HOUDINIVIEWPORTGUIDEAPI //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdHoudiniHoudiniViewportGuideAPI
54 ///
55 /// Houdini API schema for controlling light and camera guides
56 /// in the LOP viewport.
57 ///
58 class
61 {
62 public:
63  /// Compile time constant representing what kind of schema this class is.
64  ///
65  /// \sa UsdSchemaKind
66  static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
67 
68  /// Construct a UsdHoudiniHoudiniViewportGuideAPI on UsdPrim \p prim .
69  /// Equivalent to UsdHoudiniHoudiniViewportGuideAPI::Get(prim.GetStage(), prim.GetPath())
70  /// for a \em valid \p prim, but will not immediately throw an error for
71  /// an invalid \p prim
73  : UsdAPISchemaBase(prim)
74  {
75  }
76 
77  /// Construct a UsdHoudiniHoudiniViewportGuideAPI on the prim held by \p schemaObj .
78  /// Should be preferred over UsdHoudiniHoudiniViewportGuideAPI(schemaObj.GetPrim()),
79  /// as it preserves SchemaBase state.
81  : UsdAPISchemaBase(schemaObj)
82  {
83  }
84 
85  /// Destructor.
86  virtual ~UsdHoudiniHoudiniViewportGuideAPI() override;
87 
88  /// Return a vector of names of all pre-declared attributes for this schema
89  /// class and all its ancestor classes. Does not include attributes that
90  /// may be authored by custom/extended methods of the schemas involved.
91  static const TfTokenVector &
92  GetSchemaAttributeNames(bool includeInherited=true);
93 
94  /// Return a UsdHoudiniHoudiniViewportGuideAPI 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. This is shorthand for the following:
98  ///
99  /// \code
100  /// UsdHoudiniHoudiniViewportGuideAPI(stage->GetPrimAtPath(path));
101  /// \endcode
102  ///
104  Get(const UsdStagePtr &stage, const SdfPath &path);
105 
106 
107  /// Returns true if this <b>single-apply</b> API schema can be applied to
108  /// the given \p prim. If this schema can not be a applied to the prim,
109  /// this returns false and, if provided, populates \p whyNot with the
110  /// reason it can not be applied.
111  ///
112  /// Note that if CanApply returns false, that does not necessarily imply
113  /// that calling Apply will fail. Callers are expected to call CanApply
114  /// before calling Apply if they want to ensure that it is valid to
115  /// apply a schema.
116  ///
117  /// \sa UsdPrim::GetAppliedSchemas()
118  /// \sa UsdPrim::HasAPI()
119  /// \sa UsdPrim::CanApplyAPI()
120  /// \sa UsdPrim::ApplyAPI()
121  /// \sa UsdPrim::RemoveAPI()
122  ///
123  static bool
124  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
125 
126  /// Applies this <b>single-apply</b> API schema to the given \p prim.
127  /// This information is stored by adding "HoudiniViewportGuideAPI" to the
128  /// token-valued, listOp metadata \em apiSchemas on the prim.
129  ///
130  /// \return A valid UsdHoudiniHoudiniViewportGuideAPI object is returned upon success.
131  /// An invalid (or empty) UsdHoudiniHoudiniViewportGuideAPI object is returned upon
132  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
133  /// resulting in failure.
134  ///
135  /// \sa UsdPrim::GetAppliedSchemas()
136  /// \sa UsdPrim::HasAPI()
137  /// \sa UsdPrim::CanApplyAPI()
138  /// \sa UsdPrim::ApplyAPI()
139  /// \sa UsdPrim::RemoveAPI()
140  ///
142  Apply(const UsdPrim &prim);
143 
144 protected:
145  /// Returns the kind of schema this class belongs to.
146  ///
147  /// \sa UsdSchemaKind
148  UsdSchemaKind _GetSchemaKind() const override;
149 
150 private:
151  // needs to invoke _GetStaticTfType.
152  friend class UsdSchemaRegistry;
153  static const TfType &_GetStaticTfType();
154 
155  static bool _IsTypedSchema();
156 
157  // override SchemaBase virtuals.
158  const TfType &_GetTfType() const override;
159 
160 public:
161  // --------------------------------------------------------------------- //
162  // HOUDINIGUIDESCALE
163  // --------------------------------------------------------------------- //
164  /// Scales the guide geometry drawn in the Houdini viewport
165  /// for this primitive.
166  ///
167  /// | ||
168  /// | -- | -- |
169  /// | Declaration | `float houdini:guidescale = 1` |
170  /// | C++ Type | float |
171  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
172  UsdAttribute GetHoudiniGuidescaleAttr() const;
173 
174  /// See GetHoudiniGuidescaleAttr(), and also
175  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
176  /// If specified, author \p defaultValue as the attribute's default,
177  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
178  /// the default for \p writeSparsely is \c false.
179  UsdAttribute CreateHoudiniGuidescaleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
180 
181 public:
182  // --------------------------------------------------------------------- //
183  // HOUDINIINVIEWERMENU
184  // --------------------------------------------------------------------- //
185  /// If true, then this light or camera will appear in the
186  /// viewport's Look Through Camera menu.
187  ///
188  /// | ||
189  /// | -- | -- |
190  /// | Declaration | `uniform bool houdini:inviewermenu = 1` |
191  /// | C++ Type | bool |
192  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
193  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
194  UsdAttribute GetHoudiniInviewermenuAttr() const;
195 
196  /// See GetHoudiniInviewermenuAttr(), and also
197  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
198  /// If specified, author \p defaultValue as the attribute's default,
199  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
200  /// the default for \p writeSparsely is \c false.
201  UsdAttribute CreateHoudiniInviewermenuAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
202 
203 public:
204  // ===================================================================== //
205  // Feel free to add custom code below this line, it will be preserved by
206  // the code generator.
207  //
208  // Just remember to:
209  // - Close the class declaration with };
210  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
211  // - Close the include guard with #endif
212  // ===================================================================== //
213  // --(BEGIN CUSTOM CODE)--
214 };
215 
217 
218 #endif
#define USDHOUDINI_API
Definition: api.h:47
UsdHoudiniHoudiniViewportGuideAPI(const UsdPrim &prim=UsdPrim())
Single Apply API schema.
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdHoudiniHoudiniViewportGuideAPI(const UsdSchemaBase &schemaObj)
Definition: prim.h:135
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: path.h:291
UsdSchemaKind
Definition: common.h:127
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
Definition: value.h:167