![]() |
The base class for all API schemas. More...
Public Member Functions | |
UsdAPISchemaBase (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdAPISchemaBase on UsdPrim prim . More... | |
UsdAPISchemaBase (const UsdSchemaBase &schemaObj) | |
Construct a UsdAPISchemaBase on the prim held by schemaObj . More... | |
virtual USD_API | ~UsdAPISchemaBase ()=0 |
Destructor. More... | |
![]() | |
bool | IsConcrete () const |
Returns whether or not this class corresponds to a concrete instantiable prim type in scene description. More... | |
bool | IsTyped () const |
Returns whether or not this class inherits from UsdTyped. More... | |
bool | IsAPISchema () const |
Returns whether this is an API schema or not. More... | |
bool | IsAppliedAPISchema () const |
Returns whether this is an applied API schema or not. More... | |
bool | IsMultipleApplyAPISchema () const |
Returns whether this is an applied API schema or not. More... | |
UsdSchemaKind | GetSchemaKind () const |
Returns the kind of schema this class is. More... | |
USD_API | UsdSchemaBase (const UsdPrim &prim=UsdPrim()) |
Construct and store prim as the held prim. More... | |
USD_API | UsdSchemaBase (const UsdSchemaBase &otherSchema) |
Construct and store for the same prim held by otherSchema . More... | |
virtual USD_API | ~UsdSchemaBase () |
Destructor. More... | |
USD_API | operator bool () const |
UsdPrim | GetPrim () const |
Return this schema object's held prim. More... | |
SdfPath | GetPath () const |
Shorthand for GetPrim()->GetPath(). More... | |
USD_API const UsdPrimDefinition * | GetSchemaClassPrimDefinition () const |
Return the prim definition associated with this schema instance if one exists, otherwise return null. More... | |
Static Public Member Functions | |
static USD_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 classes. More... | |
![]() | |
static const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Attributes | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Compile time constant representing what kind of schema this class is. More... | |
![]() | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Compile time constant representing what kind of schema this class is. More... | |
Protected Member Functions | |
USD_API UsdSchemaKind | _GetSchemaKind () const override |
Returns the kind of schema this class belongs to. More... | |
UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName) | |
Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim with the specified instanceName . More... | |
UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName) | |
Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj with the given instanceName . More... | |
const TfToken & | _GetInstanceName () const |
Returns the instance name of the API schema object belonging to a multiple-apply API schema. More... | |
USD_API bool | _IsCompatible () const override |
Check whether this APISchema object is valid for the currently held prim. More... | |
![]() | |
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 |
Static Protected Member Functions | |
template<typename APISchemaType > | |
static APISchemaType | _ApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName) |
Helper method to apply a single-apply API schema with the given schema name apiSchemaName' and C++ type 'APISchemaType'. More... | |
template<typename APISchemaType > | |
static APISchemaType | _MultipleApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName, const TfToken &instanceName) |
Helper method to apply a multiple-apply API schema with the given schema name apiSchemaName' , C++ type 'APISchemaType' and instance name instanceName . More... | |
Friends | |
class | UsdSchemaRegistry |
The base class for all API schemas.
An API schema provides an interface to a prim's qualities, but does not specify a typeName for the underlying prim. The prim's qualities include its inheritance structure, attributes, relationships etc. Since it cannot provide a typeName, an API schema is considered to be non-concrete.
To auto-generate an API schema using usdGenSchema, simply leave the typeName empty and make it inherit from "/APISchemaBase" or from another API schema. See UsdModelAPI, UsdClipsAPI and UsdCollectionAPI for examples.
API schemas are classified into applied and non-applied API schemas. The author of an API schema has to decide on the type of API schema at the time of its creation by setting customData['apiSchemaType'] in the schema definition (i.e. in the associated primSpec inside the schema.usda file). UsdAPISchemaBase implements methods that are used to record the application of an API schema on a USD prim.
If an API schema only provides an interface to set certain core bits of metadata (like UsdModelAPI, which sets model kind and UsdClipsAPI, which sets clips-related metadata) OR if the API schema can apply to any type of prim or only to a known fixed set of prim types OR if there is no use of recording the application of the API schema, in such cases, it would be better to make it a non-applied API schema. Examples of non-applied API schemas include UsdModelAPI, UsdClipsAPI, UsdShadeConnectableAPI and UsdGeomPrimvarsAPI.
If there is a need to discover (or record) whether a prim contains or subscribes to a given API schema, it would be advantageous to make the API schema be "applied". In general, API schemas that add one or more properties to a prim should be tagged as applied API schemas. A public Apply() method is generated for applied API schemas by usdGenSchema. An applied API schema must be applied to a prim via a call to the generated Apply() method, for the schema object to evaluate to true when converted to a bool using the explicit bool conversion operator. Examples of applied API schemas include UsdCollectionAPI, UsdGeomModelAPI and UsdGeomMotionAPI
Definition at line 116 of file apiSchemaBase.h.
|
inlineexplicit |
Construct a UsdAPISchemaBase on UsdPrim prim
.
Equivalent to UsdAPISchemaBase::Get(prim.GetStage(), prim.GetPath()) for a valid prim
, but will not immediately throw an error for an invalid prim
Definition at line 128 of file apiSchemaBase.h.
|
inlineexplicit |
Construct a UsdAPISchemaBase on the prim held by schemaObj
.
Should be preferred over UsdAPISchemaBase(schemaObj.GetPrim()), as it preserves SchemaBase state.
Definition at line 136 of file apiSchemaBase.h.
|
pure virtual |
Destructor.
|
inlineexplicitprotected |
Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim
with the specified instanceName
.
Definition at line 187 of file apiSchemaBase.h.
|
inlineexplicitprotected |
Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj
with the given instanceName
.
Definition at line 196 of file apiSchemaBase.h.
|
inlinestaticprotected |
Helper method to apply a single-apply API schema with the given schema name apiSchemaName'
and C++ type 'APISchemaType'.
The schema is applied on the given prim
in the current edit target.
This information is stored by adding apiSchemaName
value to the token-valued, listOp metadata apiSchemas on the prim.
A valid schema object of type APISchemaType is returned upon success.
A coding error is issued and an invalid schema object is returned if if prim
is invalid or is an instance proxy prim or is contained within an instance prototype OR apiSchemaName
cannot be added to the apiSchemas listOp metadata.
A run-time error is issued and an invalid schema object is returned if the given prim is valid, but cannot be reached or overridden in the current edit target.
Definition at line 234 of file apiSchemaBase.h.
|
inlineprotected |
Returns the instance name of the API schema object belonging to a multiple-apply API schema.
The returned instance name will be empty for non-applied and single-apply API schemas.
Definition at line 208 of file apiSchemaBase.h.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdSchemaBase.
Reimplemented in UsdCollectionAPI, UsdLuxListAPI, UsdShadeMaterialBindingAPI, UsdGeomModelAPI, UsdPhysicsDriveAPI, UsdPhysicsLimitAPI, UsdShadeNodeDefAPI, UsdRiSplineAPI, UsdRiMaterialAPI, UsdRiStatementsAPI, UsdSkelBindingAPI, UsdClipsAPI, UsdRiLightFilterAPI, UsdGeomMotionAPI, UsdPhysicsMeshCollisionAPI, UsdUINodeGraphNodeAPI, UsdUISceneGraphPrimAPI, UsdPhysicsArticulationRootAPI, UsdPhysicsFilteredPairsAPI, UsdRiLightAPI, UsdLuxShadowAPI, UsdPhysicsCollisionAPI, UsdRiLightPortalAPI, UsdRiTextureAPI, UsdLuxShapingAPI, UsdPhysicsRigidBodyAPI, UsdPhysicsMassAPI, UsdPhysicsMaterialAPI, UsdRenderSettingsAPI, UsdGeomXformCommonAPI, UsdGeomPrimvarsAPI, UsdShadeConnectableAPI, UsdShadeCoordSysAPI, and UsdModelAPI.
|
overrideprotectedvirtual |
Check whether this APISchema object is valid for the currently held prim.
If this is an applied API schema, this returns true if the held prim is valid and already has the API schema applied to it, along with the instanceName (in the case of multiple-apply). The instanceName should not be empty in the case of a multiple-apply API schema.
This check is performed when clients invoke the explicit bool conversion operator, implemented in UsdSchemaBase.
Reimplemented from UsdSchemaBase.
Reimplemented in UsdGeomXformCommonAPI, and UsdShadeConnectableAPI.
|
inlinestaticprotected |
Helper method to apply a multiple-apply API schema with the given schema name apiSchemaName'
, C++ type 'APISchemaType' and instance name instanceName
.
The schema is applied on the given prim
in the current edit target.
This information is stored in the token-valued, listOp metadata apiSchemas on the prim. For example, if apiSchemaName
is 'CollectionAPI' and instanceName
is 'plasticStuff', the name 'CollectionAPI:plasticStuff' is added to 'apiSchemas' listOp metadata.
A valid schema object of type APISchemaType is returned upon success.
A coding error is issued and an invalid schema object is returned if the prim
is invalid or is an instance proxy prim or is contained within an instance prototype OR instanceName
is empty OR apiSchemaName:instanceName cannot be added to the apiSchemas listOp metadata.
A run-time error is issued and an invalid schema object is returned if the given prim is valid, but cannot be reached or overridden in the current edit target.
Definition at line 269 of file apiSchemaBase.h.
|
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.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 122 of file apiSchemaBase.h.