HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdAPISchemaBase Class Referenceabstract

#include <apiSchemaBase.h>

+ Inheritance diagram for UsdAPISchemaBase:

Public Member Functions

 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor. More...
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 
bool IsTyped () const
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 
bool IsMultipleApplyAPISchema () const
 
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 UsdPrimDefinitionGetSchemaClassPrimDefinition () const
 

Static Public Member Functions

static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 

Protected Member Functions

USD_API UsdSchemaKind _GetSchemaKind () const override
 
 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
 

Detailed Description

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.

Constructor & Destructor Documentation

UsdAPISchemaBase::UsdAPISchemaBase ( const UsdPrim prim = UsdPrim())
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.

UsdAPISchemaBase::UsdAPISchemaBase ( const UsdSchemaBase schemaObj)
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.

virtual USD_API UsdAPISchemaBase::~UsdAPISchemaBase ( )
pure virtual

Destructor.

UsdAPISchemaBase::UsdAPISchemaBase ( const UsdPrim prim,
const TfToken instanceName 
)
inlineexplicitprotected

Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim with the specified instanceName.

Definition at line 187 of file apiSchemaBase.h.

UsdAPISchemaBase::UsdAPISchemaBase ( const UsdSchemaBase schemaObj,
const TfToken instanceName 
)
inlineexplicitprotected

Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj with the given instanceName.

Definition at line 196 of file apiSchemaBase.h.

Member Function Documentation

const TfToken& UsdAPISchemaBase::_GetInstanceName ( ) const
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.

USD_API bool UsdAPISchemaBase::_IsCompatible ( ) const
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.

See Also
UsdPrim::HasAPI()

Reimplemented from UsdSchemaBase.

Reimplemented in UsdGeomXformCommonAPI, and UsdShadeConnectableAPI.

static USD_API const TfTokenVector& UsdAPISchemaBase::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.

Friends And Related Function Documentation

friend class UsdSchemaRegistry
friend

Definition at line 162 of file apiSchemaBase.h.

Member Data Documentation

const UsdSchemaKind UsdAPISchemaBase::schemaKind = UsdSchemaKind::AbstractBase
static

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

See Also
UsdSchemaKind

Definition at line 122 of file apiSchemaBase.h.


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