Loading...
Searching...
No Matches
UsdGeomModelAPI Class Reference

UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached extents for the entire model, constraint targets, and geometry-inspired extensions to the payload lofting process. More...

#include <modelAPI.h>

+ Inheritance diagram for UsdGeomModelAPI:

Public Member Functions

 UsdGeomModelAPI (const UsdPrim &prim=UsdPrim())
 Construct a UsdGeomModelAPI on UsdPrim prim .
 
 UsdGeomModelAPI (const UsdSchemaBase &schemaObj)
 Construct a UsdGeomModelAPI on the prim held by schemaObj .
 
virtual USDGEOM_API ~UsdGeomModelAPI ()
 Destructor.
 
USDGEOM_API UsdAttribute GetModelDrawModeAttr () const
 Alternate imaging mode; applied to this prim or child prims where model:applyDrawMode is true, or where the prim has kind component and model:applyDrawMode is not authored.
 
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.
 
USDGEOM_API UsdAttribute GetModelApplyDrawModeAttr () const
 If true, and the resolved value of model:drawMode is non-default, apply an alternate imaging mode to this prim.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelDrawModeColorAttr () const
 The base color of imaging prims inserted for alternate imaging modes.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardGeometryAttr () const
 The geometry to generate for imaging prims inserted for cards imaging mode.
 
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.
 
USDGEOM_API UsdAttribute GetModelCardTextureXPosAttr () const
 In cards imaging mode, the texture applied to the X+ quad.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardTextureYPosAttr () const
 In cards imaging mode, the texture applied to the Y+ quad.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardTextureZPosAttr () const
 In cards imaging mode, the texture applied to the Z+ quad.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardTextureXNegAttr () const
 In cards imaging mode, the texture applied to the X- quad.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardTextureYNegAttr () const
 In cards imaging mode, the texture applied to the Y- quad.
 
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 Create.
 
USDGEOM_API UsdAttribute GetModelCardTextureZNegAttr () const
 In cards imaging mode, the texture applied to the Z- quad.
 
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 Create.
 
USDGEOM_API TfToken ComputeModelDrawMode (const TfToken &parentDrawMode=TfToken()) const
 Calculate the effective model:drawMode of this prim.
 
Model Extents Hint API

Methods for querying, authoring and computing the model's "extentsHint".

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 bool SetExtentsHint (VtVec3fArray const &extents, const UsdTimeCode &time=UsdTimeCode::Default()) const
 Authors the extentsHint array for this model at the given time.
 
USDGEOM_API UsdAttribute GetExtentsHintAttr () const
 Returns the custom 'extentsHint' attribute if it exits.
 
USDGEOM_API VtVec3fArray ComputeExtentsHint (UsdGeomBBoxCache &bboxCache) const
 Compute a value suitable for passing to SetExtentsHint().
 
Model Constraint Targets API

Methods for adding and listing constraint targets.

USDGEOM_API UsdGeomConstraintTarget GetConstraintTarget (const std::string &constraintName) const
 Get the constraint target with the given name, constraintName.
 
USDGEOM_API UsdGeomConstraintTarget CreateConstraintTarget (const std::string &constraintName) const
 Creates a new constraint target with the given name, constraintName.
 
USDGEOM_API std::vector< UsdGeomConstraintTargetGetConstraintTargets () const
 Returns all the constraint targets belonging to the model.
 
- Public Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 Construct a UsdAPISchemaBase on UsdPrim prim .
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 Construct a UsdAPISchemaBase on the prim held by schemaObj .
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor.
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 Returns whether or not this class corresponds to a concrete instantiable prim type in scene description.
 
bool IsTyped () const
 Returns whether or not this class inherits from UsdTyped.
 
bool IsAPISchema () const
 Returns whether this is an API schema or not.
 
bool IsAppliedAPISchema () const
 Returns whether this is an applied API schema or not.
 
bool IsMultipleApplyAPISchema () const
 Returns whether this is an applied API schema or not.
 
UsdSchemaKind GetSchemaKind () const
 Returns the kind of schema this class is.
 
USD_API UsdSchemaBase (const UsdPrim &prim=UsdPrim())
 Construct and store prim as the held prim.
 
USD_API UsdSchemaBase (const UsdSchemaBase &otherSchema)
 Construct and store for the same prim held by otherSchema.
 
virtual USD_API ~UsdSchemaBase ()
 Destructor.
 
UsdPrim GetPrim () const
 Return this schema object's held prim.
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath().
 
