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