schema.h
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_SDF_SCHEMA_H
25 #define PXR_USD_SDF_SCHEMA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/sdf/api.h"
29 #include "pxr/usd/sdf/allowed.h"
30 #include "pxr/usd/sdf/types.h"
31 #include "pxr/usd/sdf/valueTypeName.h"
32 
33 #include "pxr/base/plug/notice.h"
34 #include "pxr/base/tf/hash.h"
35 #include "pxr/base/tf/hashmap.h"
36 #include "pxr/base/tf/singleton.h"
38 #include "pxr/base/tf/token.h"
39 #include "pxr/base/tf/type.h"
40 #include "pxr/base/tf/weakBase.h"
41 #include "pxr/base/vt/value.h"
42 
43 #include <memory>
44 #include <string>
45 #include <vector>
46 
47 PXR_NAMESPACE_OPEN_SCOPE
48 
49 class JsValue;
50 class SdfPath;
51 class SdfPayload;
52 class SdfReference;
53 class Sdf_ValueTypeRegistry;
54 
56 
62 class SdfSchemaBase : public TfWeakBase {
63  SdfSchemaBase(const SdfSchemaBase&) = delete;
64  SdfSchemaBase& operator=(const SdfSchemaBase&) = delete;
65 protected:
66  class _SpecDefiner;
67 
68 public:
74  public:
76  const SdfSchemaBase& schema,
77  const TfToken& name,
78  const VtValue& fallbackValue);
79 
80  typedef std::vector< std::pair<TfToken, JsValue> > InfoVec;
81 
82  SDF_API const TfToken& GetName() const;
83  SDF_API const VtValue& GetFallbackValue() const;
84  SDF_API const InfoVec& GetInfo() const;
85 
86  SDF_API bool IsPlugin() const;
87  SDF_API bool IsReadOnly() const;
88  SDF_API bool HoldsChildren() const;
89 
93 
94  template <class T>
95  SdfAllowed IsValidValue(const T& value) const
96  {
97  return (_valueValidator ?
98  _valueValidator(_schema, VtValue(value)) :
99  SdfAllowed(true));
100  }
101 
102  template <class T>
103  SdfAllowed IsValidListValue(const T& value) const
104  {
105  return (_listValueValidator ?
106  _listValueValidator(_schema, VtValue(value)) :
107  SdfAllowed(true));
108  }
109 
110  template <class T>
111  SdfAllowed IsValidMapKey(const T& value) const
112  {
113  return (_mapKeyValidator ?
114  _mapKeyValidator(_schema, VtValue(value)) :
115  SdfAllowed(true));
116  }
117 
118  template <class T>
119  SdfAllowed IsValidMapValue(const T& value) const
120  {
121  return (_mapValueValidator ?
122  _mapValueValidator(_schema, VtValue(value)) :
123  SdfAllowed(true));
124  }
125 
127 
130 
131  FieldDefinition& FallbackValue(const VtValue& v);
132 
133  FieldDefinition& Plugin();
134  FieldDefinition& Children();
135  FieldDefinition& ReadOnly();
136  FieldDefinition& AddInfo(const TfToken& tok, const JsValue& val);
137 
138  using Validator =
139  SdfAllowed (*) (const SdfSchemaBase&, const VtValue&);
140  FieldDefinition& ValueValidator(Validator v);
141  FieldDefinition& ListValueValidator(Validator v);
142  FieldDefinition& MapKeyValidator(Validator v);
143  FieldDefinition& MapValueValidator(Validator v);
144 
146 
147  private:
148  const SdfSchemaBase& _schema;
149  TfToken _name;
150  VtValue _fallbackValue;
151  InfoVec _info;
152 
153  bool _isPlugin;
154  bool _isReadOnly;
155  bool _holdsChildren;
156 
157  Validator _valueValidator;
158  Validator _listValueValidator;
159  Validator _mapKeyValidator;
160  Validator _mapValueValidator;
161  };
162 
163  // Structure containing information about a field as it pertains to the
164  // spec this object defines.
165  struct _FieldInfo {
166  _FieldInfo(): required(false), metadata(false) { }
167  bool required;
168  bool metadata;
169  TfToken metadataDisplayGroup;
170  };
171 
172  class SpecDefinition;
173 
179  public:
181  SDF_API TfTokenVector GetFields() const;
182 
185  return _requiredFields;
186  }
187 
189  SDF_API TfTokenVector GetMetadataFields() const;
190 
192  SDF_API bool IsValidField(const TfToken& name) const;
193 
195  SDF_API bool IsMetadataField(const TfToken& name) const;
196 
200  SDF_API
201  TfToken GetMetadataFieldDisplayGroup(const TfToken& name) const;
202 
204  SDF_API bool IsRequiredField(const TfToken& name) const;
205 
206 
207  private:
208  typedef TfHashMap<TfToken, _FieldInfo, TfToken::HashFunctor>
209  _FieldMap;
210  _FieldMap _fields;
211 
212  // A separate vector of required field names from _fields. Access to
213  // these is in a hot path, so we cache them separately.
214  TfTokenVector _requiredFields;
215 
216  private:
217  friend class _SpecDefiner;
218  void _AddField(const TfToken& name, const _FieldInfo& fieldInfo);
219  };
220 
223  SDF_API
224  const FieldDefinition* GetFieldDefinition(const TfToken &fieldKey) const;
225 
228  inline const SpecDefinition* GetSpecDefinition(SdfSpecType specType) const {
229  return _specDefinitions[specType].second ?
230  &_specDefinitions[specType].first : nullptr;
231  }
232 
235 
238  SDF_API
239  bool IsRegistered(const TfToken &fieldKey, VtValue *fallback=NULL) const;
240 
243  SDF_API
244  bool HoldsChildren(const TfToken &fieldKey) const;
245 
248  SDF_API
249  const VtValue& GetFallback(const TfToken &fieldKey) const;
250 
252  SDF_API
253  VtValue CastToTypeOf(const TfToken &fieldKey, const VtValue &value) const;
254 
256  SDF_API
257  bool IsValidFieldForSpec(const TfToken &fieldKey, SdfSpecType specType) const;
258 
260  SDF_API TfTokenVector GetFields(SdfSpecType specType) const;
261 
263  SDF_API TfTokenVector GetMetadataFields(SdfSpecType specType) const;
264 
268  SDF_API
270  TfToken const &metadataField) const;
271 
273  SDF_API const TfTokenVector &GetRequiredFields(SdfSpecType specType) const;
274 
279  inline bool IsRequiredFieldName(const TfToken &fieldName) const {
280  for (TfToken const &fname: _requiredFieldNames) {
281  if (fname == fieldName) {
282  return true;
283  }
284  }
285  return false;
286  }
287 
289 
294 
295  SDF_API
297  SDF_API
298  static SdfAllowed IsValidIdentifier(const std::string& name);
299  SDF_API
300  static SdfAllowed IsValidNamespacedIdentifier(const std::string& name);
301  SDF_API
302  static SdfAllowed IsValidInheritPath(const SdfPath& path);
303  SDF_API
304  static SdfAllowed IsValidPayload(const SdfPayload& payload);
305  SDF_API
306  static SdfAllowed IsValidReference(const SdfReference& ref);
307  SDF_API
308  static SdfAllowed IsValidRelationshipTargetPath(const SdfPath& path);
309  SDF_API
310  static SdfAllowed IsValidRelocatesPath(const SdfPath& path);
311  SDF_API
312  static SdfAllowed IsValidSpecializesPath(const SdfPath& path);
313  SDF_API
314  static SdfAllowed IsValidSubLayer(const std::string& sublayer);
315  SDF_API
316  static SdfAllowed IsValidVariantIdentifier(const std::string& name);
317 
319 
322 
328  SDF_API
329  SdfAllowed IsValidValue(const VtValue& value) const;
330 
332  SDF_API
333  std::vector<SdfValueTypeName> GetAllTypes() const;
334 
336  SDF_API
337  SdfValueTypeName FindType(const TfToken& typeName) const;
339  SDF_API
340  SdfValueTypeName FindType(const char *typeName) const;
342  SDF_API
343  SdfValueTypeName FindType(std::string const &typeName) const;
344 
346  SDF_API
347  SdfValueTypeName FindType(const TfType& type,
348  const TfToken& role = TfToken()) const;
349 
351  SDF_API
352  SdfValueTypeName FindType(const VtValue& value,
353  const TfToken& role = TfToken()) const;
354 
358  SDF_API
359  SdfValueTypeName FindOrCreateType(const TfToken& typeName) const;
360 
362 
363 protected:
368  class _SpecDefiner {
369  public:
372 
374  const TfToken& name, bool required = false);
375  _SpecDefiner& MetadataField(
376  const TfToken& name, bool required = false);
377  _SpecDefiner& MetadataField(
378  const TfToken& name, const TfToken& displayGroup,
379  bool required = false);
380 
381  _SpecDefiner &CopyFrom(const SpecDefinition &other);
382 
384  private:
385  friend class SdfSchemaBase;
386  explicit _SpecDefiner(SdfSchemaBase *schema, SpecDefinition *definition)
387  : _schema(schema)
388  , _definition(definition)
389  {}
390  SdfSchemaBase *_schema;
391  SpecDefinition *_definition;
392  };
393 
396  public:
397  explicit _ValueTypeRegistrar(Sdf_ValueTypeRegistry*);
398 
399  class Type
400  {
401  public:
402  ~Type();
403 
404  // Specify a type with the given name, default value, and default
405  // array value of VtArray<T>.
406  template <class T>
407  Type(const TfToken& name, const T& defaultValue)
408  : Type(name, VtValue(defaultValue), VtValue(VtArray<T>()))
409  { }
410  template <class T>
411  Type(char const *name, const T& defaultValue)
412  : Type(TfToken(name),
413  VtValue(defaultValue), VtValue(VtArray<T>()))
414  { }
415 
416  // Specify a type with the given name and underlying C++ type.
417  // No default value or array value will be registered.
418  Type(const TfToken& name, const TfType& type);
419 
420  // Set C++ type name string for this type. Defaults to type name
421  // from TfType.
422  Type& CPPTypeName(const std::string& cppTypeName);
423 
424  // Set shape for this type. Defaults to shapeless.
425  Type& Dimensions(const SdfTupleDimensions& dims);
426 
427  // Set default unit for this type. Defaults to dimensionless unit.
428  Type& DefaultUnit(TfEnum unit);
429 
430  // Set role for this type. Defaults to no role.
431  Type& Role(const TfToken& role);
432 
433  // Indicate that arrays of this type are not supported.
434  Type& NoArrays();
435 
436  private:
437  Type(const TfToken& name,
438  const VtValue& defaultValue,
439  const VtValue& defaultArrayValue);
440 
441  class _Impl;
442  std::unique_ptr<_Impl> _impl;
443 
444  friend class _ValueTypeRegistrar;
445  };
446 
448  void AddType(const Type& type);
449 
450  private:
451  Sdf_ValueTypeRegistry* _registry;
452  };
453 
454  SdfSchemaBase();
455 
458  class EmptyTag {};
460 
461  virtual ~SdfSchemaBase();
462 
470  template <class T>
472  const TfToken &fieldKey, const T &fallback, bool plugin = false)
473  {
474  return _CreateField(fieldKey, VtValue(fallback), plugin);
475  }
476 
480  // Mark the definition as valid and return a pointer to it.
481  _specDefinitions[type].second = true;
482  return _SpecDefiner(this, &_specDefinitions[type].first);
483  }
484 
487  _SpecDefiner _ExtendSpecDefinition(SdfSpecType specType);
488 
491 
494  void _RegisterPluginFields();
495 
497  void _RegisterStandardTypes();
498 
500  void _RegisterLegacyTypes();
501 
503  _ValueTypeRegistrar _GetTypeRegistrar() const;
504 
508  typedef std::function<VtValue(const std::string&, const JsValue&)>
510 
513  const std::vector<const SdfSchemaBase::FieldDefinition *>
514  _UpdateMetadataFromPlugins(const PlugPluginPtrVector& plugins,
515  const std::string& metadataTag =
516  std::string(),
517  const _DefaultValueFactoryFn& defFactory =
519 
520 private:
521  friend class _SpecDefiner;
522 
523  void _OnDidRegisterPlugins(const PlugNotice::DidRegisterPlugins& n);
524 
525  // Return a _SpecDefiner for an existing spec definition, \p local.
527  return _SpecDefiner(this, local);
528  }
529 
530  void _AddRequiredFieldName(const TfToken &name);
531 
532  const SpecDefinition* _CheckAndGetSpecDefinition(SdfSpecType type) const;
533 
534  friend struct Sdf_SchemaFieldTypeRegistrar;
535  FieldDefinition& _CreateField(
536  const TfToken &fieldKey, const VtValue &fallback, bool plugin = false);
537 
538  template <class T>
539  FieldDefinition& _DoRegisterField(const TfToken &fieldKey, const T &fallback)
540  {
541  return _DoRegisterField(fieldKey, VtValue(fallback));
542  }
543 
544  FieldDefinition& _DoRegisterField(
545  const TfToken &fieldKey, const VtValue &fallback);
546 
547 private:
548  typedef TfHashMap<TfToken, SdfSchemaBase::FieldDefinition,
550  _FieldDefinitionMap;
551  _FieldDefinitionMap _fieldDefinitions;
552 
553  // Pair of definition and flag indicating validity.
554  std::pair<SdfSchemaBase::SpecDefinition, bool>
555  _specDefinitions[SdfNumSpecTypes];
556 
557  std::unique_ptr<Sdf_ValueTypeRegistry> _valueTypeRegistry;
558  TfTokenVector _requiredFieldNames;
559 };
560 
566 class SdfSchema : public SdfSchemaBase {
567 public:
568  SDF_API
569  static const SdfSchema& GetInstance()
570  {
572  }
573 
574 private:
575  friend class TfSingleton<SdfSchema>;
576  SdfSchema();
577  virtual ~SdfSchema();
578 };
579 
580 SDF_API_TEMPLATE_CLASS(TfSingleton<SdfSchema>);
581 
585 #define SDF_FIELD_KEYS \
586  ((Active, "active")) \
587  ((AllowedTokens, "allowedTokens")) \
588  ((AssetInfo, "assetInfo")) \
589  ((ColorConfiguration, "colorConfiguration")) \
590  ((ColorManagementSystem, "colorManagementSystem")) \
591  ((ColorSpace, "colorSpace")) \
592  ((Comment, "comment")) \
593  ((ConnectionPaths, "connectionPaths")) \
594  ((Custom, "custom")) \
595  ((CustomData, "customData")) \
596  ((CustomLayerData, "customLayerData")) \
597  ((Default, "default")) \
598  ((DefaultPrim, "defaultPrim")) \
599  ((DisplayGroup, "displayGroup")) \
600  ((DisplayGroupOrder, "displayGroupOrder")) \
601  ((DisplayName, "displayName")) \
602  ((DisplayUnit, "displayUnit")) \
603  ((Documentation, "documentation")) \
604  ((EndTimeCode, "endTimeCode")) \
605  ((FramePrecision, "framePrecision")) \
606  ((FramesPerSecond, "framesPerSecond")) \
607  ((Hidden, "hidden")) \
608  ((HasOwnedSubLayers, "hasOwnedSubLayers")) \
609  ((InheritPaths, "inheritPaths")) \
610  ((Instanceable, "instanceable")) \
611  ((Kind, "kind")) \
612  ((PrimOrder, "primOrder")) \
613  ((NoLoadHint, "noLoadHint")) \
614  ((Owner, "owner")) \
615  ((Payload, "payload")) \
616  ((Permission, "permission")) \
617  ((Prefix, "prefix")) \
618  ((PrefixSubstitutions, "prefixSubstitutions")) \
619  ((PropertyOrder, "propertyOrder")) \
620  ((References, "references")) \
621  ((Relocates, "relocates")) \
622  ((SessionOwner, "sessionOwner")) \
623  ((Specializes, "specializes")) \
624  ((Specifier, "specifier")) \
625  ((StartTimeCode, "startTimeCode")) \
626  ((SubLayers, "subLayers")) \
627  ((SubLayerOffsets, "subLayerOffsets")) \
628  ((Suffix, "suffix")) \
629  ((SuffixSubstitutions, "suffixSubstitutions")) \
630  ((SymmetricPeer, "symmetricPeer")) \
631  ((SymmetryArgs, "symmetryArgs")) \
632  ((SymmetryArguments, "symmetryArguments")) \
633  ((SymmetryFunction, "symmetryFunction")) \
634  ((TargetPaths, "targetPaths")) \
635  ((TimeSamples, "timeSamples")) \
636  ((TimeCodesPerSecond, "timeCodesPerSecond")) \
637  ((TypeName, "typeName")) \
638  ((VariantSelection, "variantSelection")) \
639  ((Variability, "variability")) \
640  ((VariantSetNames, "variantSetNames")) \
641  \
642  /* XXX: These fields should move into Sd. See bug 123508. */ \
643  ((EndFrame, "endFrame")) \
644  ((StartFrame, "startFrame"))
645 
646 #define SDF_CHILDREN_KEYS \
647  ((ConnectionChildren, "connectionChildren")) \
648  ((ExpressionChildren, "expressionChildren")) \
649  ((MapperArgChildren, "mapperArgChildren")) \
650  ((MapperChildren, "mapperChildren")) \
651  ((PrimChildren, "primChildren")) \
652  ((PropertyChildren, "properties")) \
653  ((RelationshipTargetChildren, "targetChildren")) \
654  ((VariantChildren, "variantChildren")) \
655  ((VariantSetChildren, "variantSetChildren"))
656 
657 TF_DECLARE_PUBLIC_TOKENS(SdfFieldKeys, SDF_API, SDF_FIELD_KEYS);
658 TF_DECLARE_PUBLIC_TOKENS(SdfChildrenKeys, SDF_API, SDF_CHILDREN_KEYS);
659 
660 PXR_NAMESPACE_CLOSE_SCOPE
661 
662 #endif // PXR_USD_SDF_SCHEMA_H
SDF_API bool IsRegistered(const TfToken &fieldKey, VtValue *fallback=NULL) const
Convenience functions for accessing specific field information.
SDF_API TfTokenVector GetMetadataFields(SdfSpecType specType) const
Returns all metadata fields registered for the given spec type.
SDF_API TfTokenVector GetFields(SdfSpecType specType) const
Returns all fields registered for the given spec type.
Manage a single instance of an object.
void _RegisterPluginFields()
Registers plugin fields and sets up handling so that fields will be added when additional plugins are...
std::function< VtValue(const std::string &, const JsValue &)> _DefaultValueFactoryFn
Factory function for creating a default value for a metadata field.
Definition: schema.h:509
static SDF_API SdfAllowed IsValidAttributeConnectionPath(const SdfPath &path)
Specific validation functions for various fields.
Manage a single instance of an object (see.
Definition: singleton.h:122
SDF_API const FieldDefinition * GetFieldDefinition(const TfToken &fieldKey) const
Returns the field definition for the given field.
bool IsRequiredFieldName(const TfToken &fieldName) const
Return true if fieldName is a required field name for at least one spec type, return false otherwise.
Definition: schema.h:279
SDF_API VtValue CastToTypeOf(const TfToken &fieldKey, const VtValue &value) const
Coerce value to the correct type for the specified field.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:62
SDF_API bool HoldsChildren(const TfToken &fieldKey) const
Returns whether the given field is a 'children' field – that is, it indexes certain children beneath ...
SDF_API TfToken GetMetadataFieldDisplayGroup(SdfSpecType specType, TfToken const &metadataField) const
Return the metadata field display group for metadata metadataField on specType.
TfTokenVector const & GetRequiredFields() const
Returns all value fields marked as required for this spec.
Definition: schema.h:184
void _RegisterLegacyTypes()
Registers legacy attribute value types.
_ValueTypeRegistrar _GetTypeRegistrar() const
Returns a type registrar.
Generic class that provides information about scene description fields but doesn't actually provide a...
Definition: schema.h:62
SDF_API bool IsValidField(const TfToken &name) const
Returns whether the given field is valid for this spec.
Class that defines fields for a spec type.
Definition: schema.h:368
An enum class that records both enum type and enum value.
Definition: enum.h:139
Functor to use for hash maps from tokens to other things.
Definition: token.h:166
_SpecDefiner & Field(const TfToken &name, bool required=false)
Functions for setting spec attributes during registration.
Represents a value type name, i.e.
Definition: valueTypeName.h:87
Basic Sdf data types.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
FieldDefinition & _RegisterField(const TfToken &fieldKey, const T &fallback, bool plugin=false)
Creates and registers a new field named fieldKey with the fallback value fallback.
Definition: schema.h:471
Class defining various attributes for a field.
Definition: schema.h:73
SDF_API TfToken GetMetadataFieldDisplayGroup(const TfToken &name) const
Returns the display group for this metadata field.
Indicates if an operation is allowed and, if not, why not.
Definition: allowed.h:47
A discriminated union type for JSON values.
Definition: value.h:61
_SpecDefiner _ExtendSpecDefinition(SdfSpecType specType)
Returns a _SpecDefiner for the previously-defined spec type for specifying additional fields.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
Represents a payload and all its meta data.
Definition: payload.h:60
SDF_API SdfAllowed IsValidValue(const VtValue &value) const
Scene description value types.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Class representing fields and other information for a spec type.
Definition: schema.h:178
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:229
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
Definition: singleton.h:137
void AddType(const Type &type)
Register a value type and its corresponding array value type.
SDF_API bool IsValidFieldForSpec(const TfToken &fieldKey, SdfSpecType specType) const
Return whether the given field is valid for the given spec type.
SDF_API TfTokenVector GetMetadataFields() const
Returns all value fields marked as metadata for this spec.
A helper for registering value types.
Definition: schema.h:395
void _RegisterStandardTypes()
Registers standard attribute value types.
Represents a reference and all its meta data.
Definition: reference.h:77
SDF_API const VtValue & GetFallback(const TfToken &fieldKey) const
Return the fallback value for the specified fieldKey or the empty value if fieldKey is not registered...
Defines an interface to registered plugins.
Definition: plugin.h:57
SdfAllowed IsValidValue(const T &value) const
Validation functions that return true if a given value passes the registered validator or if no valid...
Definition: schema.h:95
SDF_API TfTokenVector GetFields() const
Returns all fields for this spec.
This file defines some macros that are useful for declaring and using static TfTokens.
void _RegisterStandardFields()
Registers the standard fields.
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:90
SDF_API bool IsMetadataField(const TfToken &name) const
Returns whether the given field is metadata for this spec.
SDF_API bool IsRequiredField(const TfToken &name) const
Returns whether the given field is required for this spec.
Notice sent after new plugins have been registered with the Plug registry.
Definition: notice.h:50
FieldDefinition & FallbackValue(const VtValue &v)
Functions for setting field attributes during registration.
_SpecDefiner _Define(SdfSpecType type)
Registers the given spec type with this schema and return a _SpecDefiner for specifying additional fi...
Definition: schema.h:479
const SpecDefinition * GetSpecDefinition(SdfSpecType specType) const
Returns the spec definition for the given spec type.
Definition: schema.h:228
const std::vector< const SdfSchemaBase::FieldDefinition * > _UpdateMetadataFromPlugins(const PlugPluginPtrVector &plugins, const std::string &metadataTag=std::string(), const _DefaultValueFactoryFn &defFactory=_DefaultValueFactoryFn())
Registers all metadata fields specified in the given plugins under the given metadata tag.
TfType represents a dynamic runtime type.
Definition: type.h:64
Represents the shape of a value type (or that of an element in an array).
Definition: valueTypeName.h:46
Class that provides information about the various scene description fields.
Definition: schema.h:566
SDF_API std::vector< SdfValueTypeName > GetAllTypes() const
Returns all registered type names.
SDF_API const TfTokenVector & GetRequiredFields(SdfSpecType specType) const
Returns all required fields registered for the given spec type.
SDF_API SdfValueTypeName FindOrCreateType(const TfToken &typeName) const
Return the type name object for the given type name string if it exists otherwise create a temporary ...
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:141
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
SDF_API SdfValueTypeName FindType(const TfToken &typeName) const
Return the type name object for the given type name token.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
Construct an SdfSchemaBase but does not populate it with standard fields and types.
Definition: schema.h:458