HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
schema.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_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"
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 
48 
49 class JsValue;
50 class SdfPath;
51 class SdfPayload;
52 class SdfReference;
53 class Sdf_ValueTypeRegistry;
54 
56 
57 /// \class SdfSchemaBase
58 ///
59 /// Generic class that provides information about scene description fields
60 /// but doesn't actually provide any fields.
61 ///
62 class SdfSchemaBase : public TfWeakBase, public hboost::noncopyable {
63 
64 protected:
65  class _SpecDefiner;
66 
67 public:
68  /// \class FieldDefinition
69  ///
70  /// Class defining various attributes for a field.
71  ///
73  public:
75  const SdfSchemaBase& schema,
76  const TfToken& name,
77  const VtValue& fallbackValue);
78 
79  typedef std::vector< std::pair<TfToken, JsValue> > InfoVec;
80 
81  SDF_API const TfToken& GetName() const;
82  SDF_API const VtValue& GetFallbackValue() const;
83  SDF_API const InfoVec& GetInfo() const;
84 
85  SDF_API bool IsPlugin() const;
86  SDF_API bool IsReadOnly() const;
87  SDF_API bool HoldsChildren() const;
88 
89  /// Validation functions that return true if a given value passes
90  /// the registered validator or if no validator has been set.
91  /// @{
92 
93  template <class T>
95  {
96  return (_valueValidator ?
97  _valueValidator(_schema, VtValue(value)) :
98  SdfAllowed(true));
99  }
100 
101  template <class T>
103  {
104  return (_listValueValidator ?
105  _listValueValidator(_schema, VtValue(value)) :
106  SdfAllowed(true));
107  }
108 
109  template <class T>
111  {
112  return (_mapKeyValidator ?
113  _mapKeyValidator(_schema, VtValue(value)) :
114  SdfAllowed(true));
115  }
116 
117  template <class T>
119  {
120  return (_mapValueValidator ?
121  _mapValueValidator(_schema, VtValue(value)) :
122  SdfAllowed(true));
123  }
124 
125  /// @}
126 
127  /// Functions for setting field attributes during registration.
128  /// @{
129 
131 
135  FieldDefinition& AddInfo(const TfToken& tok, const JsValue& val);
136 
137  using Validator =
138  SdfAllowed (*) (const SdfSchemaBase&, const VtValue&);
143 
144  /// @}
145 
146  private:
147  const SdfSchemaBase& _schema;
148  TfToken _name;
149  VtValue _fallbackValue;
150  InfoVec _info;
151 
152  bool _isPlugin;
153  bool _isReadOnly;
154  bool _holdsChildren;
155 
156  Validator _valueValidator;
157  Validator _listValueValidator;
158  Validator _mapKeyValidator;
159  Validator _mapValueValidator;
160  };
161 
162  // Structure containing information about a field as it pertains to the
163  // spec this object defines.
164  struct _FieldInfo {
165  _FieldInfo(): required(false), metadata(false) { }
166  bool required;
167  bool metadata;
169  };
170 
171  class SpecDefinition;
172 
173  /// \class SpecDefinition
174  ///
175  /// Class representing fields and other information for a spec type.
176  ///
178  public:
179  /// Returns all fields for this spec.
181 
182  /// Returns all value fields marked as required for this spec.
184 
185  /// Returns all value fields marked as metadata for this spec.
187 
188  /// Returns whether the given field is valid for this spec.
189  SDF_API bool IsValidField(const TfToken& name) const;
190 
191  /// Returns whether the given field is metadata for this spec.
192  SDF_API bool IsMetadataField(const TfToken& name) const;
193 
194  /// Returns the display group for this metadata field. Returns the
195  /// empty token if this field is not a metadata field or if this
196  /// metadata field has no display group.
197  SDF_API
198  TfToken GetMetadataFieldDisplayGroup(const TfToken& name) const;
199 
200  /// Returns whether the given field is required for this spec.
201  SDF_API bool IsRequiredField(const TfToken& name) const;
202 
203 
204  private:
206  _FieldMap;
207  _FieldMap _fields;
208 
209  private:
210  friend class _SpecDefiner;
211  void _AddField(const TfToken& name, const _FieldInfo& fieldInfo);
212  };
213 
214  /// Returns the field definition for the given field.
215  /// Returns NULL if no definition exists for given field.
216  SDF_API
217  const FieldDefinition* GetFieldDefinition(const TfToken &fieldKey) const;
218 
219  /// Returns the spec definition for the given spec type.
220  /// Returns NULL if no definition exists for the given spec type.
221  inline const SpecDefinition* GetSpecDefinition(SdfSpecType specType) const {
222  return _specDefinitions[specType].second ?
223  &_specDefinitions[specType].first : nullptr;
224  }
225 
226  /// Convenience functions for accessing specific field information.
227  /// @{
228 
229  /// Return whether the specified field has been registered. Also
230  /// optionally return the fallback value.
231  SDF_API
232  bool IsRegistered(const TfToken &fieldKey, VtValue *fallback=NULL) const;
233 
234  /// Returns whether the given field is a 'children' field -- that is, it
235  /// indexes certain children beneath the owning spec.
236  SDF_API
237  bool HoldsChildren(const TfToken &fieldKey) const;
238 
239  /// Return the fallback value for the specified \p fieldKey or the
240  /// empty value if \p fieldKey is not registered.
241  SDF_API
242  const VtValue& GetFallback(const TfToken &fieldKey) const;
243 
244  /// Coerce \p value to the correct type for the specified field.
245  SDF_API
246  VtValue CastToTypeOf(const TfToken &fieldKey, const VtValue &value) const;
247 
248  /// Return whether the given field is valid for the given spec type.
249  SDF_API
250  bool IsValidFieldForSpec(const TfToken &fieldKey, SdfSpecType specType) const;
251 
252  /// Returns all fields registered for the given spec type.
253  SDF_API TfTokenVector GetFields(SdfSpecType specType) const;
254 
255  /// Returns all metadata fields registered for the given spec type.
257 
258  /// Return the metadata field display group for metadata \a metadataField on
259  /// \a specType. Return the empty token if \a metadataField is not a
260  /// metadata field, or if it has no display group.
261  SDF_API
263  TfToken const &metadataField) const;
264 
265  /// Returns all required fields registered for the given spec type.
267 
268  /// Return true if \p fieldName is a required field name for at least one
269  /// spec type, return false otherwise. The main use of this function is to
270  /// quickly rule out field names that aren't required (and thus don't need
271  /// special handling).
272  inline bool IsRequiredFieldName(const TfToken &fieldName) const {
273  for (size_t i = 0; i != _requiredFieldNames.size(); ++i) {
274  if (_requiredFieldNames[i] == fieldName)
275  return true;
276  }
277  return false;
278  }
279 
280  /// @}
281 
282  /// Specific validation functions for various fields. These are internally
283  /// registered as validators for the associated field, but can also be
284  /// used directly.
285  /// @{
286 
290  static SdfAllowed IsValidInheritPath(const SdfPath& path);
291  static SdfAllowed IsValidPayload(const SdfPayload& payload);
296  static SdfAllowed IsValidSubLayer(const std::string& sublayer);
298 
299  /// @}
300 
301  /// Scene description value types
302  /// @{
303 
304  /// Given a value, check if it is a valid value type.
305  /// This function only checks that the type of the value is valid
306  /// for this schema. It does not imply that the value is valid for
307  /// a particular field -- the field's validation function must be
308  /// used for that.
309  SDF_API
310  SdfAllowed IsValidValue(const VtValue& value) const;
311 
312  /// Returns all registered type names.
313  std::vector<SdfValueTypeName> GetAllTypes() const;
314 
315  /// Return the type name object for the given type name token.
316  SDF_API
317  SdfValueTypeName FindType(const TfToken& typeName) const;
318  /// \overload
319  SDF_API
320  SdfValueTypeName FindType(const char *typeName) const;
321  /// \overload
322  SDF_API
323  SdfValueTypeName FindType(std::string const &typeName) const;
324 
325  /// Return the type name object for the given type and optional role.
326  SDF_API
328  const TfToken& role = TfToken()) const;
329 
330  /// Return the type name object for the value's type and optional role.
331  SDF_API
333  const TfToken& role = TfToken()) const;
334 
335  /// Return the type name object for the given type name string if it
336  /// exists otherwise create a temporary type name object. Clients
337  /// should not normally need to call this.
338  SDF_API
339  SdfValueTypeName FindOrCreateType(const TfToken& typeName) const;
340 
341  /// @}
342 
343 protected:
344  /// \class _SpecDefiner
345  ///
346  /// Class that defines fields for a spec type.
347  ///
348  class _SpecDefiner {
349  public:
350  /// Functions for setting spec attributes during registration
351  /// @{
352 
354  const TfToken& name, bool required = false);
356  const TfToken& name, bool required = false);
358  const TfToken& name, const TfToken& displayGroup,
359  bool required = false);
360 
361  _SpecDefiner &CopyFrom(const SpecDefinition &other);
362 
363  /// @}
364  private:
365  friend class SdfSchemaBase;
366  explicit _SpecDefiner(SdfSchemaBase *schema, SpecDefinition *definition)
367  : _schema(schema)
368  , _definition(definition)
369  {}
370  SdfSchemaBase *_schema;
371  SpecDefinition *_definition;
372  };
373 
374  /// A helper for registering value types.
376  public:
377  explicit _ValueTypeRegistrar(Sdf_ValueTypeRegistry*);
378 
379  class Type
380  {
381  public:
382  ~Type();
383 
384  // Specify a type with the given name, default value, and default
385  // array value of VtArray<T>.
386  template <class T>
387  Type(const TfToken& name, const T& defaultValue)
388  : Type(name, VtValue(defaultValue), VtValue(VtArray<T>()))
389  { }
390  template <class T>
391  Type(char const *name, const T& defaultValue)
392  : Type(TfToken(name),
393  VtValue(defaultValue), VtValue(VtArray<T>()))
394  { }
395 
396  // Specify a type with the given name and underlying C++ type.
397  // No default value or array value will be registered.
398  Type(const TfToken& name, const TfType& type);
399 
400  // Set C++ type name string for this type. Defaults to type name
401  // from TfType.
402  Type& CPPTypeName(const std::string& cppTypeName);
403 
404  // Set shape for this type. Defaults to shapeless.
405  Type& Dimensions(const SdfTupleDimensions& dims);
406 
407  // Set default unit for this type. Defaults to dimensionless unit.
409 
410  // Set role for this type. Defaults to no role.
411  Type& Role(const TfToken& role);
412 
413  // Indicate that arrays of this type are not supported.
414  Type& NoArrays();
415 
416  private:
417  Type(const TfToken& name,
418  const VtValue& defaultValue,
419  const VtValue& defaultArrayValue);
420 
421  class _Impl;
422  std::unique_ptr<_Impl> _impl;
423 
424  friend class _ValueTypeRegistrar;
425  };
426 
427  /// Register a value type and its corresponding array value type.
428  void AddType(const Type& type);
429 
430  private:
431  Sdf_ValueTypeRegistry* _registry;
432  };
433 
434  SdfSchemaBase();
435 
436  /// Construct an SdfSchemaBase but does not populate it with standard
437  /// fields and types.
438  class EmptyTag {};
440 
441  virtual ~SdfSchemaBase();
442 
443  /// Creates and registers a new field named \p fieldKey with the fallback
444  /// value \p fallback. If \p plugin is specified, it indicates that this
445  /// field is not a built-in field from this schema, but rather a field
446  /// that was externally registered.
447  ///
448  /// It is a fatal error to call this function with a key that has already
449  /// been used for another field.
450  template <class T>
452  const TfToken &fieldKey, const T &fallback, bool plugin = false)
453  {
454  return _CreateField(fieldKey, VtValue(fallback), plugin);
455  }
456 
457  /// Registers the given spec \p type with this schema and return a
458  /// _SpecDefiner for specifying additional fields.
460  // Mark the definition as valid and return a pointer to it.
461  _specDefinitions[type].second = true;
462  return _SpecDefiner(this, &_specDefinitions[type].first);
463  }
464 
465  /// Returns a _SpecDefiner for the previously-defined spec \p type
466  /// for specifying additional fields.
468 
469  /// Registers the standard fields.
471 
472  /// Registers plugin fields and sets up handling so that fields will
473  /// be added when additional plugins are registered.
474  void _RegisterPluginFields();
475 
476  /// Registers standard attribute value types.
477  void _RegisterStandardTypes();
478 
479  /// Registers legacy attribute value types.
480  void _RegisterLegacyTypes();
481 
482  /// Returns a type registrar.
483  _ValueTypeRegistrar _GetTypeRegistrar() const;
484 
485  /// Factory function for creating a default value for a metadata
486  /// field. The parameters are the value type name and default
487  /// value (if any) specified in the defining plugin.
488  typedef std::function<VtValue(const std::string&, const JsValue&)>
490 
491  /// Registers all metadata fields specified in the given plugins
492  /// under the given metadata tag.
493  const std::vector<const SdfSchemaBase::FieldDefinition *>
494  _UpdateMetadataFromPlugins(const PlugPluginPtrVector& plugins,
495  const std::string& metadataTag =
496  std::string(),
497  const _DefaultValueFactoryFn& defFactory =
499 
500 private:
501  friend class _SpecDefiner;
502 
503  void _OnDidRegisterPlugins(const PlugNotice::DidRegisterPlugins& n);
504 
505  // Return a _SpecDefiner for an existing spec definition, \p local.
507  return _SpecDefiner(this, local);
508  }
509 
510  void _AddRequiredFieldName(const TfToken &name);
511 
512  const SpecDefinition* _CheckAndGetSpecDefinition(SdfSpecType type) const;
513 
515  FieldDefinition& _CreateField(
516  const TfToken &fieldKey, const VtValue &fallback, bool plugin = false);
517 
518  template <class T>
519  FieldDefinition& _DoRegisterField(const TfToken &fieldKey, const T &fallback)
520  {
521  return _DoRegisterField(fieldKey, VtValue(fallback));
522  }
523 
524  FieldDefinition& _DoRegisterField(
525  const TfToken &fieldKey, const VtValue &fallback);
526 
527 private:
530  _FieldDefinitionMap;
531  _FieldDefinitionMap _fieldDefinitions;
532 
533  // Pair of definition and flag indicating validity.
534  std::pair<SdfSchemaBase::SpecDefinition, bool>
535  _specDefinitions[SdfNumSpecTypes];
536 
537  std::unique_ptr<Sdf_ValueTypeRegistry> _valueTypeRegistry;
538  TfTokenVector _requiredFieldNames;
539 };
540 
541 /// \class SdfSchema
542 ///
543 /// Class that provides information about the various scene description
544 /// fields.
545 ///
546 class SdfSchema : public SdfSchemaBase {
547 public:
548  SDF_API
549  static const SdfSchema& GetInstance()
550  {
552  }
553 
554 private:
555  friend class TfSingleton<SdfSchema>;
556  SdfSchema();
557  virtual ~SdfSchema();
558 };
559 
561 
562 ///
563 /// The following fields are pre-registered by Sdf.
564 /// \showinitializer
565 #define SDF_FIELD_KEYS \
566  ((Active, "active")) \
567  ((AllowedTokens, "allowedTokens")) \
568  ((AssetInfo, "assetInfo")) \
569  ((ColorConfiguration, "colorConfiguration")) \
570  ((ColorManagementSystem, "colorManagementSystem")) \
571  ((ColorSpace, "colorSpace")) \
572  ((Comment, "comment")) \
573  ((ConnectionPaths, "connectionPaths")) \
574  ((Custom, "custom")) \
575  ((CustomData, "customData")) \
576  ((CustomLayerData, "customLayerData")) \
577  ((Default, "default")) \
578  ((DefaultPrim, "defaultPrim")) \
579  ((DisplayGroup, "displayGroup")) \
580  ((DisplayName, "displayName")) \
581  ((DisplayUnit, "displayUnit")) \
582  ((Documentation, "documentation")) \
583  ((EndTimeCode, "endTimeCode")) \
584  ((FramePrecision, "framePrecision")) \
585  ((FramesPerSecond, "framesPerSecond")) \
586  ((Hidden, "hidden")) \
587  ((HasOwnedSubLayers, "hasOwnedSubLayers")) \
588  ((InheritPaths, "inheritPaths")) \
589  ((Instanceable, "instanceable")) \
590  ((Kind, "kind")) \
591  ((PrimOrder, "primOrder")) \
592  ((NoLoadHint, "noLoadHint")) \
593  ((Owner, "owner")) \
594  ((Payload, "payload")) \
595  ((Permission, "permission")) \
596  ((Prefix, "prefix")) \
597  ((PrefixSubstitutions, "prefixSubstitutions")) \
598  ((PropertyOrder, "propertyOrder")) \
599  ((References, "references")) \
600  ((Relocates, "relocates")) \
601  ((SessionOwner, "sessionOwner")) \
602  ((Specializes, "specializes")) \
603  ((Specifier, "specifier")) \
604  ((StartTimeCode, "startTimeCode")) \
605  ((SubLayers, "subLayers")) \
606  ((SubLayerOffsets, "subLayerOffsets")) \
607  ((Suffix, "suffix")) \
608  ((SuffixSubstitutions, "suffixSubstitutions")) \
609  ((SymmetricPeer, "symmetricPeer")) \
610  ((SymmetryArgs, "symmetryArgs")) \
611  ((SymmetryArguments, "symmetryArguments")) \
612  ((SymmetryFunction, "symmetryFunction")) \
613  ((TargetPaths, "targetPaths")) \
614  ((TimeSamples, "timeSamples")) \
615  ((TimeCodesPerSecond, "timeCodesPerSecond")) \
616  ((TypeName, "typeName")) \
617  ((VariantSelection, "variantSelection")) \
618  ((Variability, "variability")) \
619  ((VariantSetNames, "variantSetNames")) \
620  \
621  /* XXX: These fields should move into Sd. See bug 123508. */ \
622  ((EndFrame, "endFrame")) \
623  ((StartFrame, "startFrame"))
624 
625 #define SDF_CHILDREN_KEYS \
626  ((ConnectionChildren, "connectionChildren")) \
627  ((ExpressionChildren, "expressionChildren")) \
628  ((MapperArgChildren, "mapperArgChildren")) \
629  ((MapperChildren, "mapperChildren")) \
630  ((PrimChildren, "primChildren")) \
631  ((PropertyChildren, "properties")) \
632  ((RelationshipTargetChildren, "targetChildren")) \
633  ((VariantChildren, "variantChildren")) \
634  ((VariantSetChildren, "variantSetChildren"))
635 
638 
640 
641 #endif // PXR_USD_SDF_SCHEMA_H
SDF_API const VtValue & GetFallback(const TfToken &fieldKey) const
static SdfAllowed IsValidNamespacedIdentifier(const std::string &name)
SDF_API TfTokenVector GetRequiredFields(SdfSpecType specType) const
Returns all required fields registered for the given spec type.
Type(const TfToken &name, const T &defaultValue)
Definition: schema.h:387
static T & GetInstance()
Definition: singleton.h:137
FieldDefinition & Children()
void _RegisterStandardFields()
Registers the standard fields.
void _RegisterPluginFields()
GLenum GLint ref
Definition: glew.h:1845
GLuint const GLchar * name
Definition: glew.h:1814
SDF_API SdfAllowed IsValidValue(const VtValue &value) const
FieldDefinition & ReadOnly()
FieldDefinition & _RegisterField(const TfToken &fieldKey, const T &fallback, bool plugin=false)
Definition: schema.h:451
SDF_API bool HoldsChildren(const TfToken &fieldKey) const
FieldDefinition(const SdfSchemaBase &schema, const TfToken &name, const VtValue &fallbackValue)
virtual ~SdfSchemaBase()
SDF_API bool IsPlugin() const
static SdfAllowed IsValidRelationshipTargetPath(const SdfPath &path)
GLuint const GLfloat * val
Definition: glew.h:2794
static SdfAllowed IsValidSubLayer(const std::string &sublayer)
Type & CPPTypeName(const std::string &cppTypeName)
FieldDefinition & FallbackValue(const VtValue &v)
SDF_API TfTokenVector GetRequiredFields() const
Returns all value fields marked as required for this spec.
_SpecDefiner _Define(SdfSpecType type)
Definition: schema.h:459
const GLint * first
Definition: glew.h:1528
SDF_API const VtValue & GetFallbackValue() const
Definition: enum.h:139
Functor to use for hash maps from tokens to other things.
Definition: token.h:166
SDF_API_TEMPLATE_CLASS(TfSingleton< SdfSchema >)
static SdfAllowed IsValidReference(const SdfReference &ref)
SDF_API TfTokenVector GetMetadataFields(SdfSpecType specType) const
Returns all metadata fields registered for the given spec type.
SdfAllowed IsValidMapKey(const T &value) const
Definition: schema.h:110
const GLdouble * v
Definition: glew.h:1391
TfToken metadataDisplayGroup
Definition: schema.h:168
std::function< VtValue(const std::string &, const JsValue &)> _DefaultValueFactoryFn
Definition: schema.h:489
_SpecDefiner & MetadataField(const TfToken &name, bool required=false)
_SpecDefiner _ExtendSpecDefinition(SdfSpecType specType)
SDF_API bool IsRequiredField(const TfToken &name) const
Returns whether the given field is required for this spec.
static SdfAllowed IsValidSpecializesPath(const SdfPath &path)
static SdfAllowed IsValidVariantIdentifier(const std::string &name)
SdfAllowed(*)(const SdfSchemaBase &, const VtValue &) Validator
Definition: schema.h:138
Type & Dimensions(const SdfTupleDimensions &dims)
friend class _SpecDefiner
Definition: schema.h:501
FieldDefinition & AddInfo(const TfToken &tok, const JsValue &val)
std::vector< std::pair< TfToken, JsValue > > InfoVec
Definition: schema.h:79
FieldDefinition & MapValueValidator(Validator v)
Type(char const *name, const T &defaultValue)
Definition: schema.h:391
Definition: token.h:87
SDF_API bool IsMetadataField(const TfToken &name) const
Returns whether the given field is metadata for this spec.
FieldDefinition & Plugin()
static SdfAllowed IsValidInheritPath(const SdfPath &path)
_ValueTypeRegistrar(Sdf_ValueTypeRegistry *)
Definition: value.h:61
_SpecDefiner & CopyFrom(const SpecDefinition &other)
_SpecDefiner & Field(const TfToken &name, bool required=false)
SDF_API bool IsValidFieldForSpec(const TfToken &fieldKey, SdfSpecType specType) const
Return whether the given field is valid for the given spec type.
GLsizei n
Definition: glew.h:4040
SDF_API bool IsValidField(const TfToken &name) const
Returns whether the given field is valid for this spec.
#define SDF_CHILDREN_KEYS
Definition: schema.h:625
FieldDefinition & MapKeyValidator(Validator v)
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
SDF_API bool IsRegistered(const TfToken &fieldKey, VtValue *fallback=NULL) const
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
Definition: types.h:166
Definition: path.h:288
static SdfAllowed IsValidAttributeConnectionPath(const SdfPath &path)
friend struct Sdf_SchemaFieldTypeRegistrar
Definition: schema.h:514
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
bool IsRequiredFieldName(const TfToken &fieldName) const
Definition: schema.h:272
static SdfAllowed IsValidRelocatesPath(const SdfPath &path)
const std::vector< const SdfSchemaBase::FieldDefinition * > _UpdateMetadataFromPlugins(const PlugPluginPtrVector &plugins, const std::string &metadataTag=std::string(), const _DefaultValueFactoryFn &defFactory=_DefaultValueFactoryFn())
static SDF_API const SdfSchema & GetInstance()
Definition: schema.h:549
A helper for registering value types.
Definition: schema.h:375
GLsizei const GLchar *const * path
Definition: glew.h:6461
SDF_API const FieldDefinition * GetFieldDefinition(const TfToken &fieldKey) const
_ValueTypeRegistrar _GetTypeRegistrar() const
Returns a type registrar.
#define SDF_API
Definition: api.h:40
GLsizei const GLchar *const * string
Definition: glew.h:1844
SDF_API SdfValueTypeName FindOrCreateType(const TfToken &typeName) const
static SdfAllowed IsValidPayload(const SdfPayload &payload)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
static SdfAllowed IsValidIdentifier(const std::string &name)
SdfSpecType
Definition: types.h:91
#define SDF_FIELD_KEYS
Definition: schema.h:565
SdfAllowed IsValidListValue(const T &value) const
Definition: schema.h:102
Type & Role(const TfToken &role)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
SdfAllowed IsValidMapValue(const T &value) const
Definition: schema.h:118
SdfAllowed IsValidValue(const T &value) const
Definition: schema.h:94
void _RegisterStandardTypes()
Registers standard attribute value types.
Definition: type.h:64
void AddType(const Type &type)
Register a value type and its corresponding array value type.
SDF_API TfTokenVector GetMetadataFields() const
Returns all value fields marked as metadata for this spec.
SDF_API TfToken GetMetadataFieldDisplayGroup(const TfToken &name) const
SDF_API TfTokenVector GetFields(SdfSpecType specType) const
Returns all fields registered for the given spec type.
SDF_API const TfToken & GetName() const
SDF_API const InfoVec & GetInfo() const
SDF_API TfToken GetMetadataFieldDisplayGroup(SdfSpecType specType, TfToken const &metadataField) const
TF_DECLARE_PUBLIC_TOKENS(SdfFieldKeys, SDF_API, SDF_FIELD_KEYS)
void _RegisterLegacyTypes()
Registers legacy attribute value types.
SDF_API VtValue CastToTypeOf(const TfToken &fieldKey, const VtValue &value) const
Coerce value to the correct type for the specified field.
FieldDefinition & ListValueValidator(Validator v)
const SpecDefinition * GetSpecDefinition(SdfSpecType specType) const
Definition: schema.h:221
GLsizei const GLfloat * value
Definition: glew.h:1849
std::vector< SdfValueTypeName > GetAllTypes() const
Returns all registered type names.
SDF_API TfTokenVector GetFields() const
Returns all fields for this spec.
Definition: value.h:174
SDF_API bool HoldsChildren() const
SDF_API SdfValueTypeName FindType(const TfToken &typeName) const
Return the type name object for the given type name token.
FieldDefinition & ValueValidator(Validator v)
TF_DECLARE_WEAK_PTRS(PlugPlugin)
type
Definition: core.h:528
SDF_API bool IsReadOnly() const