All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdSchemaRegistry Class Reference

Singleton registry that provides access to prim and property definition information for registered Usd "IsA" schema types. More...

+ Inheritance diagram for UsdSchemaRegistry:

Public Member Functions

USD_API bool IsAppliedAPISchema (const TfType &apiSchemaType)
 Returns true if apiSchemaType is an applied API schema type. More...
 
USD_API bool IsMultipleApplyAPISchema (const TfType &apiSchemaType)
 Returns true if apiSchemaType is a multiple-apply API schema type. More...
 

Static Public Member Functions

static USD_API UsdSchemaRegistryGetInstance ()
 
static const SdfLayerRefPtrGetSchematics ()
 
static USD_API SdfPrimSpecHandle GetPrimDefinition (const TfToken &primType)
 Return the PrimSpec that contains all the builtin metadata and properties for the given primType. More...
 
static USD_API SdfPrimSpecHandle GetPrimDefinition (const TfType &primType)
 Return the PrimSpec that contains all the bulitin metadata and properties for the given primType. More...
 
template<class SchemaType >
static SdfPrimSpecHandle GetPrimDefinition ()
 Return the PrimSpec that contains all the builtin metadata and properties for the given SchemaType. More...
 
static USD_API
SdfPropertySpecHandle 
GetPropertyDefinition (const TfToken &primType, const TfToken &propName)
 Return the property spec that defines the fallback for the property named propName on prims of type primType. More...
 
static USD_API
SdfAttributeSpecHandle 
GetAttributeDefinition (const TfToken &primType, const TfToken &attrName)
 This is a convenience method. More...
 
static USD_API
SdfRelationshipSpecHandle 
GetRelationshipDefinition (const TfToken &primType, const TfToken &relName)
 This is a convenience method. More...
 
static SdfSpecType GetSpecType (const TfToken &primType, const TfToken &propName)
 Return the SdfSpecType for primType and propName if those identify a builtin property. More...
 
template<class T >
static bool HasField (const TfToken &primType, const TfToken &propName, const TfToken &fieldName, T *value)
 Return in value the field for the property named propName under the prim for type primType or for the prim if propName is empty. More...
 
template<class T >
static bool HasFieldDictKey (const TfToken &primType, const TfToken &propName, const TfToken &fieldName, const TfToken &keyPath, T *value)
 
static USD_API std::vector
< TfToken
GetDisallowedFields ()
 Returns list of fields that cannot have fallback values specified in schemas. More...
 
static USD_API bool IsTyped (const TfType &primType)
 Returns true if the prim type primType inherits from UsdTyped. More...
 
static USD_API bool IsConcrete (const TfType &primType)
 Returns true if the prim type primType is instantiable in scene description. More...
 
static USD_API TfType GetTypeFromName (const TfToken &typeName)
 Finds the TfType of a schema with typeName. More...
 
- Static Public Member Functions inherited from TfSingleton< UsdSchemaRegistry >
static UsdSchemaRegistryGetInstance ()
 Return a reference to an object of type T, creating it if necessary. More...
 
static bool CurrentlyExists ()
 Return whether or not the single object of type T is currently in existence. More...
 
static void SetInstanceConstructed (UsdSchemaRegistry &instance)
 Indicate that the sole instance object has already been created. More...
 
static void DeleteInstance ()
 Destroy the sole instance object of type T, if it exists. More...
 

Friends

class TfSingleton< UsdSchemaRegistry >
 

Detailed Description

Singleton registry that provides access to prim and property definition information for registered Usd "IsA" schema types.

The data contained herein comes from the processed (by usdGenSchema) schema.usda files of each schema-defining module. The data is returned in the form of SdfSpec's of the appropriate subtype.

It is used by the Usd core to determine how to create scene description for un-instantiated "builtin" properties of schema classes, and also to enumerate all properties for a given schema class, and finally to provide fallback values for unauthored builtin properties.

