types.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_TYPES_H
25 #define PXR_USD_SDF_TYPES_H
26 
29 
30 #include "pxr/pxr.h"
31 #include "pxr/usd/sdf/api.h"
32 #include "pxr/usd/sdf/assetPath.h"
34 #include "pxr/usd/sdf/listOp.h"
35 #include "pxr/usd/sdf/opaqueValue.h"
36 #include "pxr/usd/sdf/timeCode.h"
37 #include "pxr/usd/sdf/valueTypeName.h"
38 
39 #include "pxr/base/arch/demangle.h"
40 #include "pxr/base/arch/inttypes.h"
41 #include "pxr/base/gf/half.h"
42 #include "pxr/base/gf/matrix2d.h"
43 #include "pxr/base/gf/matrix3d.h"
44 #include "pxr/base/gf/matrix4d.h"
45 #include "pxr/base/gf/quatd.h"
46 #include "pxr/base/gf/quatf.h"
47 #include "pxr/base/gf/quath.h"
48 #include "pxr/base/gf/vec2d.h"
49 #include "pxr/base/gf/vec2f.h"
50 #include "pxr/base/gf/vec2h.h"
51 #include "pxr/base/gf/vec2i.h"
52 #include "pxr/base/gf/vec3d.h"
53 #include "pxr/base/gf/vec3f.h"
54 #include "pxr/base/gf/vec3h.h"
55 #include "pxr/base/gf/vec3i.h"
56 #include "pxr/base/gf/vec4d.h"
57 #include "pxr/base/gf/vec4f.h"
58 #include "pxr/base/gf/vec4h.h"
59 #include "pxr/base/gf/vec4i.h"
60 #include "pxr/base/tf/enum.h"
63 #include "pxr/base/tf/token.h"
64 #include "pxr/base/tf/type.h"
65 #include "pxr/base/vt/array.h"
66 #include "pxr/base/vt/dictionary.h"
67 #include "pxr/base/vt/value.h"
68 
69 #include <boost/noncopyable.hpp>
70 #include <boost/preprocessor/list/for_each.hpp>
71 #include <boost/preprocessor/list/size.hpp>
72 #include <boost/preprocessor/punctuation/comma.hpp>
73 #include <boost/preprocessor/selection/max.hpp>
74 #include <boost/preprocessor/seq/for_each.hpp>
75 #include <boost/preprocessor/seq/seq.hpp>
76 #include <boost/preprocessor/tuple/elem.hpp>
77 #include <iosfwd>
78 #include <list>
79 #include <map>
80 #include <stdint.h>
81 #include <string>
82 #include <typeinfo>
83 #include <vector>
84 
85 PXR_NAMESPACE_OPEN_SCOPE
86 
87 class SdfPath;
88 
92  // The unknown type has a value of 0 so that SdfSpecType() is unknown.
93  SdfSpecTypeUnknown = 0,
94 
95  // Real concrete types
96  SdfSpecTypeAttribute,
97  SdfSpecTypeConnection,
98  SdfSpecTypeExpression,
99  SdfSpecTypeMapper,
100  SdfSpecTypeMapperArg,
101  SdfSpecTypePrim,
102  SdfSpecTypePseudoRoot,
103  SdfSpecTypeRelationship,
104  SdfSpecTypeRelationshipTarget,
105  SdfSpecTypeVariant,
106  SdfSpecTypeVariantSet,
107 
108  SdfNumSpecTypes
109 };
110 
124  SdfSpecifierDef,
125  SdfSpecifierOver,
126  SdfSpecifierClass,
127  SdfNumSpecifiers
128 };
129 
131 inline
132 bool
134 {
135  return (spec != SdfSpecifierOver);
136 }
137 
156  SdfPermissionPublic,
157  SdfPermissionPrivate,
158 
159  SdfNumPermissions
160 };
161 
180  SdfVariabilityVarying,
181  SdfVariabilityUniform,
182 
183  SdfNumVariabilities
184 };
185 
186 
201 {
202  SdfAuthoringErrorUnrecognizedFields,
203  SdfAuthoringErrorUnrecognizedSpecType
204 };
205 
206 // Each category of compatible units of measurement is defined by a
207 // preprocessor sequence of tuples. Each such sequence gives rise to an enum
208 // representing the corresponding unit category. All the unit categories are
209 // listed in _SDF_UNITS where each entry is a two-tuple with the unit category
210 // name as the first element, and the second element is the units in that
211 // category. Each tuple in a unit category sequence corresponds to a unit of
212 // measurement represented by an enumerant whose name is given by concatenating
213 // 'Sdf', the unit category name, the word 'Unit' and the first entry in the
214 // tuple. (E.g. units of category 'Length' are represented by an enum named
215 // SdfLengthUnit with enumerants SdfLengthUnitInch, SdfLengthUnitMeter and so
216 // forth.) The second element in the tuple is the display name for the unit,
217 // and the third element is the relative size of the unit compared to the menv
218 // default unit for the unit category (which has a relative size of 1.0).
219 // Dimensionless quantities use a special 'Dimensionless' unit category
220 // represented by the enum SdfDimensionlessUnit.
221 #define _SDF_LENGTH_UNITS \
222 ((Millimeter, "mm", 0.001)) \
223 ((Centimeter, "cm", 0.01)) \
224 ((Decimeter, "dm", 0.1)) \
225 ((Meter, "m", 1.0)) \
226 ((Kilometer, "km", 1000.0)) \
227 ((Inch, "in", 0.0254)) \
228 ((Foot, "ft", 0.3048)) \
229 ((Yard, "yd", 0.9144)) \
230 ((Mile, "mi", 1609.344))
231 
232 #define _SDF_ANGULAR_UNITS \
233 ((Degrees, "deg", 1.0)) \
234 ((Radians, "rad", 57.2957795130823208768))
235 
236 #define _SDF_DIMENSIONLESS_UNITS \
237 ((Percent, "%", 0.01)) \
238 ((Default, "default", 1.0))
239 
240 #define _SDF_UNITS \
241 ((Length, _SDF_LENGTH_UNITS), \
242 ((Angular, _SDF_ANGULAR_UNITS), \
243 ((Dimensionless, _SDF_DIMENSIONLESS_UNITS), \
244  BOOST_PP_NIL)))
245 
246 #define _SDF_UNIT_TAG(tup) BOOST_PP_TUPLE_ELEM(3, 0, tup)
247 #define _SDF_UNIT_NAME(tup) BOOST_PP_TUPLE_ELEM(3, 1, tup)
248 #define _SDF_UNIT_SCALE(tup) BOOST_PP_TUPLE_ELEM(3, 2, tup)
249 
250 #define _SDF_UNITSLIST_CATEGORY(tup) BOOST_PP_TUPLE_ELEM(2, 0, tup)
251 #define _SDF_UNITSLIST_TUPLES(tup) BOOST_PP_TUPLE_ELEM(2, 1, tup)
252 #define _SDF_UNITSLIST_ENUM(elem) BOOST_PP_CAT(BOOST_PP_CAT(Sdf, \
253  _SDF_UNITSLIST_CATEGORY(elem)), Unit)
254 
255 #define _SDF_DECLARE_UNIT_ENUMERANT(r, tag, elem) \
256  BOOST_PP_CAT(Sdf ## tag ## Unit, _SDF_UNIT_TAG(elem)),
257 
258 #define _SDF_DECLARE_UNIT_ENUM(r, unused, elem) \
259 enum _SDF_UNITSLIST_ENUM(elem) { \
260  BOOST_PP_SEQ_FOR_EACH(_SDF_DECLARE_UNIT_ENUMERANT, \
261  _SDF_UNITSLIST_CATEGORY(elem), \
262  _SDF_UNITSLIST_TUPLES(elem)) \
263 };
264 BOOST_PP_LIST_FOR_EACH(_SDF_DECLARE_UNIT_ENUM, ~, _SDF_UNITS)
265 
266 // Compute the max number of enumerants over all unit enums
267 #define _SDF_MAX_UNITS_OP(d, state, list) \
268  BOOST_PP_MAX_D(d, state, BOOST_PP_SEQ_SIZE(_SDF_UNITSLIST_TUPLES(list)))
269 #define _SDF_UNIT_MAX_UNITS \
270  BOOST_PP_LIST_FOLD_LEFT(_SDF_MAX_UNITS_OP, 0, _SDF_UNITS)
271 
272 // Compute the number of unit enums
273 #define _SDF_UNIT_NUM_TYPES BOOST_PP_LIST_SIZE(_SDF_UNITS)
274 
275 // Compute the number of bits needed to hold _SDF_UNIT_MAX_UNITS and
276 // _SDF_UNIT_NUM_TYPES.
277 #define _SDF_UNIT_MAX_UNITS_BITS TF_BITS_FOR_VALUES(_SDF_UNIT_MAX_UNITS)
278 #define _SDF_UNIT_TYPES_BITS TF_BITS_FOR_VALUES(_SDF_UNIT_NUM_TYPES)
279 
281 typedef std::map<std::string, VtValue> SdfMapperParametersMap;
282 
284 typedef std::map<std::string, std::string> SdfVariantSelectionMap;
285 
287 typedef std::map<std::string, std::vector<std::string> > SdfVariantsMap;
288 
290 // Note: This map needs to be lexicographically sorted for some downstream
291 // clients, so SdfPath::FastLessThan is explicitly omitted as
292 // the Compare template parameter.
293 typedef std::map<SdfPath, SdfPath> SdfRelocatesMap;
294 
296 typedef std::map<double, VtValue> SdfTimeSampleMap;
297 
299 SDF_API TfEnum SdfDefaultUnit( TfToken const &typeName );
300 
302 SDF_API const TfEnum &SdfDefaultUnit( const TfEnum &unit );
303 
305 SDF_API const std::string &SdfUnitCategory( const TfEnum &unit );
306 
309 SDF_API double SdfConvertUnit( const TfEnum &fromUnit, const TfEnum &toUnit );
310 
312 SDF_API const std::string &SdfGetNameForUnit( const TfEnum &unit );
313 
315 SDF_API const TfEnum &SdfGetUnitFromName( const std::string &name );
316 
318 SDF_API bool SdfValueHasValidType(VtValue const& value);
319 
322 SDF_API TfType SdfGetTypeForValueTypeName(TfToken const &name);
323 
328 
331 SDF_API TfToken SdfGetRoleNameForValueTypeName(TfToken const &typeName);
332 
333 // Sdf allows a specific set of types for attribute and metadata values.
334 // These types and some additional metadata are listed in the preprocessor
335 // sequence of tuples below. First element is a tag name that is appended to
336 // 'SdfValueType' to produce the C++ traits type for the value type.
337 // Second element is the value type name, third element is the corresponding
338 // C++ type, and the fourth element is the tuple of tuple dimensions.
339 //
340 // Libraries may extend this list and define additional value types.
341 // When doing so, the type must be declared using the SDF_DECLARE_VALUE_TYPE
342 // macro below. The type must also be registered in the associated schema using
343 // SdfSchema::_RegisterValueType(s).
344 #define _SDF_SCALAR_VALUE_TYPES \
345  ((Bool, bool, bool, () )) \
346  ((UChar, uchar, unsigned char, () )) \
347  ((Int, int, int, () )) \
348  ((UInt, uint, unsigned int, () )) \
349  ((Int64, int64, int64_t, () )) \
350  ((UInt64, uint64, uint64_t, () )) \
351  ((Half, half, GfHalf, () )) \
352  ((Float, float, float, () )) \
353  ((Double, double, double, () )) \
354  ((TimeCode, timecode, SdfTimeCode, () )) \
355  ((String, string, std::string, () )) \
356  ((Token, token, TfToken, () )) \
357  ((Asset, asset, SdfAssetPath, () )) \
358  ((Opaque, opaque, SdfOpaqueValue, () ))
359 
360 #define _SDF_DIMENSIONED_VALUE_TYPES \
361  ((Matrix2d, matrix2d, GfMatrix2d, (2,2) )) \
362  ((Matrix3d, matrix3d, GfMatrix3d, (3,3) )) \
363  ((Matrix4d, matrix4d, GfMatrix4d, (4,4) )) \
364  ((Quath, quath, GfQuath, (4) )) \
365  ((Quatf, quatf, GfQuatf, (4) )) \
366  ((Quatd, quatd, GfQuatd, (4) )) \
367  ((Int2, int2, GfVec2i, (2) )) \
368  ((Half2, half2, GfVec2h, (2) )) \
369  ((Float2, float2, GfVec2f, (2) )) \
370  ((Double2, double2, GfVec2d, (2) )) \
371  ((Int3, int3, GfVec3i, (3) )) \
372  ((Half3, half3, GfVec3h, (3) )) \
373  ((Float3, float3, GfVec3f, (3) )) \
374  ((Double3, double3, GfVec3d, (3) )) \
375  ((Int4, int4, GfVec4i, (4) )) \
376  ((Half4, half4, GfVec4h, (4) )) \
377  ((Float4, float4, GfVec4f, (4) )) \
378  ((Double4, double4, GfVec4d, (4) ))
379 
380 #define SDF_VALUE_TYPES _SDF_SCALAR_VALUE_TYPES _SDF_DIMENSIONED_VALUE_TYPES
381 
382 // Accessors for individual elements in the value types tuples.
383 #define SDF_VALUE_CPP_TYPE(tup) BOOST_PP_TUPLE_ELEM(4, 2, tup)
384 #define SDF_VALUE_CPP_ARRAY_TYPE(tup) VtArray<BOOST_PP_TUPLE_ELEM(4, 2, tup)>
385 
386 template <class T>
387 struct SdfValueTypeTraits {
388  static const bool IsValueType = false;
389 };
390 
391 // Allow character arrays to be treated as Sdf value types.
392 // Sdf converts character arrays to strings for scene description.
393 template <int N>
394 struct SdfValueTypeTraits<char[N]> {
395  static const bool IsValueType = true;
396 };
397 
398 #define SDF_DECLARE_VALUE_TYPE_TRAITS(r, unused, elem) \
399 template <> \
400 struct SdfValueTypeTraits<SDF_VALUE_CPP_TYPE(elem)> { \
401  static const bool IsValueType = true; \
402 }; \
403 template <> \
404 struct SdfValueTypeTraits<SDF_VALUE_CPP_ARRAY_TYPE(elem)> { \
405  static const bool IsValueType = true; \
406 };
407 
408 BOOST_PP_SEQ_FOR_EACH(SDF_DECLARE_VALUE_TYPE_TRAITS, ~, SDF_VALUE_TYPES);
409 
431 SDF_API
432 bool
433 SdfConvertToValidMetadataDictionary(VtDictionary *dict, std::string *errMsg);
434 
435 #define SDF_VALUE_ROLE_NAME_TOKENS \
436  (Point) \
437  (Normal) \
438  (Vector) \
439  (Color) \
440  (Frame) \
441  (Transform) \
442  (PointIndex) \
443  (EdgeIndex) \
444  (FaceIndex) \
445  (Group) \
446  (TextureCoordinate)
447 
448 TF_DECLARE_PUBLIC_TOKENS(SdfValueRoleNames, SDF_API, SDF_VALUE_ROLE_NAME_TOKENS);
449 
450 SDF_DECLARE_HANDLES(SdfLayer);
451 
452 SDF_DECLARE_HANDLES(SdfAttributeSpec);
453 SDF_DECLARE_HANDLES(SdfPrimSpec);
454 SDF_DECLARE_HANDLES(SdfPropertySpec);
455 SDF_DECLARE_HANDLES(SdfSpec);
456 SDF_DECLARE_HANDLES(SdfRelationshipSpec);
457 SDF_DECLARE_HANDLES(SdfVariantSetSpec);
458 SDF_DECLARE_HANDLES(SdfVariantSpec);
459 
460 typedef std::map<std::string, SdfVariantSetSpecHandle>
461  SdfVariantSetSpecHandleMap;
462 
464 SDF_API
465 std::ostream & operator<<( std::ostream &out, const SdfSpecifier &spec );
466 
468 SDF_API
469 std::ostream & operator<<( std::ostream &out,
470  const SdfRelocatesMap &reloMap );
471 
473 SDF_API
474 std::ostream & operator<<( std::ostream &out,
475  const SdfTimeSampleMap &sampleMap );
476 
477 SDF_API
478 std::ostream &VtStreamOut(const SdfVariantSelectionMap &, std::ostream &);
479 
489  public boost::equality_comparable<SdfUnregisteredValue>
490 {
491 public:
493  SDF_API SdfUnregisteredValue();
494 
496  SDF_API explicit SdfUnregisteredValue(const std::string &value);
497 
499  SDF_API explicit SdfUnregisteredValue(const VtDictionary &value);
500 
502  SDF_API explicit SdfUnregisteredValue(const SdfUnregisteredValueListOp &value);
503 
505  const VtValue& GetValue() const {
506  return _value;
507  }
508 
510  friend size_t hash_value(const SdfUnregisteredValue &uv) {
511  return uv._value.GetHash();
512  }
513 
515  SDF_API bool operator==(const SdfUnregisteredValue &other) const;
516 
517 private:
518  VtValue _value;
519 };
520 
522 SDF_API std::ostream &operator << (std::ostream &out, const SdfUnregisteredValue &value);
523 
524 class Sdf_ValueTypeNamesType : boost::noncopyable {
525 public:
526  SdfValueTypeName Bool;
527  SdfValueTypeName UChar, Int, UInt, Int64, UInt64;
528  SdfValueTypeName Half, Float, Double, TimeCode;
529  SdfValueTypeName String, Token, Asset;
530  SdfValueTypeName Int2, Int3, Int4;
531  SdfValueTypeName Half2, Half3, Half4;
532  SdfValueTypeName Float2, Float3, Float4;
533  SdfValueTypeName Double2, Double3, Double4;
534  SdfValueTypeName Point3h, Point3f, Point3d;
535  SdfValueTypeName Vector3h, Vector3f, Vector3d;
536  SdfValueTypeName Normal3h, Normal3f, Normal3d;
537  SdfValueTypeName Color3h, Color3f, Color3d;
538  SdfValueTypeName Color4h, Color4f, Color4d;
539  SdfValueTypeName Quath, Quatf, Quatd;
540  SdfValueTypeName Matrix2d, Matrix3d, Matrix4d;
541  SdfValueTypeName Frame4d;
542  SdfValueTypeName TexCoord2h, TexCoord2f, TexCoord2d;
543  SdfValueTypeName TexCoord3h, TexCoord3f, TexCoord3d;
544  SdfValueTypeName Opaque;
545  SdfValueTypeName Group;
546 
547  SdfValueTypeName BoolArray;
548  SdfValueTypeName UCharArray, IntArray, UIntArray, Int64Array, UInt64Array;
549  SdfValueTypeName HalfArray, FloatArray, DoubleArray, TimeCodeArray;
550  SdfValueTypeName StringArray, TokenArray, AssetArray;
551  SdfValueTypeName Int2Array, Int3Array, Int4Array;
552  SdfValueTypeName Half2Array, Half3Array, Half4Array;
553  SdfValueTypeName Float2Array, Float3Array, Float4Array;
554  SdfValueTypeName Double2Array, Double3Array, Double4Array;
555  SdfValueTypeName Point3hArray, Point3fArray, Point3dArray;
556  SdfValueTypeName Vector3hArray, Vector3fArray, Vector3dArray;
557  SdfValueTypeName Normal3hArray, Normal3fArray, Normal3dArray;
558  SdfValueTypeName Color3hArray, Color3fArray, Color3dArray;
559  SdfValueTypeName Color4hArray, Color4fArray, Color4dArray;
560  SdfValueTypeName QuathArray, QuatfArray, QuatdArray;
561  SdfValueTypeName Matrix2dArray, Matrix3dArray, Matrix4dArray;
562  SdfValueTypeName Frame4dArray;
563  SdfValueTypeName TexCoord2hArray, TexCoord2fArray, TexCoord2dArray;
564  SdfValueTypeName TexCoord3hArray, TexCoord3fArray, TexCoord3dArray;
565 
566  SDF_API ~Sdf_ValueTypeNamesType();
567  struct _Init {
568  SDF_API static const Sdf_ValueTypeNamesType* New();
569  };
570 
571  // For Pixar internal backwards compatibility.
572  TfToken GetSerializationName(const SdfValueTypeName&) const;
573  TfToken GetSerializationName(const VtValue&) const;
574  TfToken GetSerializationName(const TfToken&) const;
575 
576 private:
577  friend const Sdf_ValueTypeNamesType* Sdf_InitializeValueTypeNames();
578  Sdf_ValueTypeNamesType();
579 };
580 
581 extern SDF_API TfStaticData<const Sdf_ValueTypeNamesType,
582  Sdf_ValueTypeNamesType::_Init> SdfValueTypeNames;
583 
598 struct SdfValueBlock {
599  bool operator==(const SdfValueBlock& block) const { return true; }
600  bool operator!=(const SdfValueBlock& block) const { return false; }
601 
602 private:
603  friend inline size_t hash_value(const SdfValueBlock &block) { return 0; }
604 };
605 
606 // Write out the string representation of a block.
607 SDF_API std::ostream& operator<<(std::ostream&, SdfValueBlock const&);
608 
609 // A class that represents a human-readable value. This is used for the special
610 // purpose of producing layers that serialize field values in alternate ways; to
611 // produce more human-readable output, for example.
612 struct SdfHumanReadableValue {
613  SdfHumanReadableValue() = default;
614  explicit SdfHumanReadableValue(std::string const &text) : _text(text) {}
615 
616  bool operator==(SdfHumanReadableValue const &other) const {
617  return GetText() == other.GetText();
618  }
619  bool operator!=(SdfHumanReadableValue const &other) const {
620  return !(*this == other);
621  }
622 
623  std::string const &GetText() const { return _text; }
624 private:
625  std::string _text;
626 };
627 
628 SDF_API
629 std::ostream &operator<<(std::ostream &out, const SdfHumanReadableValue &hrval);
630 
631 SDF_API
632 size_t hash_value(const SdfHumanReadableValue &hrval);
633 
634 PXR_NAMESPACE_CLOSE_SCOPE
635 
636 #endif // PXR_USD_SDF_TYPES_H
SDF_API TfType SdfGetTypeForValueTypeName(TfToken const &name)
Given an sdf valueType name, produce TfType if the type name specifies a valid sdf value type.
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:94
Base class for SdfAttributeSpec and SdfRelationshipSpec.
Definition: propertySpec.h:59
SDF_API TfToken SdfGetRoleNameForValueTypeName(TfToken const &typeName)
Return role name for typeName.
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.
Definition: types.h:293
std::map< std::string, std::vector< std::string > > SdfVariantsMap
A map of variant set names to list of variants in those sets.
Definition: types.h:287
This header serves to simply bring in the half float datatype and provide a hash_value function.
const VtValue & GetValue() const
Returns the wrapped VtValue specified in the constructor.
Definition: types.h:505
SDF_API std::ostream & operator<<(std::ostream &out, const SdfSpecifier &spec)
Writes the string representation of SdfSpecifier to out.
A map with string keys and VtValue values.
Definition: dictionary.h:63
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.
Definition: types.h:284
Base class for all Sdf spec classes.
Definition: spec.h:51
SDF_API bool operator==(const SdfUnregisteredValue &other) const
Returns true if the wrapped VtValues are equal.
An enum class that records both enum type and enum value.
Definition: enum.h:139
Represents a value type name, i.e.
Definition: valueTypeName.h:87
SDF_API const TfEnum & SdfGetUnitFromName(const std::string &name)
Gets a unit for the given /a name.
std::map< std::string, VtValue > SdfMapperParametersMap
A map of mapper parameter names to parameter values.
Definition: types.h:281
A special value type that can be used to explicitly author an opinion for an attribute's default valu...
Definition: types.h:598
Demangle C++ typenames generated by the typeid() facility.
SDF_API bool SdfConvertToValidMetadataDictionary(VtDictionary *dict, std::string *errMsg)
Convert dict to a valid metadata dictionary for scene description.
SDF_API SdfValueTypeName SdfGetValueTypeNameForValue(VtValue const &value)
Given a value, produce the sdf valueType name.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
Stores a representation of the value for an unregistered metadata field encountered during text layer...
Definition: types.h:488
A subclass of SdfPropertySpec that holds typed data.
Definition: attributeSpec.h:56
Create or return a previously created object instance of global data.
Definition: staticData.h:114
bool SdfIsDefiningSpecifier(SdfSpecifier spec)
Returns true if the specifier defines a prim.
Definition: types.h:133
SDF_API TfEnum SdfDefaultUnit(TfToken const &typeName)
Gets the show default unit for the given /a typeName.
Represents a coherent set of alternate representations for part of a scene.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
Definition: types.h:123
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
SdfAuthoringError
An enum for TfError codes related to authoring operations.
Definition: types.h:200
Define integral types.
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:179
std::enable_if< std::is_same< Half, half >::value, size_t >::type hash_value(const Half &h)
Overload hash_value for half.
Definition: half.h:50
Represents a prim description in an SdfLayer object.
Definition: primSpec.h:74
A property that contains a reference to one or more SdfPrimSpec instances.
This file defines some macros that are useful for declaring and using static TfTokens.
SdfSpecType
An enum that specifies the type of an object.
Definition: types.h:91
SDF_API double SdfConvertUnit(const TfEnum &fromUnit, const TfEnum &toUnit)
Converts from one unit of measure to another.
VT_API size_t GetHash() const
Return a hash code for the held object by calling VtHashValue() on it.
TfType represents a dynamic runtime type.
Definition: type.h:64
SDF_API bool SdfValueHasValidType(VtValue const &value)
Given a value, returns if there is a valid corresponding valueType.
VT_API bool operator==(VtDictionary const &, VtDictionary const &)
Equality comparison.
SDF_API SdfUnregisteredValue()
Wraps an empty VtValue.
std::map< double, VtValue > SdfTimeSampleMap
A map from sample times to sample values.
Definition: types.h:296
Represents a single variant in a variant set.
Definition: variantSpec.h:55
SDF_API const std::string & SdfUnitCategory(const TfEnum &unit)
Gets the unit category for a given /a unit.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
SDF_API const std::string & SdfGetNameForUnit(const TfEnum &unit)
Gets the name for a given /a unit.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
SdfPermission
An enum that defines permission levels.
Definition: types.h:155
friend size_t hash_value(const SdfUnregisteredValue &uv)
Hash.
Definition: types.h:510