HDK
|
#include <modelAPI.h>
Static Public Member Functions | |
static USDGEOM_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
static USDGEOM_API UsdGeomModelAPI | Get (const UsdStagePtr &stage, const SdfPath &path) |
static USDGEOM_API bool | CanApply (const UsdPrim &prim, std::string *whyNot=nullptr) |
static USDGEOM_API UsdGeomModelAPI | Apply (const UsdPrim &prim) |
Static Public Member Functions inherited from UsdAPISchemaBase | |
static USD_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Member Functions inherited from UsdSchemaBase | |
static const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Attributes | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::SingleApplyAPI |
Static Public Attributes inherited from UsdAPISchemaBase | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Static Public Attributes inherited from UsdSchemaBase | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Protected Member Functions | |
USDGEOM_API UsdSchemaKind | _GetSchemaKind () const override |
Protected Member Functions inherited from UsdAPISchemaBase | |
UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName) | |
UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName) | |
const TfToken & | _GetInstanceName () const |
USD_API bool | _IsCompatible () const override |
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) |
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 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:
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.
The specific geometry used in cards mode is controlled by the model:cardGeometry attribute:
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.
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.
|
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.
|
virtual |
Destructor.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdAPISchemaBase.
|
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.
|
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.
USDGEOM_API VtVec3fArray UsdGeomModelAPI::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.
bboxCache
must not be used concurrently during the execution of this function. USDGEOM_API TfToken UsdGeomModelAPI::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.
USDGEOM_API UsdGeomConstraintTarget UsdGeomModelAPI::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.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelApplyDrawModeAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelApplyDrawModeAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardGeometryAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardGeometryAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureXNegAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureXNegAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureXPosAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureXPosAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureYNegAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureYNegAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureYPosAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureYPosAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureZNegAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureZNegAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelCardTextureZPosAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelCardTextureZPosAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelDrawModeAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelDrawModeAttr(), and also Usd_Create_Or_Get_Property 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
.
USDGEOM_API UsdAttribute UsdGeomModelAPI::CreateModelDrawModeColorAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetModelDrawModeColorAttr(), and also Usd_Create_Or_Get_Property 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
.
|
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:
USDGEOM_API UsdGeomConstraintTarget UsdGeomModelAPI::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.
USDGEOM_API std::vector<UsdGeomConstraintTarget> UsdGeomModelAPI::GetConstraintTargets | ( | ) | const |
Returns all the constraint targets belonging to the model.
Only valid constraint targets in the "constraintTargets" namespace are returned by this method.
USDGEOM_API bool UsdGeomModelAPI::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:
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.
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.USDGEOM_API UsdAttribute UsdGeomModelAPI::GetExtentsHintAttr | ( | ) | const |
Returns the custom 'extentsHint' attribute if it exits.
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
USDGEOM_API UsdAttribute UsdGeomModelAPI::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 |
|
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.
USDGEOM_API bool UsdGeomModelAPI::SetExtentsHint | ( | VtVec3fArray const & | extents, |
const UsdTimeCode & | time = UsdTimeCode::Default() |
||
) | const |
Authors the extentsHint array for this model at the given time.
|
friend |
Definition at line 251 of file modelAPI.h.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 159 of file modelAPI.h.