USD_API const UsdPrimDefinitionGetSchemaClassPrimDefinition () const
 Return the prim definition associated with this schema instance if one exists, otherwise return null.
 
USD_API operator bool () const
 Return true if this schema object is compatible with its held prim, false otherwise.
 

Static Public Member Functions

static USDGEOM_API const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
 
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.
 
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.
 
static USDGEOM_API UsdGeomModelAPI Apply (const UsdPrim &prim)
 Applies this single-apply API schema to the given prim.
 
- Static Public Member Functions inherited from UsdAPISchemaBase
static USD_API const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI
 Compile time constant representing what kind of schema this class is.
 
- Static Public Attributes inherited from UsdAPISchemaBase
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 Compile time constant representing what kind of schema this class is.
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 Compile time constant representing what kind of schema this class is.
 

Protected Member Functions

USDGEOM_API UsdSchemaKind _GetSchemaKind () const override
 Returns the kind of schema this class belongs to.
 
- Protected Member Functions inherited from UsdAPISchemaBase
USD_API UsdSchemaKind _GetSchemaKind () const override
 Returns the kind of schema this class belongs to.
 
 UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim with the specified instanceName.
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj with the given instanceName.
 
const TfToken_GetInstanceName () const
 Returns the instance name of the API schema object belonging to a multiple-apply API schema.
 
USD_API bool _IsCompatible () const override
 Check whether this APISchema object is valid for the currently held
prim.
 
- Protected Member Functions inherited from UsdSchemaBase
virtual UsdSchemaKind _GetSchemaType () const
 
const TfType_GetType () const
 
USD_API UsdAttribute _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
 

Friends

class UsdSchemaRegistry
 

Additional Inherited Members

- Static Protected Member Functions inherited from UsdAPISchemaBase
static USD_API TfTokenVector _GetMultipleApplyInstanceNames (const UsdPrim &prim, const TfType &schemaType)
 Returns a vector of names of API schema objects belonging to a multiple-apply API schema applied to a given prim.
 

Detailed Description

UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached extents for the entire model, constraint targets, and geometry-inspired extensions to the payload lofting process.

As described in GetExtentsHint() below, it is useful to cache extents at the model level. UsdGeomModelAPI provides schema for computing and storing these cached extents, which can be consumed by UsdGeomBBoxCache to provide fast access to precomputed extents that will be used as the model's bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ).

Draw Modes

Draw modes provide optional alternate imaging behavior for USD subtrees with kind model. model:drawMode (which is inheritable) and model:applyDrawMode (which is not) are resolved into a decision to stop traversing the scene graph at a certain point, and replace a USD subtree with proxy geometry.

The value of model:drawMode determines the type of proxy geometry:

  • origin - Draw the model-space basis vectors of the replaced prim.
  • bounds - Draw the model-space bounding box of the replaced prim.
  • cards - Draw textured quads as a placeholder for the replaced prim.
  • default - An explicit opinion to draw the USD subtree as normal.
  • inherited - Defer to the parent opinion.

model:drawMode falls back to inherited so that a whole scene, a large group, or all prototypes of a model hierarchy PointInstancer can be assigned a draw mode with a single attribute edit. If no draw mode is explicitly set in a hierarchy, the resolved value is default.

model:applyDrawMode is meant to be written when an asset is authored, and provides flexibility for different asset types. For example, a character assembly (composed of character, clothes, etc) might have model:applyDrawMode set at the top of the subtree so the whole group can be drawn as a single card object. An effects subtree might have model:applyDrawMode set at a lower level so each particle group draws individually.

Models of kind component are automatically treated as if model:applyDrawMode were true if model:applyDrawMode is not authored on the component prim. A component prim will be drawn drawn with a simplified representation when the prim has kind component, model:applyDrawMode is not authored (or authored to be true), and the resolved (i.e. inherited down namespace) value for model:drawMode is not default. If you don't want component prims to use the resolved non-default drawMode, you must apply the UsdGeomModelAPI schema on the prim and explicitly set model:applyDrawMode to false.

Cards Geometry

The specific geometry used in cards mode is controlled by the model:cardGeometry attribute:

  • cross - Generate a quad normal to each basis direction and negative. Locate each quad so that it bisects the model extents.
  • box - Generate a quad normal to each basis direction and negative. Locate each quad on a face of the model extents, facing out.
  • fromTexture - Generate a quad for each supplied texture from attributes stored in that texture's metadata.

