usdrt::UsdSchemaRegistry

Defined in usdrt/scenegraph/usd/usd/schemaRegistry.h

Functions

class UsdSchemaRegistry

Singleton registry that provides access to schema type information and the prim definitions for registered Usd “IsA” and applied API schema types. It also contains the data from the generated schemas that is used by prim definitions to provide properties and fallbacks.

Public Functions

inline bool IsTyped(const TfToken &primType)

Check if the given schema name inherits from UsdTyped.

Note

This differs from USD. In USD, the expected type for primType is TfType. Here, we use TfToken instead as USDRT does not implement its own TfType.

Note

This differs from USD. This function cannot be static with the USDRT isA implementation.

Parameters

primType – TfToken for the schema type name.

Returns

Returns true if the prim type primType inherits from UsdTyped.

inline bool IsConcrete(const TfToken &primType) const

Check if the given schema name is a concrete schema.

Parameters

primType – TfToken for the schema type name.

Returns

Returns true if the prim type primType is instantiable in scene description.

inline bool IsAppliedAPISchema(const TfToken &apiSchemaType) const

Check if the given schema type is an applied api schema type.

Parameters

apiSchemaType – TfToken for the schema type name.

Returns

Returns true if apiSchemaType is an applied API schema type.

inline bool IsMultipleApplyAPISchema(const TfToken &apiSchemaType) const

Check if the given schema type is a multiple-apply API schema type.

Parameters

apiSchemaType – TfToken for the schema type name.

Returns

Returns true if apiSchemaType is a multiple-apply API schema type.

inline bool IsA(const TfToken &sourceTypeName, const TfToken &queryTypeName) const

Check if the given sourceTypeName type is or inherits from queryTypeName.

Schema full name or alias can be given.

Usage example to check if UsdGeomCube is an instance of UsdTyped.

UsdSchemaRegistry::GetInstance().IsA("UsdGeomCube", "UsdTyped")()

Note

This is an additional API function to take the place of having to query the TfType system.

Parameters
  • sourceTypeName – The base schema type name for this query.

  • queryTypeName – The schema type name we are asking about.

Returns

Returns true if the sourceTypeName is an instance of the queryTypeName.

inline TfToken GetAliasFromName(const TfToken &name) const

Get the schema type name alias from the given name by querying the underlying Usd TfType system.

This is used when applying or querying schema names as Fabric applies schemas with alias only. USDRT supports querying and applying using either name.

If name is already the alias, this function will still query the TfType system and return the alias.

Note

This is an additional API not present in USD to take place of implementing a TfType system. Since this queries the underlying Usd TfType system, we assume that the USDRT schema is also a registered USD schema.

Parameters

name – the full schema type name or alias.

Returns

the TfToken for the schema alias.

template<typename SchemaType, typename QuerySchemaType>
inline bool IsA() const

Check if the given SchemaType type is or inherits from QuerySchemaType.

Schema full name or alias can be given.

Usage example to check if UsdGeomCube is an instance of UsdTyped.

UsdSchemaRegistry::GetInstance().IsA<UsdGeomCube, UsdTyped>()

Note

This is an additional API function to take the place of having to query the TfType system.

Template Parameters
  • SchemaType – Base schema type for this query.

  • QuerySchemaType – Schema type we are asking about.

Returns

Returns true if the SchemaType is an instance of the QuerySchemaType.

template<typename SchemaType>
inline bool IsA(TfToken sourceTypeName) const

Check if the given sourceTypeName is or inherits from SchemaType.

Schema full name or alias can be given.

Usage example to check if UsdGeomCube is an instance of UsdTyped.

UsdSchemaRegistry::GetInstance().IsA<UsdTyped>("Cube"))

Note

This is an additional API function to take the place of having to query the TfType system.

Parameters

sourceTypeName – Base schema type for this query.

Template Parameters

SchemaType – Schema type we are asking about.

Returns

Returns true if the sourceTypeName is an instance of the SchemaType.

inline explicit operator bool() const

Boolean operator.

Returns

Return true if the schema registry is initialized.

Public Static Functions

static inline UsdSchemaRegistry GetInstance()

Get the schema registry instance.

template<class SchemaType>
static inline TfToken GetSchemaTypeName()

Get the schema type name for given schemaType.

Note

This differs from USD. In USD, the expected return type is TfType. Here, we use TfToken instead as USDRT does not implement its own TfType.

Returns

Returns a TfToken for the type name of the USD schema.