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 <boost/shared_ptr.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 
359 #define _SDF_DIMENSIONED_VALUE_TYPES \
360  ((Matrix2d, matrix2d, GfMatrix2d, (2,2) )) \
361  ((Matrix3d, matrix3d, GfMatrix3d, (3,3) )) \
362  ((Matrix4d, matrix4d, GfMatrix4d, (4,4) )) \
363  ((Quath, quath, GfQuath, (4) )) \
364  ((Quatf, quatf, GfQuatf, (4) )) \
365  ((Quatd, quatd, GfQuatd, (4) )) \
366  ((Int2, int2, GfVec2i, (2) )) \
367  ((Half2, half2, GfVec2h, (2) )) \
368  ((Float2, float2, GfVec2f, (2) )) \
369  ((Double2, double2, GfVec2d, (2) )) \
370  ((Int3, int3, GfVec3i, (3) )) \
371  ((Half3, half3, GfVec3h, (3) )) \
372  ((Float3, float3, GfVec3f, (3) )) \
373  ((Double3, double3, GfVec3d, (3) )) \
374  ((Int4, int4, GfVec4i, (4) )) \
375  ((Half4, half4, GfVec4h, (4) )) \
376  ((Float4, float4, GfVec4f, (4) )) \
377  ((Double4, double4, GfVec4d, (4) ))
378 
379 #define SDF_VALUE_TYPES _SDF_SCALAR_VALUE_TYPES _SDF_DIMENSIONED_VALUE_TYPES
380 
381 // Accessors for individual elements in the value types tuples.
382 #define SDF_VALUE_CPP_TYPE(tup) BOOST_PP_TUPLE_ELEM(4, 2, tup)
383 #define SDF_VALUE_CPP_ARRAY_TYPE(tup) VtArray<BOOST_PP_TUPLE_ELEM(4, 2, tup)>
384 
385 template <class T>
386 struct SdfValueTypeTraits {
387  static const bool IsValueType = false;
388 };
389 
390 // Allow character arrays to be treated as Sdf value types.
391 // Sdf converts character arrays to strings for scene description.
392 template <int N>
393 struct SdfValueTypeTraits<char[N]> {
394  static const bool IsValueType = true;
395 };
396 
397 #define SDF_DECLARE_VALUE_TYPE_TRAITS(r, unused, elem) \
398 template <> \
399 struct SdfValueTypeTraits<SDF_VALUE_CPP_TYPE(elem)> { \
400  static const bool IsValueType = true; \
401 }; \
402 template <> \
403 struct SdfValueTypeTraits<SDF_VALUE_CPP_ARRAY_TYPE(elem)> { \
404  static const bool IsValueType = true; \
405 };
406 
407 BOOST_PP_SEQ_FOR_EACH(SDF_DECLARE_VALUE_TYPE_TRAITS, ~, SDF_VALUE_TYPES);
408 
430 SDF_API
431 bool
432 SdfConvertToValidMetadataDictionary(VtDictionary *dict, std::string *errMsg);
433 
434 #define SDF_VALUE_ROLE_NAME_TOKENS \
435  (Point) \
436  (Normal) \
437  (Vector) \
438  (Color) \
439  (Frame) \
440  (Transform) \
441  (PointIndex) \
442  (EdgeIndex) \
443  (FaceIndex) \
444  (TextureCoordinate)
445 
446 TF_DECLARE_PUBLIC_TOKENS(SdfValueRoleNames, SDF_API, SDF_VALUE_ROLE_NAME_TOKENS);
447 
448 SDF_DECLARE_HANDLES(SdfLayer);
449 
450 SDF_DECLARE_HANDLES(SdfAttributeSpec);
451 SDF_DECLARE_HANDLES(SdfPrimSpec);
452 SDF_DECLARE_HANDLES(SdfPropertySpec);
453 SDF_DECLARE_HANDLES(SdfSpec);
454 SDF_DECLARE_HANDLES(SdfRelationshipSpec);
455 SDF_DECLARE_HANDLES(SdfVariantSetSpec);
456 SDF_DECLARE_HANDLES(SdfVariantSpec);
457 
458 typedef std::map<std::string, SdfVariantSetSpecHandle>
459  SdfVariantSetSpecHandleMap;
460 
462 SDF_API
463 std::ostream & operator<<( std::ostream &out, const SdfSpecifier &spec );
464 
466 SDF_API
467 std::ostream & operator<<( std::ostream &out,
468  const SdfRelocatesMap &reloMap );
469 
471 SDF_API
472 std::ostream & operator<<( std::ostream &out,
473  const SdfTimeSampleMap &sampleMap );
474 
475 SDF_API
476 std::ostream &VtStreamOut(const SdfVariantSelectionMap &, std::ostream &);
477 
487  public boost::equality_comparable<SdfUnregisteredValue>
488 {
489 public:
491  SDF_API SdfUnregisteredValue();
492 
494  SDF_API explicit SdfUnregisteredValue(const std::string &value);
495 
497  SDF_API explicit SdfUnregisteredValue(const VtDictionary &value);
498 
500  SDF_API explicit SdfUnregisteredValue(const SdfUnregisteredValueListOp &value);
501 
503  const VtValue& GetValue() const {
504  return _value;
505  }
506 
508  friend size_t hash_value(const SdfUnregisteredValue &uv) {
509  return uv._value.GetHash();
510  }
511 
513  SDF_API bool operator==(const SdfUnregisteredValue &other) const;
514 
515 private:
516  VtValue _value;
517 };
518 
520 SDF_API std::ostream &operator << (std::ostream &out, const SdfUnregisteredValue &value);
521 
522 class Sdf_ValueTypeNamesType : boost::noncopyable {
523 public:
524  SdfValueTypeName Bool;
525  SdfValueTypeName UChar, Int, UInt, Int64, UInt64;
526  SdfValueTypeName Half, Float, Double, TimeCode;
527  SdfValueTypeName String, Token, Asset;
528  SdfValueTypeName Int2, Int3, Int4;
529  SdfValueTypeName Half2, Half3, Half4;
530  SdfValueTypeName Float2, Float3, Float4;
531  SdfValueTypeName Double2, Double3, Double4;
532  SdfValueTypeName Point3h, Point3f, Point3d;
533  SdfValueTypeName Vector3h, Vector3f, Vector3d;
534  SdfValueTypeName Normal3h, Normal3f, Normal3d;
535  SdfValueTypeName Color3h, Color3f, Color3d;
536  SdfValueTypeName Color4h, Color4f, Color4d;
537  SdfValueTypeName Quath, Quatf, Quatd;
538  SdfValueTypeName Matrix2d, Matrix3d, Matrix4d;
539  SdfValueTypeName Frame4d;
540  SdfValueTypeName TexCoord2h, TexCoord2f, TexCoord2d;
541  SdfValueTypeName TexCoord3h, TexCoord3f, TexCoord3d;
542 
543  SdfValueTypeName BoolArray;
544  SdfValueTypeName UCharArray, IntArray, UIntArray, Int64Array, UInt64Array;
545  SdfValueTypeName HalfArray, FloatArray, DoubleArray, TimeCodeArray;
546  SdfValueTypeName StringArray, TokenArray, AssetArray;
547  SdfValueTypeName Int2Array, Int3Array, Int4Array;
548  SdfValueTypeName Half2Array, Half3Array, Half4Array;
549  SdfValueTypeName Float2Array, Float3Array, Float4Array;
550  SdfValueTypeName Double2Array, Double3Array, Double4Array;
551  SdfValueTypeName Point3hArray, Point3fArray, Point3dArray;
552  SdfValueTypeName Vector3hArray, Vector3fArray, Vector3dArray;
553  SdfValueTypeName Normal3hArray, Normal3fArray, Normal3dArray;
554  SdfValueTypeName Color3hArray, Color3fArray, Color3dArray;
555  SdfValueTypeName Color4hArray, Color4fArray, Color4dArray;
556  SdfValueTypeName QuathArray, QuatfArray, QuatdArray;
557  SdfValueTypeName Matrix2dArray, Matrix3dArray, Matrix4dArray;
558  SdfValueTypeName Frame4dArray;
559  SdfValueTypeName TexCoord2hArray, TexCoord2fArray, TexCoord2dArray;
560  SdfValueTypeName TexCoord3hArray, TexCoord3fArray, TexCoord3dArray;
561 
562  SDF_API ~Sdf_ValueTypeNamesType();
563  struct _Init {
564  SDF_API static const Sdf_ValueTypeNamesType* New();
565  };
566 
567  // For Pixar internal backwards compatibility.
568  TfToken GetSerializationName(const SdfValueTypeName&) const;
569  TfToken GetSerializationName(const VtValue&) const;
570  TfToken GetSerializationName(const TfToken&) const;
571 
572 private:
573  friend const Sdf_ValueTypeNamesType* Sdf_InitializeValueTypeNames();
574  Sdf_ValueTypeNamesType();
575 };
576 
577 extern SDF_API TfStaticData<const Sdf_ValueTypeNamesType,
578  Sdf_ValueTypeNamesType::_Init> SdfValueTypeNames;
579 
594 struct SdfValueBlock {
595  bool operator==(const SdfValueBlock& block) const { return true; }
596  bool operator!=(const SdfValueBlock& block) const { return false; }
597 
598 private:
599  friend inline size_t hash_value(const SdfValueBlock &block) { return 0; }
600 };
601 
602 // Write out the string representation of a block.
603 SDF_API std::ostream& operator<<(std::ostream&, SdfValueBlock const&);
604 
605 // A class that represents a human-readable value. This is used for the special
606 // purpose of producing layers that serialize field values in alternate ways; to
607 // produce more human-readable output, for example.
608 struct SdfHumanReadableValue {
609  SdfHumanReadableValue() = default;
610  explicit SdfHumanReadableValue(std::string const &text) : _text(text) {}
611 
612  bool operator==(SdfHumanReadableValue const &other) const {
613  return GetText() == other.GetText();
614  }
615  bool operator!=(SdfHumanReadableValue const &other) const {
616  return !(*this == other);
617  }
618 
619  std::string const &GetText() const { return _text; }
620 private:
621  std::string _text;
622 };
623 
624 SDF_API
625 std::ostream &operator<<(std::ostream &out, const SdfHumanReadableValue &hrval);
626 
627 SDF_API
628 size_t hash_value(const SdfHumanReadableValue &hrval);
629 
630 PXR_NAMESPACE_CLOSE_SCOPE
631 
632 #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:503
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:594
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:486
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:113
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:508