For cross and box mode, the extents are calculated for purposes default, proxy, and render, at their earliest authored time. If the model has no textures, all six card faces are rendered using model:drawModeColor. If one or more textures are present, only axes with one or more textures assigned are drawn. For each axis, if both textures (positive and negative) are specified, they'll be used on the corresponding card faces; if only one texture is specified, it will be mapped to the opposite card face after being flipped on the texture's s-axis. Any card faces with invalid asset paths will be drawn with model:drawModeColor.

Both model:cardGeometry and model:drawModeColor should be authored on the prim where the draw mode takes effect, since these attributes are not inherited.

For fromTexture mode, only card faces with valid textures assigned are drawn. The geometry is generated by pulling the worldtoscreen attribute out of texture metadata. This is expected to be a 4x4 matrix mapping the model-space position of the card quad to the clip-space quad with corners (-1,-1,0) and (1,1,0). The card vertices are generated by transforming the clip-space corners by the inverse of worldtoscreen. Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. If the metadata cannot be read in the right format, or the matrix can't be inverted, the card face is not drawn.

All card faces are drawn and textured as single-sided.

For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value.

Definition at line 153 of file modelAPI.h.

Constructor & Destructor Documentation

◆ UsdGeomModelAPI() [1/2]

UsdGeomModelAPI ( const UsdPrim prim = UsdPrim())
inlineexplicit

Construct a UsdGeomModelAPI on UsdPrim prim .

Equivalent to UsdGeomModelAPI::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim

Definition at line 165 of file modelAPI.h.

◆ UsdGeomModelAPI() [2/2]

UsdGeomModelAPI ( const UsdSchemaBase schemaObj)
inlineexplicit

Construct a UsdGeomModelAPI on the prim held by schemaObj .

Should be preferred over UsdGeomModelAPI(schemaObj.GetPrim()), as it preserves SchemaBase state.

Definition at line 173 of file modelAPI.h.

◆ ~UsdGeomModelAPI()

virtual USDGEOM_API ~UsdGeomModelAPI ( )
virtual

Destructor.

Member Function Documentation

◆ _GetSchemaKind()

USDGEOM_API UsdSchemaKind _GetSchemaKind ( ) const
overrideprotectedvirtual

Returns the kind of schema this class belongs to.

See also
UsdSchemaKind

Reimplemented from UsdAPISchemaBase.

◆ Apply()

static USDGEOM_API UsdGeomModelAPI Apply ( const UsdPrim prim)
static

Applies this single-apply API schema to the given prim.

This information is stored by adding "GeomModelAPI" to the token-valued, listOp metadata apiSchemas on the prim.

Returns
A valid UsdGeomModelAPI object is returned upon success. An invalid (or empty) UsdGeomModelAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure.
See also
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()

◆ CanApply()

static USDGEOM_API bool CanApply ( const UsdPrim prim,
std::string *  whyNot = nullptr 
)
static

Returns true if this single-apply API schema can be applied to the given prim.

If this schema can not be a applied to the prim, this returns false and, if provided, populates whyNot with the reason it can not be applied.

Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema.

See also
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()

◆ ComputeExtentsHint()

USDGEOM_API VtVec3fArray ComputeExtentsHint ( UsdGeomBBoxCache bboxCache) const

Compute a value suitable for passing to SetExtentsHint().

If this model is a UsdGeomBoundable, call UsdGeomBoundable::ComputeExtentFromPlugins() with the bboxCache 's time code. If that function returns true, then populate the returned array with the min and max repeated according to the number of tokens in UsdGeomImageable::GetOrderedPurposeTokens(). Otherwise return an array with a single empty range.

If this model is not a UsdGeomBoundable, populate the return value by calling UsdGeomBBoxCache::ComputeUntransformedBound() (and GfBBox3d::ComputeAlignedBox() on that result) for each token in UsdGeomImageable::GetOrderedPurposeTokens().

In either case the, Nth successive pair of entries in the returned array will be the min and max coordinates of the extent corresponding to the Nth token in UsdGeomImageable::GetOrderedPurposeTokens(), except trailing empty boxes are omitted, unless all boxes are empty in which case the result is a single empty box.

For example, if GetOrderedPurposeTokens() is [default, render, proxy, guide] and this function returns [(0,0,0), (1,1,1), (+FLT_MAX), (-FLT_MIN), (0,0,0), (1,1,1)] then this means that the computed extents for 'default' and 'proxy' purpose are [(0,0,0), (1,1,1)] and the extents for 'render' and 'guide' purposes are empty.

This function modifies bboxCache's included purposes.

