HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniEditableAPI.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_HOUDINIEDITABLEAPI_H
25 #define USDHOUDINI_GENERATED_HOUDINIEDITABLEAPI_H
26 
27 /// \file usdHoudini/houdiniEditableAPI.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 // HOUDINIEDITABLEAPI //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdHoudiniHoudiniEditableAPI
54 ///
55 /// Houdini API schema for marking primitives as editable or not.
56 ///
57 class
58 USDHOUDINI_API
60 {
61 public:
62  /// Compile time constant representing what kind of schema this class is.
63  ///
64  /// \sa UsdSchemaKind
65  static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
66 
67  /// \deprecated
68  /// Same as schemaKind, provided to maintain temporary backward
69  /// compatibility with older generated schemas.
70  static const UsdSchemaKind schemaType = UsdSchemaKind::SingleApplyAPI;
71 
72  /// Construct a UsdHoudiniHoudiniEditableAPI on UsdPrim \p prim .
73  /// Equivalent to UsdHoudiniHoudiniEditableAPI::Get(prim.GetStage(), prim.GetPath())
74  /// for a \em valid \p prim, but will not immediately throw an error for
75  /// an invalid \p prim
77  : UsdAPISchemaBase(prim)
78  {
79  }
80 
81  /// Construct a UsdHoudiniHoudiniEditableAPI on the prim held by \p schemaObj .
82  /// Should be preferred over UsdHoudiniHoudiniEditableAPI(schemaObj.GetPrim()),
83  /// as it preserves SchemaBase state.
84  explicit UsdHoudiniHoudiniEditableAPI(const UsdSchemaBase& schemaObj)
85  : UsdAPISchemaBase(schemaObj)
86  {
87  }
88 
89  /// Destructor.
90  virtual ~UsdHoudiniHoudiniEditableAPI() 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 UsdHoudiniHoudiniEditableAPI holding the prim adhering to this
99  /// schema at \p path on \p stage. If no prim exists at \p path on
100  /// \p stage, or if the prim at that path does not adhere to this schema,
101  /// return an invalid schema object. This is shorthand for the following:
102  ///
103  /// \code
104  /// UsdHoudiniHoudiniEditableAPI(stage->GetPrimAtPath(path));
105  /// \endcode
106  ///
108  Get(const UsdStagePtr &stage, const SdfPath &path);
109 
110 
111  /// Applies this <b>single-apply</b> API schema to the given \p prim.
112  /// This information is stored by adding "HoudiniEditableAPI" to the
113  /// token-valued, listOp metadata \em apiSchemas on the prim.
114  ///
115  /// \return A valid UsdHoudiniHoudiniEditableAPI object is returned upon success.
116  /// An invalid (or empty) UsdHoudiniHoudiniEditableAPI object is returned upon
117  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
118  /// resulting in failure.
119  ///
120  /// \sa UsdPrim::GetAppliedSchemas()
121  /// \sa UsdPrim::HasAPI()
122  /// \sa UsdPrim::ApplyAPI()
123  /// \sa UsdPrim::RemoveAPI()
124  ///
126  Apply(const UsdPrim &prim);
127 
128 protected:
129  /// Returns the kind of schema this class belongs to.
130  ///
131  /// \sa UsdSchemaKind
132  UsdSchemaKind _GetSchemaKind() const override;
133 
134  /// \deprecated
135  /// Same as _GetSchemaKind, provided to maintain temporary backward
136  /// compatibility with older generated schemas.
137  UsdSchemaKind _GetSchemaType() 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  // HOUDINIEDITABLE
152  // --------------------------------------------------------------------- //
153  /// If true, then any LOP node is permitted to modify this
154  /// primitive. If false, LOP nodes which respect this flag
155  /// should produce a warning if they are asked to modify this
156  /// primitive.
157  ///
158  /// | ||
159  /// | -- | -- |
160  /// | Declaration | `uniform bool houdini:editable = 1` |
161  /// | C++ Type | bool |
162  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
163  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
164  UsdAttribute GetHoudiniEditableAttr() const;
165 
166  /// See GetHoudiniEditableAttr(), and also
167  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
168  /// If specified, author \p defaultValue as the attribute's default,
169  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
170  /// the default for \p writeSparsely is \c false.
171  UsdAttribute CreateHoudiniEditableAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
172 
173 public:
174  // ===================================================================== //
175  // Feel free to add custom code below this line, it will be preserved by
176  // the code generator.
177  //
178  // Just remember to:
179  // - Close the class declaration with };
180  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
181  // - Close the include guard with #endif
182  // ===================================================================== //
183  // --(BEGIN CUSTOM CODE)--
184 };
185 
187 
188 #endif
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
UsdHoudiniHoudiniEditableAPI(const UsdSchemaBase &schemaObj)
UsdSchemaKind
Definition: common.h:127
Single Apply API schema.
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: path.h:288
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
Definition: value.h:168
UsdHoudiniHoudiniEditableAPI(const UsdPrim &prim=UsdPrim())