UsdSchemaBase#
Fully qualified name: usdrt::UsdSchemaBase
-
class UsdSchemaBase#
Base class for all Usd Schemas. Schema objects hold a UsdPrim m_prim and an SdfPath m_primPath and provide an additional layer of specific API.
Create vs Get Property Methods#
For a UsdAttribute named “points” defined in a schema class, you will find two access methods in the schema class in C++ and python:
GetPointsAttr()
CreatePointsAttr()
CreatePointsAttr() returns a UsdAttribute, and also creates it on the prim if it doesn’t exist. There is no change if the attribute already exists.
TODO IsMultipleApplyAPISchema
Subclassed by usdrt::UsdAPISchemaBase, usdrt::UsdTyped
Public Functions
-
explicit UsdSchemaBase(const UsdPrim &prim = UsdPrim())#
Construct and store
prim
as the held prim.- Parameters:
prim – The help prim in this schema.
-
explicit UsdSchemaBase(const UsdSchemaBase &otherSchema)#
Construct and store for the same prim held by
otherSchema
.- Parameters:
otherSchema – Other schema to copy.
-
virtual ~UsdSchemaBase()#
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 Functions
Public Static Attributes
-
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase#
Compile time constant representing what kind of schema this class is.
See also
See UsdSchemaType in usd/common.h
Protected Functions
-
virtual bool _IsCompatible() const#
Helper for subclasses to do specific compatibility checking with the given prim. Subclassess may override
_isCompatible
to for example check type compatibility or value compatibility on the prim.Overrides exist for UsdTyped and UsdAPISchemaBase.
This check is called when clients invoke the bool operator.
- Returns:
True if the schema object is compatible with its held prim.