HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniNodeGraphContainerAPI.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_HOUDININODEGRAPHCONTAINERAPI_H
8 #define USDHOUDINI_GENERATED_HOUDININODEGRAPHCONTAINERAPI_H
9 
10 /// \file usdHoudini/houdiniNodeGraphContainerAPI.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 // HOUDININODEGRAPHCONTAINERAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniNodeGraphContainerAPI
37 ///
38 /// Houdini API schema for storing node graph container information,
39 /// such as input and output positions, display colors,
40 /// connection wires drawing style, etc.
41 ///
42 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
43 /// that are text/tokens, the actual token is published and defined in \ref UsdHoudiniTokens.
44 /// So to set an attribute to the value "rightHanded", use UsdHoudiniTokens->rightHanded
45 /// as the value.
46 ///
47 class
50 {
51 public:
52  /// Compile time constant representing what kind of schema this class is.
53  ///
54  /// \sa UsdSchemaKind
55  static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
56 
57  /// Construct a UsdHoudiniHoudiniNodeGraphContainerAPI on UsdPrim \p prim .
58  /// Equivalent to UsdHoudiniHoudiniNodeGraphContainerAPI::Get(prim.GetStage(), prim.GetPath())
59  /// for a \em valid \p prim, but will not immediately throw an error for
60  /// an invalid \p prim
62  : UsdAPISchemaBase(prim)
63  {
64  }
65 
66  /// Construct a UsdHoudiniHoudiniNodeGraphContainerAPI on the prim held by \p schemaObj .
67  /// Should be preferred over UsdHoudiniHoudiniNodeGraphContainerAPI(schemaObj.GetPrim()),
68  /// as it preserves SchemaBase state.
70  : UsdAPISchemaBase(schemaObj)
71  {
72  }
73 
74  /// Destructor.
75  virtual ~UsdHoudiniHoudiniNodeGraphContainerAPI() override;
76 
77  /// Return a vector of names of all pre-declared attributes for this schema
78  /// class and all its ancestor classes. Does not include attributes that
79  /// may be authored by custom/extended methods of the schemas involved.
80  static const TfTokenVector &
81  GetSchemaAttributeNames(bool includeInherited=true);
82 
83  /// Return a UsdHoudiniHoudiniNodeGraphContainerAPI holding the prim adhering to this
84  /// schema at \p path on \p stage. If no prim exists at \p path on
85  /// \p stage, or if the prim at that path does not adhere to this schema,
86  /// return an invalid schema object. This is shorthand for the following:
87  ///
88  /// \code
89  /// UsdHoudiniHoudiniNodeGraphContainerAPI(stage->GetPrimAtPath(path));
90  /// \endcode
91  ///
93  Get(const UsdStagePtr &stage, const SdfPath &path);
94 
95 
96  /// Returns true if this <b>single-apply</b> API schema can be applied to
97  /// the given \p prim. If this schema can not be a applied to the prim,
98  /// this returns false and, if provided, populates \p whyNot with the
99  /// reason it can not be applied.
100  ///
101  /// Note that if CanApply returns false, that does not necessarily imply
102  /// that calling Apply will fail. Callers are expected to call CanApply
103  /// before calling Apply if they want to ensure that it is valid to
104  /// apply a schema.
105  ///
106  /// \sa UsdPrim::GetAppliedSchemas()
107  /// \sa UsdPrim::HasAPI()
108  /// \sa UsdPrim::CanApplyAPI()
109  /// \sa UsdPrim::ApplyAPI()
110  /// \sa UsdPrim::RemoveAPI()
111  ///
112  static bool
113  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
114 
115  /// Applies this <b>single-apply</b> API schema to the given \p prim.
116  /// This information is stored by adding "HoudiniNodeGraphContainerAPI" to the
117  /// token-valued, listOp metadata \em apiSchemas on the prim.
118  ///
119  /// \return A valid UsdHoudiniHoudiniNodeGraphContainerAPI object is returned upon success.
120  /// An invalid (or empty) UsdHoudiniHoudiniNodeGraphContainerAPI object is returned upon
121  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
122  /// resulting in failure.
123  ///
124  /// \sa UsdPrim::GetAppliedSchemas()
125  /// \sa UsdPrim::HasAPI()
126  /// \sa UsdPrim::CanApplyAPI()
127  /// \sa UsdPrim::ApplyAPI()
128  /// \sa UsdPrim::RemoveAPI()
129  ///
131  Apply(const UsdPrim &prim);
132 
133 protected:
134  /// Returns the kind of schema this class belongs to.
135  ///
136  /// \sa UsdSchemaKind
137  UsdSchemaKind _GetSchemaKind() const override;
138 
139 private:
140  // needs to invoke _GetStaticTfType.
141  friend class UsdSchemaRegistry;
142  static const TfType &_GetStaticTfType();
143 
144  static bool _IsTypedSchema();
145 
146  // override SchemaBase virtuals.
147  const TfType &_GetTfType() const override;
148 
149 public:
150  // --------------------------------------------------------------------- //
151  // CONTAINERINPUTPOS
152  // --------------------------------------------------------------------- //
153  /// Position of the container input in the node graph.
154  ///
155  /// | ||
156  /// | -- | -- |
157  /// | Declaration | `float2 houdini:containerInputPos` |
158  /// | C++ Type | GfVec2f |
159  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float2 |
160  UsdAttribute GetContainerInputPosAttr() const;
161 
162  /// See GetContainerInputPosAttr(), and also
163  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
164  /// If specified, author \p defaultValue as the attribute's default,
165  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
166  /// the default for \p writeSparsely is \c false.
167  UsdAttribute CreateContainerInputPosAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
168 
169 public:
170  // --------------------------------------------------------------------- //
171  // CONTAINEROUTPUTPOS
172  // --------------------------------------------------------------------- //
173  /// Position of the container output in the node graph.
174  ///
175  /// | ||
176  /// | -- | -- |
177  /// | Declaration | `float2 houdini:containerOutputPos` |
178  /// | C++ Type | GfVec2f |
179  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float2 |
180  UsdAttribute GetContainerOutputPosAttr() const;
181 
182  /// See GetContainerOutputPosAttr(), and also
183  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
184  /// If specified, author \p defaultValue as the attribute's default,
185  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
186  /// the default for \p writeSparsely is \c false.
187  UsdAttribute CreateContainerOutputPosAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
188 
189 public:
190  // --------------------------------------------------------------------- //
191  // CONTAINERINPUTDISPLAYCOLOR
192  // --------------------------------------------------------------------- //
193  /// Display color for the container input in the node graph.
194  ///
195  /// | ||
196  /// | -- | -- |
197  /// | Declaration | `color3f houdini:containerInputDisplayColor` |
198  /// | C++ Type | GfVec3f |
199  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Color3f |
200  UsdAttribute GetContainerInputDisplayColorAttr() const;
201 
202  /// See GetContainerInputDisplayColorAttr(), and also
203  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
204  /// If specified, author \p defaultValue as the attribute's default,
205  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
206  /// the default for \p writeSparsely is \c false.
207  UsdAttribute CreateContainerInputDisplayColorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
208 
209 public:
210  // --------------------------------------------------------------------- //
211  // CONTAINEROUTPUTDISPLAYCOLOR
212  // --------------------------------------------------------------------- //
213  /// Display color for the container output in the node graph.
214  ///
215  /// | ||
216  /// | -- | -- |
217  /// | Declaration | `color3f houdini:containerOutputDisplayColor` |
218  /// | C++ Type | GfVec3f |
219  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Color3f |
220  UsdAttribute GetContainerOutputDisplayColorAttr() const;
221 
222  /// See GetContainerOutputDisplayColorAttr(), and also
223  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
224  /// If specified, author \p defaultValue as the attribute's default,
225  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
226  /// the default for \p writeSparsely is \c false.
227  UsdAttribute CreateContainerOutputDisplayColorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
228 
229 public:
230  // --------------------------------------------------------------------- //
231  // CONTAINERWIRESTYLE
232  // --------------------------------------------------------------------- //
233  /// Drawing style of the wire connections between nodes inside the node graph.
234  ///
235  /// | ||
236  /// | -- | -- |
237  /// | Declaration | `token houdini:containerWireStyle = "inherited"` |
238  /// | C++ Type | TfToken |
239  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
240  /// | \ref UsdHoudiniTokens "Allowed Values" | inherited, straight, rounded |
241  UsdAttribute GetContainerWireStyleAttr() const;
242 
243  /// See GetContainerWireStyleAttr(), 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 CreateContainerWireStyleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
249 
250 public:
251  // ===================================================================== //
252  // Feel free to add custom code below this line, it will be preserved by
253  // the code generator.
254  //
255  // Just remember to:
256  // - Close the class declaration with };
257  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
258  // - Close the include guard with #endif
259  // ===================================================================== //
260  // --(BEGIN CUSTOM CODE)--
261 };
262 
264 
265 #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
UsdHoudiniHoudiniNodeGraphContainerAPI(const UsdPrim &prim=UsdPrim())
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:280
UsdSchemaKind
Definition: common.h:112
UsdHoudiniHoudiniNodeGraphContainerAPI(const UsdSchemaBase &schemaObj)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
Definition: value.h:89