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