usdrt::UsdAPISchemaBase
Defined in usdrt/scenegraph/usd/usd/apiSchemaBase.h
-
class UsdAPISchemaBase : public usdrt::UsdSchemaBase
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
Subclassed by usdrt::ForceFieldSchemaPhysxForceFieldAPI, usdrt::ForceFieldSchemaPhysxForceFieldConicalAPI, usdrt::ForceFieldSchemaPhysxForceFieldDragAPI, usdrt::ForceFieldSchemaPhysxForceFieldLinearAPI, usdrt::ForceFieldSchemaPhysxForceFieldNoiseAPI, usdrt::ForceFieldSchemaPhysxForceFieldPlanarAPI, usdrt::ForceFieldSchemaPhysxForceFieldRingAPI, usdrt::ForceFieldSchemaPhysxForceFieldSphericalAPI, usdrt::ForceFieldSchemaPhysxForceFieldSpinAPI, usdrt::ForceFieldSchemaPhysxForceFieldWindAPI, usdrt::PhysxSchemaJointStateAPI, usdrt::PhysxSchemaPhysxArticulationAPI, usdrt::PhysxSchemaPhysxArticulationForceSensorAPI, usdrt::PhysxSchemaPhysxAutoAttachmentAPI, usdrt::PhysxSchemaPhysxAutoParticleClothAPI, usdrt::PhysxSchemaPhysxCameraAPI, usdrt::PhysxSchemaPhysxCameraDroneAPI, usdrt::PhysxSchemaPhysxCameraFollowAPI, usdrt::PhysxSchemaPhysxCameraFollowLookAPI, usdrt::PhysxSchemaPhysxCameraFollowVelocityAPI, usdrt::PhysxSchemaPhysxCharacterControllerAPI, usdrt::PhysxSchemaPhysxCollisionAPI, usdrt::PhysxSchemaPhysxContactReportAPI, usdrt::PhysxSchemaPhysxConvexDecompositionCollisionAPI, usdrt::PhysxSchemaPhysxConvexHullCollisionAPI, usdrt::PhysxSchemaPhysxCookedDataAPI, usdrt::PhysxSchemaPhysxDeformableAPI, usdrt::PhysxSchemaPhysxDeformableBodyAPI, usdrt::PhysxSchemaPhysxDeformableBodyMaterialAPI, usdrt::PhysxSchemaPhysxDeformableSurfaceAPI, usdrt::PhysxSchemaPhysxDeformableSurfaceMaterialAPI, usdrt::PhysxSchemaPhysxDiffuseParticlesAPI, usdrt::PhysxSchemaPhysxForceAPI, usdrt::PhysxSchemaPhysxHairAPI, usdrt::PhysxSchemaPhysxHairMaterialAPI, usdrt::PhysxSchemaPhysxJointAPI, usdrt::PhysxSchemaPhysxLimitAPI, usdrt::PhysxSchemaPhysxMaterialAPI, usdrt::PhysxSchemaPhysxMeshMergeCollisionAPI, usdrt::PhysxSchemaPhysxPBDMaterialAPI, usdrt::PhysxSchemaPhysxParticleAPI, usdrt::PhysxSchemaPhysxParticleAnisotropyAPI, usdrt::PhysxSchemaPhysxParticleClothAPI, usdrt::PhysxSchemaPhysxParticleIsosurfaceAPI, usdrt::PhysxSchemaPhysxParticleSamplingAPI, usdrt::PhysxSchemaPhysxParticleSetAPI, usdrt::PhysxSchemaPhysxParticleSmoothingAPI, usdrt::PhysxSchemaPhysxPhysicsDistanceJointAPI, usdrt::PhysxSchemaPhysxRigidBodyAPI, usdrt::PhysxSchemaPhysxSDFMeshCollisionAPI, usdrt::PhysxSchemaPhysxSceneAPI, usdrt::PhysxSchemaPhysxSceneQuasistaticAPI, usdrt::PhysxSchemaPhysxSphereFillCollisionAPI, usdrt::PhysxSchemaPhysxSurfaceVelocityAPI, usdrt::PhysxSchemaPhysxTendonAttachmentAPI, usdrt::PhysxSchemaPhysxTendonAttachmentLeafAPI, usdrt::PhysxSchemaPhysxTendonAttachmentRootAPI, usdrt::PhysxSchemaPhysxTendonAxisAPI, usdrt::PhysxSchemaPhysxTendonAxisRootAPI, usdrt::PhysxSchemaPhysxTriangleMeshCollisionAPI, usdrt::PhysxSchemaPhysxTriangleMeshSimplificationCollisionAPI, usdrt::PhysxSchemaPhysxTriggerAPI, usdrt::PhysxSchemaPhysxTriggerStateAPI, usdrt::PhysxSchemaPhysxVehicleAPI, usdrt::PhysxSchemaPhysxVehicleAckermannSteeringAPI, usdrt::PhysxSchemaPhysxVehicleAutoGearBoxAPI, usdrt::PhysxSchemaPhysxVehicleBrakesAPI, usdrt::PhysxSchemaPhysxVehicleClutchAPI, usdrt::PhysxSchemaPhysxVehicleContextAPI, usdrt::PhysxSchemaPhysxVehicleControllerAPI, usdrt::PhysxSchemaPhysxVehicleDriveBasicAPI, usdrt::PhysxSchemaPhysxVehicleDriveStandardAPI, usdrt::PhysxSchemaPhysxVehicleEngineAPI, usdrt::PhysxSchemaPhysxVehicleGearsAPI, usdrt::PhysxSchemaPhysxVehicleMultiWheelDifferentialAPI, usdrt::PhysxSchemaPhysxVehicleNonlinearCommandResponseAPI, usdrt::PhysxSchemaPhysxVehicleSteeringAPI, usdrt::PhysxSchemaPhysxVehicleSuspensionAPI, usdrt::PhysxSchemaPhysxVehicleSuspensionComplianceAPI, usdrt::PhysxSchemaPhysxVehicleTankControllerAPI, usdrt::PhysxSchemaPhysxVehicleTankDifferentialAPI, usdrt::PhysxSchemaPhysxVehicleTireAPI, usdrt::PhysxSchemaPhysxVehicleWheelAPI, usdrt::PhysxSchemaPhysxVehicleWheelAttachmentAPI, usdrt::PhysxSchemaPhysxVehicleWheelControllerAPI, usdrt::UsdClipsAPI, usdrt::UsdCollectionAPI, usdrt::UsdGeomModelAPI, usdrt::UsdGeomMotionAPI, usdrt::UsdGeomPrimvarsAPI, usdrt::UsdGeomVisibilityAPI, usdrt::UsdGeomXformCommonAPI, usdrt::UsdLuxLightAPI, usdrt::UsdLuxLightListAPI, usdrt::UsdLuxListAPI, usdrt::UsdLuxMeshLightAPI, usdrt::UsdLuxShadowAPI, usdrt::UsdLuxShapingAPI, usdrt::UsdLuxVolumeLightAPI, usdrt::UsdModelAPI, usdrt::UsdPhysicsArticulationRootAPI, usdrt::UsdPhysicsCollisionAPI, usdrt::UsdPhysicsDriveAPI, usdrt::UsdPhysicsFilteredPairsAPI, usdrt::UsdPhysicsLimitAPI, usdrt::UsdPhysicsMassAPI, usdrt::UsdPhysicsMaterialAPI, usdrt::UsdPhysicsMeshCollisionAPI, usdrt::UsdPhysicsRigidBodyAPI, usdrt::UsdRenderSettingsAPI, usdrt::UsdShadeConnectableAPI, usdrt::UsdShadeCoordSysAPI, usdrt::UsdShadeMaterialBindingAPI, usdrt::UsdShadeNodeDefAPI, usdrt::UsdSkelBindingAPI, usdrt::UsdUINodeGraphNodeAPI, usdrt::UsdUISceneGraphPrimAPI
Single vs. Multiple Apply API Schemas
Applied API schemas can further be classified into single-apply and multiple-apply API schemas. As the name suggests, a single-apply API schema can only be applied once to a prim. A multiple-apply API schema can be applied multiple times with different ‘instanceName’ values. An example of a multiple-apply API schema is UsdCollectionAPI, where the API schema is applied to a prim once for every collection owned by the prim.
Note
An applied API schema can only inherit from another applied API schema or directly from APISchemaBase. Similarly, a non-applied API schema can only inherit from a non-applied API Schema or directly from APISchemaBase. ‘usdGenSchema’ attempts to issue a warning if it detects an incompatibility.
Note
A multiple-apply API schema may not inherit from a single-apply API schema and vice versa.
Note
When the bool-conversion operator is invoked on an applied API schema, it evaluates to true only if the application of the API schema has been recorded on the prim via a call to the auto-generated Apply() method.
Public Functions
-
inline explicit UsdAPISchemaBase(const UsdPrim &prim = UsdPrim())
Construct a UsdAPISchemaBase on UsdPrim
prim
. Equivalent to UsdAPISchemaBase::Get(prim.GetStage(), prim.GetPath()) for a validprim
, but will not immediately throw an error for an invalidprim
.
-
inline explicit UsdAPISchemaBase(const UsdSchemaBase &schemaObj)
Construct a UsdAPISchemaBase on the prim held by
schemaObj
. Should be preferred over UsdAPISchemaBase(schemaObj.GetPrim()), as it preserves SchemaBase state.
-
inline virtual ~UsdAPISchemaBase()
Destructor.
-
inline explicit operator bool() const
Check if this schema object is compatible with it’s held prim and that the prim is valid.
A typed schema object is compatible if the held prim’s type is or is a subtype of the schema’s type. Based on
prim.IsA()
.An API schema object is compatible if the API is of type SingleApplyAPI or UsdSchemaType::MultipleApplyAPI, and the schema has been applied to the prim. Based on
prim.HasAPI
.This method invokes polymorphic behaviour.
See also
- Returns
True if the help prim is valid, and the schema object is compatible with its held prim.
Public Static Attributes
-
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
Compile time constant representing what kind of schema this class is.
See also
Protected Functions
-
inline explicit UsdAPISchemaBase(const UsdPrim &prim, const TfToken &instanceName)
Construct a multiple-apply UsdAPISchemaBase on UsdPrim
prim
with the specifiedinstanceName
.
-
inline explicit UsdAPISchemaBase(const UsdSchemaBase &schemaObj, const TfToken &instanceName)
Construct a multiple-apply UsdAPISchemaBase on the prim held by
schemaObj
with the giveninstanceName
.
-
inline const TfToken &_GetInstanceName() const
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.
-
inline virtual bool _IsCompatible() const
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
-
inline explicit UsdAPISchemaBase(const UsdPrim &prim = UsdPrim())