Note
bboxCache must not be used concurrently during the execution of this function.

◆ ComputeModelDrawMode()

USDGEOM_API TfToken ComputeModelDrawMode ( const TfToken parentDrawMode = TfToken()) const

Calculate the effective model:drawMode of this prim.

If the draw mode is authored on this prim, it's used. Otherwise, the fallback value is "inherited", which defers to the parent opinion. The first non-inherited opinion found walking from this prim towards the root is used. If the attribute isn't set on any ancestors, we return "default" (meaning, disable "drawMode" geometry).

If this function is being called in a traversal context to compute the draw mode of an entire hierarchy of prims, it would be beneficial to cache and pass in the computed parent draw-mode via the parentDrawMode parameter. This avoids repeated upward traversal to look for ancestor opinions.

When parentDrawMode is empty (or unspecified), this function does an upward traversal to find the closest ancestor with an authored model:drawMode.

See also
GetModelDrawModeAttr()

◆ CreateConstraintTarget()

USDGEOM_API UsdGeomConstraintTarget CreateConstraintTarget ( const std::string &  constraintName) const

Creates a new constraint target with the given name, constraintName.

If the constraint target already exists, then the existing target is returned. If it does not exist, a new one is created and returned.

◆ CreateModelApplyDrawModeAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardGeometryAttr()

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.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureXNegAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureXPosAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureYNegAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureYPosAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureZNegAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelCardTextureZPosAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelDrawModeAttr()

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.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ CreateModelDrawModeColorAttr()

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 Create.

If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

◆ Get()

static USDGEOM_API UsdGeomModelAPI Get ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Return a UsdGeomModelAPI holding the prim adhering to this schema at path on stage.

If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:

UsdGeomModelAPI(stage->GetPrimAtPath(path));
UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached...
Definition: modelAPI.h:154

◆ GetConstraintTarget()

USDGEOM_API UsdGeomConstraintTarget GetConstraintTarget ( const std::string &  constraintName) const

Get the constraint target with the given name, constraintName.

If the requested constraint target does not exist, then an invalid UsdConstraintTarget object is returned.

◆ GetConstraintTargets()

USDGEOM_API std::vector< UsdGeomConstraintTarget > GetConstraintTargets ( ) const

Returns all the constraint targets belonging to the model.

Only valid constraint targets in the "constraintTargets" namespace are returned by this method.

◆ GetExtentsHint()

USDGEOM_API bool GetExtentsHint ( VtVec3fArray *  extents,
const UsdTimeCode time = UsdTimeCode::Default() 
) const

Retrieve the authored value (if any) of this model's "extentsHint".

Persistent caching of bounds in USD is a potentially perilous endeavor, given that:

  • It is very easy to add overrides in new super-layers that invalidate the cached bounds, and no practical way to automatically detect when this happens
  • It is possible for references to be allowed to "float", so that asset updates can flow directly into cached scenes. Such changes in referenced scene description can also invalidate cached bounds in referencing layers.

For these reasons, as a general rule, we only persistently cache leaf gprim extents in object space. However, even with cached gprim extents, computing bounds can be expensive. Since model-level bounds are so useful to many graphics applications, we make an exception, with some caveats. The "extentsHint" should be considered entirely optional (whereas gprim extent is not); if authored, it should contains the extents for various values of gprim purposes. The extents for different values of purpose are stored in a linear Vec3f array as pairs of GfVec3f values in the order specified by UsdGeomImageable::GetOrderedPurposeTokens(). This list is trimmed to only include non-empty extents. i.e., if a model has only default and render geoms, then it will only have 4 GfVec3f values in its extentsHint array. We do not skip over zero extents, so if a model has only default and proxy geom, we will author six GfVec3f's, the middle two representing an zero extent for render geometry.

A UsdGeomBBoxCache can be configured to first consult the cached extents when evaluating model roots, rather than descending into the models for the full computation. This is not the default behavior, and gives us a convenient way to validate that the cached extentsHint is still valid.

Returns
true if a value was fetched; false if no value was authored, or on error. It is an error to make this query of a prim that is not a model root.
See also
UsdGeomImageable::GetPurposeAttr(), UsdGeomImageable::GetOrderedPurposeTokens()

◆ GetExtentsHintAttr()

USDGEOM_API UsdAttribute GetExtentsHintAttr ( ) const

Returns the custom 'extentsHint' attribute if it exits.

◆ GetModelApplyDrawModeAttr()

USDGEOM_API UsdAttribute GetModelApplyDrawModeAttr ( ) const