Definition at line 56 of file schemaRegistry.h.

Member Function Documentation

static USD_API SdfAttributeSpecHandle GetAttributeDefinition ( const TfToken primType,
const TfToken attrName 
)
static

This is a convenience method.

It is shorthand for TfDynamic_cast<SdfAttributeSpecHandle>( GetPropertyDefinition(primType, attrName));

static USD_API std::vector<TfToken> GetDisallowedFields ( )
static

Returns list of fields that cannot have fallback values specified in schemas.

Fields are generally in this list because their fallback values aren't used. For instance, fallback values for composition arcs aren't used during composition, so allowing them to be set in schemas would be misleading.

static USD_API SdfPrimSpecHandle GetPrimDefinition ( const TfToken primType)
static

Return the PrimSpec that contains all the builtin metadata and properties for the given primType.

Return null if there is no such prim definition.

static USD_API SdfPrimSpecHandle GetPrimDefinition ( const TfType primType)
static

Return the PrimSpec that contains all the bulitin metadata and properties for the given primType.

Return null if there is no such prim definition.

static SdfPrimSpecHandle GetPrimDefinition ( )
inlinestatic

Return the PrimSpec that contains all the builtin metadata and properties for the given SchemaType.

Return null if there is no such prim definition.

Definition at line 83 of file schemaRegistry.h.

static USD_API SdfPropertySpecHandle GetPropertyDefinition ( const TfToken primType,
const TfToken propName 
)
static

Return the property spec that defines the fallback for the property named propName on prims of type primType.

Return null if there is no such property definition.

static USD_API SdfRelationshipSpecHandle GetRelationshipDefinition ( const TfToken primType,
const TfToken relName 
)
static

This is a convenience method.

It is shorthand for TfDynamic_cast<SdfRelationshipSpecHandle>( GetPropertyDefinition(primType, relName));

static SdfSpecType GetSpecType ( const TfToken primType,
const TfToken propName 
)
inlinestatic

Return the SdfSpecType for primType and propName if those identify a builtin property.

Otherwise return SdfSpecTypeUnknown.

Definition at line 112 of file schemaRegistry.h.

static USD_API TfType GetTypeFromName ( const TfToken typeName)
static

Finds the TfType of a schema with typeName.

This is primarily for when you have been provided Schema typeName (perhaps from a User Interface or Script) and need to identify if a prim's type inherits/is that typeName. If the type name IS known, then using the schema class is preferred.

1 * # This code attempts to match all prims on a stage to a given
2 * # user specified type, making the traditional schema based idioms not
3 * # applicable.
4 * data = parser.parse_args()
5 * tfType = UsdSchemaRegistry.GetTypeFromName(data.type)
6 * matchedPrims = [p for p in stage.Traverse() if p.IsA(tfType)]
7 *
Note
It's worth noting that GetTypeFromName("Sphere") == GetTypeFromName("UsdGeomSphere"), as this function resolves both the Schema's C++ class name and any registered aliases from a libraries plugInfo.json file. However, GetTypeFromName("Boundable") != GetTypeFromName("UsdGeomBoundable") because type aliases don't get registered for abstract schema types.
static bool HasField ( const TfToken primType,
const TfToken propName,
const TfToken fieldName,
T *  value 
)
inlinestatic

Return in value the field for the property named propName under the prim for type primType or for the prim if propName is empty.

Returns true if the value exists, false otherwise.

Definition at line 127 of file schemaRegistry.h.

USD_API bool IsAppliedAPISchema ( const TfType apiSchemaType)

Returns true if apiSchemaType is an applied API schema type.

static USD_API bool IsConcrete ( const TfType primType)
static

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

USD_API bool IsMultipleApplyAPISchema ( const TfType apiSchemaType)

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

static USD_API bool IsTyped ( const TfType primType)
static

Returns true if the prim type primType inherits from UsdTyped.


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