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 USDCONTRIVED_GENERATED_DERIVED_H 25 #define USDCONTRIVED_GENERATED_DERIVED_H 26 27 /// \file usdContrived/derived.h 28 29 #include "pxr/pxr.h" 30 #include "pxr/usd/usdContrived/api.h" 31 #include "pxr/usd/usdContrived/base.h" 32 #include "pxr/usd/usd/prim.h" 33 #include "pxr/usd/usd/stage.h" 34 #include "pxr/usd/usdContrived/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 45 namespace foo { 46 47 class SdfAssetPath; 48 49 // -------------------------------------------------------------------------- // 50 // DERIVED // 51 // -------------------------------------------------------------------------- // 52 53 /// \class UsdContrivedDerived 54 /// 55 /// \em Emphasized! \section Test_Section Test Section 56 /// 57 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below 58 /// that are text/tokens, the actual token is published and defined in \ref UsdContrivedTokens. 59 /// So to set an attribute to the value "rightHanded", use UsdContrivedTokens->rightHanded 60 /// as the value. 61 /// 62 class UsdContrivedDerived : public UsdContrivedBase 63 { 64 public: 65 /// Compile time constant representing what kind of schema this class is. 66 /// 67 /// \sa UsdSchemaKind 68 static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; 69 70 /// Construct a UsdContrivedDerived on UsdPrim \p prim . 71 /// Equivalent to UsdContrivedDerived::Get(prim.GetStage(), prim.GetPath()) 72 /// for a \em valid \p prim, but will not immediately throw an error for 73 /// an invalid \p prim 74 explicit UsdContrivedDerived(const UsdPrim& prim=UsdPrim()) UsdContrivedBase(prim)75 : UsdContrivedBase(prim) 76 { 77 } 78 79 /// Construct a UsdContrivedDerived on the prim held by \p schemaObj . 80 /// Should be preferred over UsdContrivedDerived(schemaObj.GetPrim()), 81 /// as it preserves SchemaBase state. UsdContrivedDerived(const UsdSchemaBase & schemaObj)82 explicit UsdContrivedDerived(const UsdSchemaBase& schemaObj) 83 : UsdContrivedBase(schemaObj) 84 { 85 } 86 87 /// Destructor. 88 USDCONTRIVED_API 89 virtual ~UsdContrivedDerived(); 90 91 /// Return a vector of names of all pre-declared attributes for this schema 92 /// class and all its ancestor classes. Does not include attributes that 93 /// may be authored by custom/extended methods of the schemas involved. 94 USDCONTRIVED_API 95 static const TfTokenVector & 96 GetSchemaAttributeNames(bool includeInherited=true); 97 98 /// Return a UsdContrivedDerived 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 /// UsdContrivedDerived(stage->GetPrimAtPath(path)); 105 /// \endcode 106 /// 107 USDCONTRIVED_API 108 static UsdContrivedDerived 109 Get(const UsdStagePtr &stage, const SdfPath &path); 110 111 /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path 112 /// is defined (according to UsdPrim::IsDefined()) on this stage. 113 /// 114 /// If a prim adhering to this schema at \p path is already defined on this 115 /// stage, return that prim. Otherwise author an \a SdfPrimSpec with 116 /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for 117 /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s 118 /// with \p specifier == \a SdfSpecifierDef and empty typeName at the 119 /// current EditTarget for any nonexistent, or existing but not \a Defined 120 /// ancestors. 121 /// 122 /// The given \a path must be an absolute prim path that does not contain 123 /// any variant selections. 124 /// 125 /// If it is impossible to author any of the necessary PrimSpecs, (for 126 /// example, in case \a path cannot map to the current UsdEditTarget's 127 /// namespace) issue an error and return an invalid \a UsdPrim. 128 /// 129 /// Note that this method may return a defined prim whose typeName does not 130 /// specify this schema class, in case a stronger typeName opinion overrides 131 /// the opinion at the current EditTarget. 132 /// 133 USDCONTRIVED_API 134 static UsdContrivedDerived 135 Define(const UsdStagePtr &stage, const SdfPath &path); 136 137 protected: 138 /// Returns the kind of schema this class belongs to. 139 /// 140 /// \sa UsdSchemaKind 141 USDCONTRIVED_API 142 UsdSchemaKind _GetSchemaKind() const override; 143 144 private: 145 // needs to invoke _GetStaticTfType. 146 friend class UsdSchemaRegistry; 147 USDCONTRIVED_API 148 static const TfType &_GetStaticTfType(); 149 150 static bool _IsTypedSchema(); 151 152 // override SchemaBase virtuals. 153 USDCONTRIVED_API 154 const TfType &_GetTfType() const override; 155 156 public: 157 // --------------------------------------------------------------------- // 158 // PIVOTPOSITION 159 // --------------------------------------------------------------------- // 160 /// Rotation pivot position for this prim's transformation. 161 /// Provided as advisory data only for use by authoring applications, 162 /// and should have no effect on the transformation encoded in the 163 /// 'transform' attribute. 164 /// 165 /// | || 166 /// | -- | -- | 167 /// | Declaration | `float3 pivotPosition = (0, 0, 0)` | 168 /// | C++ Type | GfVec3f | 169 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float3 | 170 USDCONTRIVED_API 171 UsdAttribute GetPivotPositionAttr() const; 172 173 /// See GetPivotPositionAttr(), and also 174 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 175 /// If specified, author \p defaultValue as the attribute's default, 176 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 177 /// the default for \p writeSparsely is \c false. 178 USDCONTRIVED_API 179 UsdAttribute CreatePivotPositionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 180 181 public: 182 // --------------------------------------------------------------------- // 183 // MYVECFARRAY 184 // --------------------------------------------------------------------- // 185 /// 186 /// 187 /// | || 188 /// | -- | -- | 189 /// | Declaration | `float3[] myVecfArray` | 190 /// | C++ Type | VtArray<GfVec3f> | 191 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float3Array | 192 USDCONTRIVED_API 193 UsdAttribute GetMyVecfArrayAttr() const; 194 195 /// See GetMyVecfArrayAttr(), and also 196 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 197 /// If specified, author \p defaultValue as the attribute's default, 198 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 199 /// the default for \p writeSparsely is \c false. 200 USDCONTRIVED_API 201 UsdAttribute CreateMyVecfArrayAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 202 203 public: 204 // --------------------------------------------------------------------- // 205 // HOLEINDICES 206 // --------------------------------------------------------------------- // 207 /// The face indices (indexing into the 'faceVertexCounts' 208 /// attribute) of all faces that should be made invisible. 209 /// 210 /// | || 211 /// | -- | -- | 212 /// | Declaration | `int[] holeIndices = []` | 213 /// | C++ Type | VtArray<int> | 214 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray | 215 USDCONTRIVED_API 216 UsdAttribute GetHoleIndicesAttr() const; 217 218 /// See GetHoleIndicesAttr(), and also 219 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 220 /// If specified, author \p defaultValue as the attribute's default, 221 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 222 /// the default for \p writeSparsely is \c false. 223 USDCONTRIVED_API 224 UsdAttribute CreateHoleIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 225 226 public: 227 // --------------------------------------------------------------------- // 228 // CORNERINDICES 229 // --------------------------------------------------------------------- // 230 /// The vertex indices of all vertices that are sharp corners. 231 /// 232 /// | || 233 /// | -- | -- | 234 /// | Declaration | `int[] cornerIndices = []` | 235 /// | C++ Type | VtArray<int> | 236 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray | 237 USDCONTRIVED_API 238 UsdAttribute GetCornerIndicesAttr() const; 239 240 /// See GetCornerIndicesAttr(), and also 241 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 242 /// If specified, author \p defaultValue as the attribute's default, 243 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 244 /// the default for \p writeSparsely is \c false. 245 USDCONTRIVED_API 246 UsdAttribute CreateCornerIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 247 248 public: 249 // --------------------------------------------------------------------- // 250 // CORNERSHARPNESSES 251 // --------------------------------------------------------------------- // 252 /// The sharpness values for corners: each corner gets a single 253 /// sharpness value (Usd.Mesh.SHARPNESS_INFINITE for a perfectly sharp 254 /// corner), so the size of this array must match that of 255 /// 'cornerIndices' 256 /// 257 /// | || 258 /// | -- | -- | 259 /// | Declaration | `float[] cornerSharpnesses = []` | 260 /// | C++ Type | VtArray<float> | 261 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->FloatArray | 262 USDCONTRIVED_API 263 UsdAttribute GetCornerSharpnessesAttr() const; 264 265 /// See GetCornerSharpnessesAttr(), and also 266 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 267 /// If specified, author \p defaultValue as the attribute's default, 268 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 269 /// the default for \p writeSparsely is \c false. 270 USDCONTRIVED_API 271 UsdAttribute CreateCornerSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 272 273 public: 274 // --------------------------------------------------------------------- // 275 // CREASELENGTHS 276 // --------------------------------------------------------------------- // 277 /// The length of this array specifies the number of creases on the 278 /// surface. Each element gives the number of (must be adjacent) vertices in 279 /// each crease, whose indices are linearly laid out in the 'creaseIndices' 280 /// attribute. Since each crease must be at least one edge long, each 281 /// element of this array should be greater than one. 282 /// 283 /// | || 284 /// | -- | -- | 285 /// | Declaration | `int[] creaseLengths = []` | 286 /// | C++ Type | VtArray<int> | 287 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray | 288 USDCONTRIVED_API 289 UsdAttribute GetCreaseLengthsAttr() const; 290 291 /// See GetCreaseLengthsAttr(), and also 292 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 293 /// If specified, author \p defaultValue as the attribute's default, 294 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 295 /// the default for \p writeSparsely is \c false. 296 USDCONTRIVED_API 297 UsdAttribute CreateCreaseLengthsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 298 299 public: 300 // --------------------------------------------------------------------- // 301 // TRANSFORM 302 // --------------------------------------------------------------------- // 303 /// Double-precision transformation matrix, which should encode 304 /// the entire local transformation for a prim. 305 /// 306 /// | || 307 /// | -- | -- | 308 /// | Declaration | `matrix4d transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )` | 309 /// | C++ Type | GfMatrix4d | 310 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Matrix4d | 311 USDCONTRIVED_API 312 UsdAttribute GetTransformAttr() const; 313 314 /// See GetTransformAttr(), and also 315 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 316 /// If specified, author \p defaultValue as the attribute's default, 317 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 318 /// the default for \p writeSparsely is \c false. 319 USDCONTRIVED_API 320 UsdAttribute CreateTransformAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 321 322 public: 323 // --------------------------------------------------------------------- // 324 // TESTINGASSET 325 // --------------------------------------------------------------------- // 326 /// 327 /// 328 /// | || 329 /// | -- | -- | 330 /// | Declaration | `asset[] testingAsset` | 331 /// | C++ Type | VtArray<SdfAssetPath> | 332 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->AssetArray | 333 USDCONTRIVED_API 334 UsdAttribute GetTestingAssetAttr() const; 335 336 /// See GetTestingAssetAttr(), and also 337 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 338 /// If specified, author \p defaultValue as the attribute's default, 339 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 340 /// the default for \p writeSparsely is \c false. 341 USDCONTRIVED_API 342 UsdAttribute CreateTestingAssetAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 343 344 public: 345 // --------------------------------------------------------------------- // 346 // NAMESPACEDPROPERTY 347 // --------------------------------------------------------------------- // 348 /// 349 /// 350 /// | || 351 /// | -- | -- | 352 /// | Declaration | `float namespaced:property = 1` | 353 /// | C++ Type | float | 354 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float | 355 USDCONTRIVED_API 356 UsdAttribute GetNamespacedPropertyAttr() const; 357 358 /// See GetNamespacedPropertyAttr(), and also 359 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 360 /// If specified, author \p defaultValue as the attribute's default, 361 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 362 /// the default for \p writeSparsely is \c false. 363 USDCONTRIVED_API 364 UsdAttribute CreateNamespacedPropertyAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 365 366 public: 367 // --------------------------------------------------------------------- // 368 // JUSTDEFAULT 369 // --------------------------------------------------------------------- // 370 /// newToken should be included in the global token set. 371 /// 372 /// | || 373 /// | -- | -- | 374 /// | Declaration | `token justDefault = "newToken"` | 375 /// | C++ Type | TfToken | 376 /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token | 377 USDCONTRIVED_API 378 UsdAttribute GetJustDefaultAttr() const; 379 380 /// See GetJustDefaultAttr(), and also 381 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. 382 /// If specified, author \p defaultValue as the attribute's default, 383 /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - 384 /// the default for \p writeSparsely is \c false. 385 USDCONTRIVED_API 386 UsdAttribute CreateJustDefaultAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const; 387 388 public: 389 // --------------------------------------------------------------------- // 390 // BINDING 391 // --------------------------------------------------------------------- // 392 /// This is my awesome relationship. 393 /// 394 USDCONTRIVED_API 395 UsdRelationship GetBindingRel() const; 396 397 /// See GetBindingRel(), and also 398 /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create 399 USDCONTRIVED_API 400 UsdRelationship CreateBindingRel() const; 401 402 public: 403 // ===================================================================== // 404 // Feel free to add custom code below this line, it will be preserved by 405 // the code generator. 406 // 407 // Just remember to: 408 // - Close the class declaration with }; 409 // - Close the namespace with } 410 // - Close the include guard with #endif 411 // ===================================================================== // 412 // --(BEGIN CUSTOM CODE)-- 413 }; 414 415 } 416 417 #endif 418