bool 
UsdSchemaRegistry::IsAppliedAPISchema(const TfType& apiSchemaType)
{
    // Return false if apiSchemaType is not an API schema.
    if (!apiSchemaType.IsA(*_apiSchemaBaseType)) {
        return false;
    }

    for (const auto& alias : _schemaBaseType->GetAliases(apiSchemaType)) {
        if (_appliedAPISchemaNames.find(TfToken(alias)) !=  
                _appliedAPISchemaNames.end()) {
            return true;
        }
    }

    return false;
}
Beispiel #2
0
UsdMayaAdaptor::SchemaAdaptor
UsdMayaAdaptor::GetSchemaOrInheritedSchema(const TfType& ty) const
{
    if (!*this) {
        return SchemaAdaptor();
    }

    if (ty.IsA<UsdAPISchemaBase>()) {
        // No "promotion" for API schemas.
        return GetSchema(ty);
    }
    else if (ty.IsA<UsdSchemaBase>()) {
        // Can "promote" typed schemas based on inheritance.
        const TfType objectType = GetUsdType();
        if (objectType.IsA(ty)) {
            return GetSchema(objectType);
        }
    }

    return SchemaAdaptor();
}