HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
schemaRegistry.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_USD_SCHEMA_REGISTRY_H
8 #define PXR_USD_USD_SCHEMA_REGISTRY_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/usd/api.h"
12 #include "pxr/usd/usd/common.h"
13 
14 #include "pxr/usd/sdf/layer.h"
15 #include "pxr/usd/sdf/primSpec.h"
16 
17 #include "pxr/base/tf/hash.h"
18 #include "pxr/base/tf/singleton.h"
19 
20 #include <unordered_map>
21 #include <vector>
22 
24 
27 
28 class UsdSchemaBase;
29 class UsdPrimDefinition;
30 
31 /// Schema versions are specified as a single unsigned integer value.
32 using UsdSchemaVersion = unsigned int;
33 
34 /// \class UsdSchemaRegistry
35 ///
36 /// Singleton registry that provides access to schema type information and
37 /// the prim definitions for registered Usd "IsA" and applied API schema
38 /// types. It also contains the data from the generated schemas that is used
39 /// by prim definitions to provide properties and fallbacks.
40 ///
41 /// The data contained herein comes from the generatedSchema.usda file
42 /// (generated when a schema.usda file is processed by \em usdGenSchema)
43 /// of each schema-defining module. The registry expects each schema type to
44 /// be represented as a single prim spec with its inheritance flattened, i.e.
45 /// the prim spec contains a union of all its local and class inherited property
46 /// specs and metadata fields.
47 ///
48 /// It is used by the Usd core, via UsdPrimDefinition, to determine how to
49 /// create scene description for unauthored "built-in" properties of schema
50 /// classes, to enumerate all properties for a given schema class, and finally
51 /// to provide fallback values for unauthored built-in properties.
52 ///
53 class UsdSchemaRegistry : public TfWeakBase {
54  UsdSchemaRegistry(const UsdSchemaRegistry&) = delete;
55  UsdSchemaRegistry& operator=(const UsdSchemaRegistry&) = delete;
56 public:
57  using TokenToTokenVectorMap =
58  std::unordered_map<TfToken, TfTokenVector, TfHash>;
59 
60  /// Structure that holds the information about a schema that is registered
61  /// with the schema registry.
62  struct SchemaInfo {
63 
64  /// The schema's identifier which is how the schema type is referred to
65  /// in scene description and is also the key used to look up the
66  /// schema's prim definition.
68 
69  /// The schema's type as registered with the TfType registry. This will
70  /// correspond to the C++ class of the schema if a class was generated
71  /// for it.
73 
74  /// The name of the family of schema's which the schema is a version
75  /// of. This is the same as the schema identifier with the version
76  /// suffix removed (or exactly the same as the schema identifier in the
77  /// case of version 0 of a schema which will not have a version suffix.)
79 
80  /// The version number of the schema within its schema family.
82 
83  /// The schema's kind: ConcreteTyped, SingleApplyAPI, etc.
85  };
86 
87  USD_API
90  }
91 
92  /// Creates the schema identifier that would be used to define a schema of
93  /// the given \p schemaFamily with the given \p schemaVersion.
94  ///
95  /// If the provided schema version is zero, the returned identifier will
96  /// be the schema family itself. For all other versions, the returned
97  /// identifier will be the family followed by an underscore and the version
98  /// number.
99  ///
100  /// If \p schemaFamily is not an
101  /// \ref IsAllowedSchemaFamily "allowed schema family", this function will
102  /// append the appropriate version suffix, but the returned identifier will
103  /// not be an \ref IsAllowedSchemaIdentifier "allowed schema identifier".
104  USD_API
105  static TfToken
107  const TfToken &schemaFamily,
108  UsdSchemaVersion schemaVersion);
109 
110  /// Parses and returns the schema family and version values from the given
111  /// \p schemaIdentifier.
112  ///
113  /// A schema identifier's version is indicated by a suffix consisting of an
114  /// underscore followed by a positive integer which is its version. The
115  /// schema family is the string before this suffix. If the identifier does
116  /// not have a suffix matching this pattern, then the schema version is zero
117  /// and the schema family is the identifier itself.
118  ///
119  /// For example:
120  /// Identifier "FooAPI_1" returns ("FooAPI", 1)
121  /// Identifier "FooAPI" returns ("FooAPI", 0)
122  ///
123  /// Note that this function only parses what the schema family and version
124  /// would be for the given schema identifier and does not require that
125  /// \p schemaIdentifier be a registered schema itself or even an
126  /// \ref IsAllowedSchemaIdentifier "allowed schema identifier".
127  USD_API
128  static std::pair<TfToken, UsdSchemaVersion>
129  ParseSchemaFamilyAndVersionFromIdentifier(const TfToken &schemaIdentifier);
130 
131  /// Returns whether the given \p schemaFamily is an allowed schema family
132  /// name.
133  ///
134  /// A schema family is allowed if it's a
135  /// \ref SdfPath::IsValidIdentifier "valid identifier"
136  /// and does not itself contain a
137  /// \ref ParseSchemaFamilyAndVersionFromIdentifier "version suffix".
138  USD_API
139  static bool
140  IsAllowedSchemaFamily(const TfToken &schemaFamily);
141 
142  /// Returns whether the given \p schemaIdentifier is an allowed schema
143  /// identifier.
144  ///
145  /// A schema identifier is allowed if it can be
146  /// \ref ParseSchemaFamilyAndVersionFromIdentifier "parsed" into a
147  /// \ref IsAllowedSchemaFamily "allowed schema family" and schema version
148  /// and it is the identifier that would be
149  /// \ref MakeSchemaIdentifierForFamilyAndVersion "created" from that parsed
150  /// family and version.
151  USD_API
152  static bool
153  IsAllowedSchemaIdentifier(const TfToken &schemaIdentifier);
154 
155  /// Finds and returns the schema info for a registered schema with the
156  /// given \p schemaType. Returns null if no registered schema with the
157  /// schema type exists.
158  USD_API
159  static const SchemaInfo *
160  FindSchemaInfo(const TfType &schemaType);
161 
162  /// Finds and returns the schema info for a registered schema with the
163  /// C++ schema class \p SchemaType.
164  ///
165  /// All generated C++ schema classes, i.e. classes that derive from
166  /// UsdSchemaBase, are expected to have their types registered with the
167  /// schema registry and as such, the return value from this function should
168  /// never be null. A null return value is indication of a coding error even
169  /// though this function itself will not report an error.
170  template <class SchemaType>
171  static const SchemaInfo *
174  "Provided type must derive UsdSchemaBase.");
175  return FindSchemaInfo(SchemaType::_GetStaticTfType());
176  }
177 
178  /// Finds and returns the schema info for a registered schema with the
179  /// given \p schemaIdentifier. Returns null if no registered schema with the
180  /// schema identifier exists.
181  USD_API
182  static const SchemaInfo *
183  FindSchemaInfo(const TfToken &schemaIdentifier);
184 
185  /// Finds and returns the schema info for a registered schema in the
186  /// given \p schemaFamily with the given \p schemaVersion. Returns null if
187  /// no registered schema in the schema family with the given version exists.
188  USD_API
189  static const SchemaInfo *
190  FindSchemaInfo(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion);
191 
192  /// A policy for filtering by schema version when querying for schemas in a
193  /// particular schema family.
194  enum class VersionPolicy {
195  All,
196  GreaterThan,
198  LessThan,
200  };
201 
202  /// Finds all schemas in the given \p schemaFamily and returns their
203  /// their schema info ordered from highest version to lowest version.
204  USD_API
205  static const std::vector<const SchemaInfo *> &
207  const TfToken &schemaFamily);
208 
209  /// Finds all schemas in the given \p schemaFamily, filtered according to
210  /// the given \p schemaVersion and \p versionPolicy, and returns their
211  /// their schema info ordered from highest version to lowest version.
212  USD_API
213  static std::vector<const SchemaInfo *>
215  const TfToken &schemaFamily,
216  UsdSchemaVersion schemaVersion,
217  VersionPolicy versionPolicy);
218 
219  /// Return the type name in the USD schema for prims or API schemas of the
220  /// given registered \p schemaType.
221  USD_API
222  static TfToken GetSchemaTypeName(const TfType &schemaType);
223 
224  /// Return the type name in the USD schema for prims or API schemas of the
225  /// given registered \p SchemaType.
226  template <class SchemaType>
227  static
229  return GetSchemaTypeName(SchemaType::_GetStaticTfType());
230  }
231 
232  /// Return the type name in the USD schema for concrete prim types only from
233  /// the given registered \p schemaType.
234  USD_API
235  static TfToken GetConcreteSchemaTypeName(const TfType &schemaType);
236 
237  /// Return the type name in the USD schema for API schema types only from
238  /// the given registered \p schemaType.
239  USD_API
240  static TfToken GetAPISchemaTypeName(const TfType &schemaType);
241 
242  /// Return the TfType of the schema corresponding to the given prim or API
243  /// schema name \p typeName. This the inverse of GetSchemaTypeName.
244  USD_API
245  static TfType GetTypeFromSchemaTypeName(const TfToken &typeName);
246 
247  /// Return the TfType of the schema corresponding to the given concrete prim
248  /// type name \p typeName. This the inverse of GetConcreteSchemaTypeName.
249  USD_API
250  static TfType GetConcreteTypeFromSchemaTypeName(const TfToken &typeName);
251 
252  /// Return the TfType of the schema corresponding to the given API schema
253  /// type name \p typeName. This the inverse of GetAPISchemaTypeNAme.
254  USD_API
255  static TfType GetAPITypeFromSchemaTypeName(const TfToken &typeName);
256 
257  /// Returns true if the field \p fieldName cannot have fallback values
258  /// specified in schemas.
259  ///
260  /// Fields are generally disallowed because their fallback values
261  /// aren't used. For instance, fallback values for composition arcs
262  /// aren't used during composition, so allowing them to be set in
263  /// schemas would be misleading.
264  USD_API
265  static bool IsDisallowedField(const TfToken &fieldName);
266 
267  /// Returns true if the prim type \p primType inherits from \ref UsdTyped.
268  USD_API
269  static bool IsTyped(const TfType& primType);
270 
271  /// Returns the kind of the schema the given \p schemaType represents.
272  ///
273  /// This returns UsdSchemaKind::Invalid if \p schemaType is not a valid
274  /// schema type or if the kind cannot be determined from type's plugin
275  /// information.
276  USD_API
277  static UsdSchemaKind GetSchemaKind(const TfType &schemaType);
278 
279  /// Returns the kind of the schema the given \p typeName represents.
280  ///
281  /// This returns UsdSchemaKind::Invalid if \p typeName is not a valid
282  /// schema type name or if the kind cannot be determined from type's plugin
283  /// information.
284  USD_API
285  static UsdSchemaKind GetSchemaKind(const TfToken &typeName);
286 
287  /// Returns true if the prim type \p primType is instantiable
288  /// in scene description.
289  USD_API
290  static bool IsConcrete(const TfType& primType);
291 
292  /// Returns true if the prim type \p primType is instantiable
293  /// in scene description.
294  USD_API
295  static bool IsConcrete(const TfToken& primType);
296 
297  /// Returns true if the prim type \p primType is an abstract schema type
298  /// and, unlike a concrete type, is not instantiable in scene description.
299  USD_API
300  static bool IsAbstract(const TfType& primType);
301 
302  /// Returns true if the prim type \p primType is an abstract schema type
303  /// and, unlike a concrete type, is not instantiable in scene description.
304  USD_API
305  static bool IsAbstract(const TfToken& primType);
306 
307  /// Returns true if \p apiSchemaType is an applied API schema type.
308  USD_API
309  static bool IsAppliedAPISchema(const TfType& apiSchemaType);
310 
311  /// Returns true if \p apiSchemaType is an applied API schema type.
312  USD_API
313  static bool IsAppliedAPISchema(const TfToken& apiSchemaType);
314 
315  /// Returns true if \p apiSchemaType is a multiple-apply API schema type.
316  USD_API
317  static bool IsMultipleApplyAPISchema(const TfType& apiSchemaType);
318 
319  /// Returns true if \p apiSchemaType is a multiple-apply API schema type.
320  USD_API
321  static bool IsMultipleApplyAPISchema(const TfToken& apiSchemaType);
322 
323  /// Finds the TfType of a schema with \p typeName
324  ///
325  /// This is primarily for when you have been provided Schema typeName
326  /// (perhaps from a User Interface or Script) and need to identify
327  /// if a prim's type inherits/is that typeName. If the type name IS known,
328  /// then using the schema class is preferred.
329  ///
330  /// \code{.py}
331  /// # This code attempts to match all prims on a stage to a given
332  /// # user specified type, making the traditional schema based idioms not
333  /// # applicable.
334  /// data = parser.parse_args()
335  /// tfType = UsdSchemaRegistry.GetTypeFromName(data.type)
336  /// matchedPrims = [p for p in stage.Traverse() if p.IsA(tfType)]
337  /// \endcode
338  ///
339  /// \note It's worth noting that
340  /// GetTypeFromName("Sphere") == GetTypeFromName("UsdGeomSphere"), as
341  /// this function resolves both the Schema's C++ class name and any
342  /// registered aliases from a libraries plugInfo.json file. However,
343  /// GetTypeFromName("Boundable") != GetTypeFromName("UsdGeomBoundable")
344  /// because type aliases don't get registered for abstract schema types.
345  USD_API
346  static TfType GetTypeFromName(const TfToken& typeName);
347 
348  /// Returns the schema type name and the instance name parsed from the
349  /// given \p apiSchemaName
350  ///
351  /// \p apiSchemaName is the name of an applied schema as it appears in
352  /// the list of applied schemas on a prim. For single-apply API schemas
353  /// the name will just be the schema type name. For multiple-apply schemas
354  /// the name should include the schema type name and the applied instance
355  /// name separated by a namespace delimiter, for example
356  /// 'CollectionAPI:plasticStuff'.
357  ///
358  /// This function returns the separated schema type name and instance name
359  /// component tokens if possible, otherwise it returns the \p apiSchemaName
360  /// as the type name and an empty instance name.
361  ///
362  /// Note that no validation is done on the returned tokens. Clients are
363  /// advised to use GetTypeFromSchemaTypeName() to validate the typeName
364  /// token.
365  ///
366  /// \sa UsdPrim::AddAppliedSchema(const TfToken&) const
367  /// \sa UsdPrim::GetAppliedSchemas() const
368  USD_API
369  static std::pair<TfToken, TfToken> GetTypeNameAndInstance(
370  const TfToken &apiSchemaName);
371 
372  /// Returns true if the given \p instanceName is an allowed instance name
373  /// for the multiple apply API schema named \p apiSchemaName.
374  ///
375  /// Any instance name that matches the name of a property provided by the
376  /// API schema is disallowed and will return false. If the schema type
377  /// has plugin metadata that specifies allowed instance names, then only
378  /// those specified names are allowed for the schema type.
379  /// If the instance name is empty or the API is not a multiple apply schema,
380  /// this will return false.
381  USD_API
382  static bool IsAllowedAPISchemaInstanceName(
383  const TfToken &apiSchemaName,
384  const TfToken &instanceName);
385 
386  /// Returns a list of prim type names that the given \p apiSchemaName can
387  /// only be applied to.
388  ///
389  /// A non-empty list indicates that the API schema can only be applied to
390  /// prim that are or derive from prim type names in the list. If the list
391  /// is empty, the API schema can be applied to prims of any type.
392  ///
393  /// If a non-empty \p instanceName is provided, this will first look for
394  /// a list of "can only apply to" names specific to that instance of the API
395  /// schema and return that if found. If a list is not found for the specific
396  /// instance, it will fall back to looking for a "can only apply to" list
397  /// for just the schema name itself.
398  USD_API
400  const TfToken &apiSchemaName,
401  const TfToken &instanceName = TfToken());
402 
403  /// Returns a map of the names of all registered auto apply API schemas
404  /// to the list of type names each is registered to be auto applied to.
405  ///
406  /// The list of type names to apply to will directly match what is specified
407  /// in the plugin metadata for each schema type. While auto apply schemas do
408  /// account for the existence and validity of the type names and expand to
409  /// include derived types of the listed types, the type lists returned by
410  /// this function do not.
411  USD_API
413 
414  /// Collects all the additional auto apply schemas that can be defined in
415  /// a plugin through "AutoApplyAPISchemas" metadata and adds the mappings
416  /// to \p autoApplyAPISchemas.
417  ///
418  /// These are separate from the auto-apply schemas that are built in to the
419  /// applied API schema types themselves and can be defined in any plugin to
420  /// map any applied API schema to any concrete prim type.
421  ///
422  /// Note that GetAutoApplyAPISchemas will already include API schemas
423  /// collected from this method; this function is provided for clients that
424  /// may want to collect just these plugin API schema mappings.
425  USD_API
427  TokenToTokenVectorMap *autoApplyAPISchemas);
428 
429  /// Creates a name template that can represent a property or API schema that
430  /// belongs to a multiple apply schema and will therefore have multiple
431  /// instances with different names.
432  ///
433  /// The name template is created by joining the \p namespacePrefix,
434  /// the instance name placeholder "__INSTANCE_NAME__", and the
435  /// \p baseName using the namespace delimiter. Therefore the
436  /// returned name template will be of one of the following forms depending
437  /// on whether either of the inputs is empty:
438  /// 1. namespacePrefix:__INSTANCE_NAME__:baseName
439  /// 2. namespacePrefix:__INSTANCE_NAME__
440  /// 3. __INSTANCE_NAME__:baseName
441  /// 4. __INSTANCE_NAME__
442  ///
443  /// Name templates can be passed to MakeMultipleApplyNameInstance along with
444  /// an instance name to create the name for a particular instance.
445  ///
446  USD_API
448  const std::string &namespacePrefix,
449  const std::string &baseName);
450 
451  /// Returns an instance of a multiple apply schema name from the given
452  /// \p nameTemplate for the given \p instanceName.
453  ///
454  /// The returned name is created by replacing the instance name placeholder
455  /// "__INSTANCE_NAME__" in the name template with the given instance name.
456  /// If the instance name placeholder is not found in \p nameTemplate, then
457  /// the name template is not multiple apply name template and is returned as
458  /// is.
459  ///
460  /// Note that the instance name placeholder must be found as an exact full
461  /// word match with one of the tokenized components of the name template,
462  /// when tokenized by the namespace delimiter, in order for it to be treated
463  /// as a placeholder and substituted with the instance name.
464  ///
465  USD_API
467  const std::string &nameTemplate,
468  const std::string &instanceName);
469 
470  /// Returns the base name for the multiple apply schema name template
471  /// \p nameTemplate.
472  ///
473  /// The base name is the substring of the given name template that comes
474  /// after the instance name placeholder and the subsequent namespace
475  /// delimiter. If the given property name does not contain the instance name
476  /// placeholder, it is not a name template and the name template is returned
477  /// as is.
478  ///
479  USD_API
481  const std::string &nameTemplate);
482 
483  /// Returns true if \p nameTemplate is a multiple apply schema name
484  /// template.
485  ///
486  /// The given \p nameTemplate is a name template if and only if it
487  /// contains the instance name place holder "__INSTANCE_NAME__" as an exact
488  /// match as one of the tokenized components of the name tokenized by
489  /// the namespace delimiter.
490  ///
491  USD_API
492  static bool IsMultipleApplyNameTemplate(
493  const std::string &nameTemplate);
494 
495  /// Finds the prim definition for the given \p typeName token if
496  /// \p typeName is a registered concrete typed schema type. Returns null if
497  /// it is not.
499  const TfToken &typeName) const {
500  const auto it = _concreteTypedPrimDefinitions.find(typeName);
501  return it != _concreteTypedPrimDefinitions.end() ?
502  it->second.get() : nullptr;
503  }
504 
505  /// Finds the prim definition for the given \p typeName token if
506  /// \p typeName is a registered applied API schema type. Returns null if
507  /// it is not.
509  const TfToken &typeName) const {
510  const auto it = _appliedAPIPrimDefinitions.find(typeName);
511  return it != _appliedAPIPrimDefinitions.end() ?
512  it->second.primDef.get() : nullptr;
513  }
514 
515  /// Returns the empty prim definition.
517  return _emptyPrimDefinition;
518  }
519 
520  /// Composes and returns a new UsdPrimDefinition from the given \p primType
521  /// and list of \p appliedSchemas. This prim definition will contain a union
522  /// of properties from the registered prim definitions of each of the
523  /// provided types.
524  USD_API
525  std::unique_ptr<UsdPrimDefinition>
527  const TfToken &primType, const TfTokenVector &appliedAPISchemas) const;
528 
529  /// Returns a dictionary mapping concrete schema prim type names to a
530  /// VtTokenArray of fallback prim type names if fallback types are defined
531  /// for the schema type in its registered schema.
532  ///
533  /// The standard use case for this to provide schema defined metadata that
534  /// can be saved with a stage to inform an older version of USD - that
535  /// may not have some schema types - as to which types it can used instead
536  /// when encountering a prim of one these types.
537  ///
538  /// \sa UsdStage::WriteFallbackPrimTypes
539  /// \sa \ref Usd_OM_FallbackPrimTypes
541  return _fallbackPrimTypes;
542  }
543 
544 private:
546 
548 
549  using _FamilyAndInstanceToVersionMap =
550  std::unordered_map<std::pair<TfToken, TfToken>, UsdSchemaVersion, TfHash>;
551 
552  void _ComposeAPISchemasIntoPrimDefinition(
553  UsdPrimDefinition *primDef,
554  const TfTokenVector &appliedAPISchemas,
555  _FamilyAndInstanceToVersionMap *seenSchemaFamilyVersions) const;
556 
557  // Private class for helping initialize the schema registry. Defined
558  // entirely in the implementation. Declared here for private access to the
559  // registry.
560  class _SchemaDefInitHelper;
561 
562  std::vector<SdfLayerRefPtr> _schematicsLayers;
563 
564  std::unordered_map<TfToken, const std::unique_ptr<UsdPrimDefinition>,
565  TfHash> _concreteTypedPrimDefinitions;
566 
567  struct _APISchemaDefinitionInfo {
568  std::unique_ptr<UsdPrimDefinition> primDef;
569  bool applyExpectsInstanceName;
570  };
571  std::unordered_map<TfToken, const _APISchemaDefinitionInfo, TfHash>
572  _appliedAPIPrimDefinitions;
573 
574  UsdPrimDefinition *_emptyPrimDefinition;
575 
576  VtDictionary _fallbackPrimTypes;
577 
578  friend class UsdPrimDefinition;
579 };
580 
582 
583 // Utility function for extracting the metadata about applying API schemas from
584 // the plugin metadata for the schema's type. It is useful for certain clients
585 // to be able to access this plugin data in the same way that the
586 // UsdSchemaRegistry does.
588  const TfType &apiSchemaType,
589  const TfToken &apiSchemaName,
590  UsdSchemaRegistry::TokenToTokenVectorMap *autoApplyAPISchemasMap,
591  UsdSchemaRegistry::TokenToTokenVectorMap *canOnlyApplyAPISchemasMap,
592  TfHashMap<TfToken, TfToken::Set, TfHash> *allowedInstanceNamesMap);
593 
594 // Utility for sorting a list of auto-applied API schemas. It is useful for
595 // certain clients to be able to make sure they can perform this type of sort
596 // in the exact same way as UsdSchemaRegistry does.
598  TfTokenVector *autoAppliedAPISchemas);
599 
601 
602 #endif //PXR_USD_USD_SCHEMA_REGISTRY_H
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
static T & GetInstance()
Definition: singleton.h:120
const UsdPrimDefinition * FindAppliedAPIPrimDefinition(const TfToken &typeName) const
#define USD_API
Definition: api.h:23
static USD_API TfType GetConcreteTypeFromSchemaTypeName(const TfToken &typeName)
static USD_API TfToken GetMultipleApplyNameTemplateBaseName(const std::string &nameTemplate)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const VtDictionary & GetFallbackPrimTypes() const
static USD_API bool IsAllowedSchemaIdentifier(const TfToken &schemaIdentifier)
const UsdPrimDefinition * GetEmptyPrimDefinition() const
Returns the empty prim definition.
static USD_API TfType GetTypeFromName(const TfToken &typeName)
static USD_API bool IsConcrete(const TfType &primType)
static USD_API UsdSchemaKind GetSchemaKind(const TfType &schemaType)
static USD_API std::pair< TfToken, UsdSchemaVersion > ParseSchemaFamilyAndVersionFromIdentifier(const TfToken &schemaIdentifier)
static const SchemaInfo * FindSchemaInfo()
static USD_API bool IsAllowedAPISchemaInstanceName(const TfToken &apiSchemaName, const TfToken &instanceName)
static USD_API bool IsAbstract(const TfType &primType)
static USD_API const TokenToTokenVectorMap & GetAutoApplyAPISchemas()
void Usd_SortAutoAppliedAPISchemas(TfTokenVector *autoAppliedAPISchemas)
unsigned int UsdSchemaVersion
Schema versions are specified as a single unsigned integer value.
Definition: hash.h:472
static USD_API bool IsAllowedSchemaFamily(const TfToken &schemaFamily)
static USD_API TfToken MakeSchemaIdentifierForFamilyAndVersion(const TfToken &schemaFamily, UsdSchemaVersion schemaVersion)
Definition: token.h:70
static TfToken GetSchemaTypeName()
static USD_API bool IsTyped(const TfType &primType)
Returns true if the prim type primType inherits from UsdTyped.
static USD_API TfToken MakeMultipleApplyNameTemplate(const std::string &namespacePrefix, const std::string &baseName)
static USD_API bool IsMultipleApplyNameTemplate(const std::string &nameTemplate)
static USD_API const std::vector< const SchemaInfo * > & FindSchemaInfosInFamily(const TfToken &schemaFamily)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
static USD_API const TfTokenVector & GetAPISchemaCanOnlyApplyToTypeNames(const TfToken &apiSchemaName, const TfToken &instanceName=TfToken())
UsdSchemaKind kind
The schema's kind: ConcreteTyped, SingleApplyAPI, etc.
static USD_API void CollectAddtionalAutoApplyAPISchemasFromPlugins(TokenToTokenVectorMap *autoApplyAPISchemas)
static USD_API TfToken GetConcreteSchemaTypeName(const TfType &schemaType)
UsdSchemaKind
Definition: common.h:112
std::unordered_map< TfToken, TfTokenVector, TfHash > TokenToTokenVectorMap
static USD_API bool IsDisallowedField(const TfToken &fieldName)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static USD_API UsdSchemaRegistry & GetInstance()
static USD_API TfToken GetAPISchemaTypeName(const TfType &schemaType)
static USD_API TfType GetAPITypeFromSchemaTypeName(const TfToken &typeName)
static USD_API bool IsMultipleApplyAPISchema(const TfType &apiSchemaType)
Returns true if apiSchemaType is a multiple-apply API schema type.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static USD_API std::pair< TfToken, TfToken > GetTypeNameAndInstance(const TfToken &apiSchemaName)
Definition: type.h:47
void Usd_GetAPISchemaPluginApplyToInfoForType(const TfType &apiSchemaType, const TfToken &apiSchemaName, UsdSchemaRegistry::TokenToTokenVectorMap *autoApplyAPISchemasMap, UsdSchemaRegistry::TokenToTokenVectorMap *canOnlyApplyAPISchemasMap, TfHashMap< TfToken, TfToken::Set, TfHash > *allowedInstanceNamesMap)
USD_API std::unique_ptr< UsdPrimDefinition > BuildComposedPrimDefinition(const TfToken &primType, const TfTokenVector &appliedAPISchemas) const
static USD_API bool IsAppliedAPISchema(const TfType &apiSchemaType)
Returns true if apiSchemaType is an applied API schema type.
USD_API_TEMPLATE_CLASS(TfSingleton< UsdSchemaRegistry >)
UsdSchemaVersion version
The version number of the schema within its schema family.
static USD_API TfType GetTypeFromSchemaTypeName(const TfToken &typeName)
PXR_NAMESPACE_OPEN_SCOPE SDF_DECLARE_HANDLES(SdfAttributeSpec)
const UsdPrimDefinition * FindConcretePrimDefinition(const TfToken &typeName) const
static USD_API TfToken MakeMultipleApplyNameInstance(const std::string &nameTemplate, const std::string &instanceName)