24 #ifndef USD_SCHEMAREGISTRY_H
25 #define USD_SCHEMAREGISTRY_H
28 #include "pxr/usd/usd/api.h"
30 #include "pxr/usd/sdf/layer.h"
31 #include "pxr/usd/sdf/primSpec.h"
33 #include "pxr/base/tf/hash.h"
34 #include "pxr/base/tf/singleton.h"
35 #include "pxr/base/tf/hashmap.h"
37 PXR_NAMESPACE_OPEN_SCOPE
64 return GetInstance()._schematics;
82 template <
class SchemaType>
91 static SdfPropertySpecHandle
99 static SdfAttributeSpecHandle
107 static SdfRelationshipSpecHandle
115 const SdfPath &path =
self._GetPath(primType, propName);
116 return path.
IsEmpty() ? SdfSpecTypeUnknown :
117 self._schematics->GetSpecType(path);
129 const TfToken& fieldName, T* value)
132 const SdfPath &path =
self._GetPath(primType, propName);
134 self._schematics->HasField(path, fieldName, value);
138 static bool HasFieldDictKey(
const TfToken& primType,
145 const SdfPath &path =
self._GetPath(primType, propName);
147 self._schematics->HasFieldDictKey(path, fieldName, keyPath, value);
209 static SdfPrimSpecHandle
210 _GetPrimDefinitionAtPath(
const SdfPath &path);
216 const SdfPath& _GetSchemaPrimPath(
const TfType &primType)
const;
220 const TfToken &propName)
const;
222 void _FindAndAddPluginSchema();
224 void _BuildPrimTypePropNameToPathMap(
const TfToken &typeName,
233 typedef TfHashMap<TfType, SdfPath, TfHash> _TypeToPathMap;
234 _TypeToPathMap _typeToPathMap;
236 typedef TfHashMap<TfToken, SdfPath, TfToken::HashFunctor>
238 _TypeNameToPathMap _typeNameToPathMap;
240 struct _TokenPairHash {
241 inline size_t operator()(
const std::pair<TfToken, TfToken> &p)
const {
242 size_t hash = p.first.Hash();
243 boost::hash_combine(hash, p.second);
249 typedef TfHashMap<std::pair<TfToken, TfToken>,
SdfPath,
250 _TokenPairHash> _PrimTypePropNameToPathMap;
251 _PrimTypePropNameToPathMap _primTypePropNameToPathMap;
259 PXR_NAMESPACE_CLOSE_SCOPE
261 #endif //USD_SCHEMAREGISTRY_H
static USD_API SdfAttributeSpecHandle GetAttributeDefinition(const TfToken &primType, const TfToken &attrName)
This is a convenience method.
static SdfSpecType GetSpecType(const TfToken &primType, const TfToken &propName)
Return the SdfSpecType for primType and propName if those identify a builtin property.
Manage a single instance of an object (see.
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 p...
USD_API bool IsAppliedAPISchema(const TfType &apiSchemaType)
Returns true if apiSchemaType is an applied API schema type.
SdfSpecType
An enum that specifies the type of an object.
Token for efficient comparison, assignment, and hashing of known strings.
A subclass of SdfPropertySpec that holds typed data.
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...
static SdfPrimSpecHandle GetPrimDefinition()
Return the PrimSpec that contains all the builtin metadata and properties for the given SchemaType...
USD_API bool IsMultipleApplyAPISchema(const TfType &apiSchemaType)
Returns true if apiSchemaType is a multiple-apply API schema type.
A path value used to locate objects in layers or scenegraphs.
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
A property that contains a reference to one or more SdfPrimSpec instances.
static USD_API bool IsConcrete(const TfType &primType)
Returns true if the prim type primType is instantiable in scene description.
static USD_API SdfRelationshipSpecHandle GetRelationshipDefinition(const TfToken &primType, const TfToken &relName)
This is a convenience method.
TfHashSet< TfToken, TfToken::HashFunctor > HashSet
Predefined type for TfHashSet of tokens, since it's so awkward to manually specify.
static USD_API bool IsTyped(const TfType &primType)
Returns true if the prim type primType inherits from UsdTyped.
static USD_API TfType GetTypeFromName(const TfToken &typeName)
Finds the TfType of a schema with typeName.
TfType represents a dynamic runtime type.
Singleton registry that provides access to prim and property definition information for registered Us...
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
static USD_API std::vector< TfToken > GetDisallowedFields()
Returns list of fields that cannot have fallback values specified in schemas.