modelAPI.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 USDGEOM_GENERATED_MODELAPI_H
25 #define USDGEOM_GENERATED_MODELAPI_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdGeom/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdGeom/tokens.h"
35 
36 #include "pxr/usd/usdGeom/bboxCache.h"
37 #include "pxr/usd/usdGeom/constraintTarget.h"
39 
40 #include "pxr/base/vt/value.h"
41 
42 #include "pxr/base/gf/vec3d.h"
43 #include "pxr/base/gf/vec3f.h"
44 #include "pxr/base/gf/matrix4d.h"
45 
46 #include "pxr/base/tf/token.h"
47 #include "pxr/base/tf/type.h"
48 
49 PXR_NAMESPACE_OPEN_SCOPE
50 
51 class SdfAssetPath;
52 
53 // -------------------------------------------------------------------------- //
54 // GEOMMODELAPI //
55 // -------------------------------------------------------------------------- //
56 
149 {
150 public:
155 
160  explicit UsdGeomModelAPI(const UsdPrim& prim=UsdPrim())
161  : UsdAPISchemaBase(prim)
162  {
163  }
164 
168  explicit UsdGeomModelAPI(const UsdSchemaBase& schemaObj)
169  : UsdAPISchemaBase(schemaObj)
170  {
171  }
172 
174  USDGEOM_API
175  virtual ~UsdGeomModelAPI();
176 
180  USDGEOM_API
181  static const TfTokenVector &
182  GetSchemaAttributeNames(bool includeInherited=true);
183 
193  USDGEOM_API
194  static UsdGeomModelAPI
195  Get(const UsdStagePtr &stage, const SdfPath &path);
196 
197 
214  USDGEOM_API
215  static bool
216  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
217 
233  USDGEOM_API
234  static UsdGeomModelAPI
235  Apply(const UsdPrim &prim);
236 
237 protected:
241  USDGEOM_API
242  UsdSchemaKind _GetSchemaKind() const override;
243 
244 private:
245  // needs to invoke _GetStaticTfType.
246  friend class UsdSchemaRegistry;
247  USDGEOM_API
248  static const TfType &_GetStaticTfType();
249 
250  static bool _IsTypedSchema();
251 
252  // override SchemaBase virtuals.
253  USDGEOM_API
254  const TfType &_GetTfType() const override;
255 
256 public:
257  // --------------------------------------------------------------------- //
258  // MODELDRAWMODE
259  // --------------------------------------------------------------------- //
272  USDGEOM_API
274 
280  USDGEOM_API
281  UsdAttribute CreateModelDrawModeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
282 
283 public:
284  // --------------------------------------------------------------------- //
285  // MODELAPPLYDRAWMODE
286  // --------------------------------------------------------------------- //
297  USDGEOM_API
299 
305  USDGEOM_API
306  UsdAttribute CreateModelApplyDrawModeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
307 
308 public:
309  // --------------------------------------------------------------------- //
310  // MODELDRAWMODECOLOR
311  // --------------------------------------------------------------------- //
323  USDGEOM_API
325 
331  USDGEOM_API
332  UsdAttribute CreateModelDrawModeColorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
333 
334 public:
335  // --------------------------------------------------------------------- //
336  // MODELCARDGEOMETRY
337  // --------------------------------------------------------------------- //
349  USDGEOM_API
351 
357  USDGEOM_API
358  UsdAttribute CreateModelCardGeometryAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
359 
360 public:
361  // --------------------------------------------------------------------- //
362  // MODELCARDTEXTUREXPOS
363  // --------------------------------------------------------------------- //
372  USDGEOM_API
374 
380  USDGEOM_API
381  UsdAttribute CreateModelCardTextureXPosAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
382 
383 public:
384  // --------------------------------------------------------------------- //
385  // MODELCARDTEXTUREYPOS
386  // --------------------------------------------------------------------- //
395  USDGEOM_API
397 
403  USDGEOM_API
404  UsdAttribute CreateModelCardTextureYPosAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
405 
406 public:
407  // --------------------------------------------------------------------- //
408  // MODELCARDTEXTUREZPOS
409  // --------------------------------------------------------------------- //
418  USDGEOM_API
420 
426  USDGEOM_API
427  UsdAttribute CreateModelCardTextureZPosAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
428 
429 public:
430  // --------------------------------------------------------------------- //
431  // MODELCARDTEXTUREXNEG
432  // --------------------------------------------------------------------- //
441  USDGEOM_API
443 
449  USDGEOM_API
450  UsdAttribute CreateModelCardTextureXNegAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
451 
452 public:
453  // --------------------------------------------------------------------- //
454  // MODELCARDTEXTUREYNEG
455  // --------------------------------------------------------------------- //
464  USDGEOM_API
466 
472  USDGEOM_API
473  UsdAttribute CreateModelCardTextureYNegAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
474 
475 public:
476  // --------------------------------------------------------------------- //
477  // MODELCARDTEXTUREZNEG
478  // --------------------------------------------------------------------- //
487  USDGEOM_API
489 
495  USDGEOM_API
496  UsdAttribute CreateModelCardTextureZNegAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
497 
498 public:
499  // ===================================================================== //
500  // Feel free to add custom code below this line, it will be preserved by
501  // the code generator.
502  //
503  // Just remember to:
504  // - Close the class declaration with };
505  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
506  // - Close the include guard with #endif
507  // ===================================================================== //
508  // --(BEGIN CUSTOM CODE)--
509 
516 
558  USDGEOM_API
559  bool GetExtentsHint(VtVec3fArray *extents,
560  const UsdTimeCode &time = UsdTimeCode::Default()) const;
561 
566  USDGEOM_API
567  bool SetExtentsHint(VtVec3fArray const &extents,
568  const UsdTimeCode &time = UsdTimeCode::Default()) const;
569 
571  USDGEOM_API
573 
581  USDGEOM_API
582  VtVec3fArray ComputeExtentsHint(UsdGeomBBoxCache& bboxCache) const;
583 
585 
592 
598  USDGEOM_API
600  const std::string &constraintName) const;
601 
607  USDGEOM_API
609  const std::string &constraintName) const;
610 
616  USDGEOM_API
617  std::vector<UsdGeomConstraintTarget> GetConstraintTargets() const;
618 
620 
640  USDGEOM_API
641  TfToken ComputeModelDrawMode(const TfToken &parentDrawMode=TfToken()) const;
642 };
643 
644 
645 PXR_NAMESPACE_CLOSE_SCOPE
646 
647 #endif
USDGEOM_API UsdAttribute CreateModelCardTextureZPosAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureZPosAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
USDGEOM_API bool GetExtentsHint(VtVec3fArray *extents, const UsdTimeCode &time=UsdTimeCode::Default()) const
Retrieve the authored value (if any) of this model's "extentsHint".
USDGEOM_API UsdAttribute CreateModelCardTextureYNegAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureYNegAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
USDGEOM_API UsdAttribute GetModelCardGeometryAttr() const
The geometry to generate for imaging prims inserted for cards imaging mode.
UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached...
Definition: modelAPI.h:148
static USDGEOM_API UsdGeomModelAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomModelAPI holding the prim adhering to this schema at path on stage.
USDGEOM_API UsdGeomConstraintTarget CreateConstraintTarget(const std::string &constraintName) const
Creates a new constraint target with the given name, constraintName.
Schema wrapper for UsdAttribute for authoring and introspecting attributes that are constraint target...
static USDGEOM_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
virtual USDGEOM_API ~UsdGeomModelAPI()
Destructor.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: modelAPI.h:154
USDGEOM_API UsdAttribute GetModelCardTextureXNegAttr() const
In cards imaging mode, the texture applied to the X- quad.
Caches bounds by recursively computing and aggregating bounds of children in world space and aggregat...
Definition: bboxCache.h:87
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
USDGEOM_API UsdAttribute GetModelCardTextureZPosAttr() const
In cards imaging mode, the texture applied to the Z+ quad.
static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
USDGEOM_API UsdAttribute CreateModelCardTextureXNegAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureXNegAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
USDGEOM_API UsdAttribute GetModelCardTextureZNegAttr() const
In cards imaging mode, the texture applied to the Z- quad.
Single Apply API schema.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
USDGEOM_API UsdGeomConstraintTarget GetConstraintTarget(const std::string &constraintName) const
Get the constraint target with the given name, constraintName.
USDGEOM_API UsdAttribute GetModelApplyDrawModeAttr() const
If true, and the resolved value of model:drawMode is non-default, apply an alternate imaging mode to ...
USDGEOM_API UsdAttribute CreateModelApplyDrawModeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelApplyDrawModeAttr(), and also Create vs Get Property Methods for when to use Get vs Creat...
USDGEOM_API UsdAttribute GetModelCardTextureYNegAttr() const
In cards imaging mode, the texture applied to the Y- quad.
USDGEOM_API UsdAttribute CreateModelDrawModeColorAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelDrawModeColorAttr(), and also Create vs Get Property Methods for when to use Get vs Creat...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
USDGEOM_API UsdAttribute CreateModelCardGeometryAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardGeometryAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
static USDGEOM_API UsdGeomModelAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDGEOM_API UsdAttribute CreateModelCardTextureXPosAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureXPosAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
USDGEOM_API UsdAttribute GetModelCardTextureXPosAttr() const
In cards imaging mode, the texture applied to the X+ quad.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
UsdGeomModelAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomModelAPI on UsdPrim prim .
Definition: modelAPI.h:160
USDGEOM_API UsdAttribute CreateModelCardTextureYPosAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureYPosAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
USDGEOM_API UsdAttribute GetExtentsHintAttr() const
Returns the custom 'extentsHint' attribute if it exits.
USDGEOM_API UsdAttribute GetModelCardTextureYPosAttr() const
In cards imaging mode, the texture applied to the Y+ quad.
USDGEOM_API UsdAttribute CreateModelDrawModeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelDrawModeAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
USDGEOM_API UsdAttribute GetModelDrawModeAttr() const
Alternate imaging mode; applied to this prim or child prims where model:applyDrawMode is true,...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:113
USDGEOM_API TfToken ComputeModelDrawMode(const TfToken &parentDrawMode=TfToken()) const
Calculate the effective model:drawMode of this prim.
USDGEOM_API UsdAttribute GetModelDrawModeColorAttr() const
The base color of imaging prims inserted for alternate imaging modes.
USDGEOM_API UsdAttribute CreateModelCardTextureZNegAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetModelCardTextureZNegAttr(), and also Create vs Get Property Methods for when to use Get vs Cre...
TfType represents a dynamic runtime type.
Definition: type.h:64
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDGEOM_API bool SetExtentsHint(VtVec3fArray const &extents, const UsdTimeCode &time=UsdTimeCode::Default()) const
Authors the extentsHint array for this model at the given time.
USDGEOM_API std::vector< UsdGeomConstraintTarget > GetConstraintTargets() const
Returns all the constraint targets belonging to the model.
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
USDGEOM_API VtVec3fArray ComputeExtentsHint(UsdGeomBBoxCache &bboxCache) const
For the given model, compute the value for the extents hint with the given bboxCache.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
UsdGeomModelAPI(const UsdSchemaBase &schemaObj)
Construct a UsdGeomModelAPI on the prim held by schemaObj .
Definition: modelAPI.h:168