If true, and the resolved value of model:drawMode is non-default, apply an alternate imaging mode to this prim.

See Draw Modes.

Declaration uniform bool model:applyDrawMode = 0
C++ Type bool
Usd Type SdfValueTypeNames->Bool
Variability SdfVariabilityUniform

◆ GetModelCardGeometryAttr()

USDGEOM_API UsdAttribute GetModelCardGeometryAttr ( ) const

The geometry to generate for imaging prims inserted for cards imaging mode.

See Cards Geometry for geometry descriptions.

Declaration uniform token model:cardGeometry = "cross"
C++ Type TfToken
Usd Type SdfValueTypeNames->Token
Variability SdfVariabilityUniform
Allowed Values cross, box, fromTexture

◆ GetModelCardTextureXNegAttr()

USDGEOM_API UsdAttribute GetModelCardTextureXNegAttr ( ) const

In cards imaging mode, the texture applied to the X- quad.

The texture axes (s,t) are mapped to model-space axes (y, -z).

Declaration asset model:cardTextureXNeg
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelCardTextureXPosAttr()

USDGEOM_API UsdAttribute GetModelCardTextureXPosAttr ( ) const

In cards imaging mode, the texture applied to the X+ quad.

The texture axes (s,t) are mapped to model-space axes (-y, -z).

Declaration asset model:cardTextureXPos
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelCardTextureYNegAttr()

USDGEOM_API UsdAttribute GetModelCardTextureYNegAttr ( ) const

In cards imaging mode, the texture applied to the Y- quad.

The texture axes (s,t) are mapped to model-space axes (-x, -z).

Declaration asset model:cardTextureYNeg
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelCardTextureYPosAttr()

USDGEOM_API UsdAttribute GetModelCardTextureYPosAttr ( ) const

In cards imaging mode, the texture applied to the Y+ quad.

The texture axes (s,t) are mapped to model-space axes (x, -z).

Declaration asset model:cardTextureYPos
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelCardTextureZNegAttr()

USDGEOM_API UsdAttribute GetModelCardTextureZNegAttr ( ) const

In cards imaging mode, the texture applied to the Z- quad.

The texture axes (s,t) are mapped to model-space axes (-x, -y).

Declaration asset model:cardTextureZNeg
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelCardTextureZPosAttr()

USDGEOM_API UsdAttribute GetModelCardTextureZPosAttr ( ) const

In cards imaging mode, the texture applied to the Z+ quad.

The texture axes (s,t) are mapped to model-space axes (x, -y).

Declaration asset model:cardTextureZPos
C++ Type SdfAssetPath
Usd Type SdfValueTypeNames->Asset

◆ GetModelDrawModeAttr()

USDGEOM_API UsdAttribute GetModelDrawModeAttr ( ) const

Alternate imaging mode; applied to this prim or child prims where model:applyDrawMode is true, or where the prim has kind component and model:applyDrawMode is not authored.

See Draw Modes for mode descriptions.

Declaration uniform token model:drawMode = "inherited"
C++ Type TfToken
Usd Type SdfValueTypeNames->Token
Variability SdfVariabilityUniform
Allowed Values origin, bounds, cards, default, inherited

◆ GetModelDrawModeColorAttr()

USDGEOM_API UsdAttribute GetModelDrawModeColorAttr ( ) const

The base color of imaging prims inserted for alternate imaging modes.

For origin and bounds modes, this controls line color; for cards mode, this controls the fallback quad color.

Declaration uniform float3 model:drawModeColor = (0.18, 0.18, 0.18)
C++ Type GfVec3f
Usd Type SdfValueTypeNames->Float3
Variability SdfVariabilityUniform

◆ GetSchemaAttributeNames()

static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames ( bool  includeInherited = true)
static

Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.

Does not include attributes that may be authored by custom/extended methods of the schemas involved.

◆ SetExtentsHint()

USDGEOM_API bool SetExtentsHint ( VtVec3fArray const &  extents,
const UsdTimeCode time = UsdTimeCode::Default() 
) const

Authors the extentsHint array for this model at the given time.

See also
GetExtentsHint()

Friends And Related Function Documentation

◆ UsdSchemaRegistry

friend class UsdSchemaRegistry
friend

Definition at line 251 of file modelAPI.h.

Member Data Documentation

◆ schemaKind

const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI
static

Compile time constant representing what kind of schema this class is.

See also
UsdSchemaKind

Definition at line 159 of file modelAPI.h.


The documentation for this class was generated from the following file: