24 #ifndef PXR_USD_SDF_TYPES_H
25 #define PXR_USD_SDF_TYPES_H
67 #include "pxr/base/vt/array.h"
215 #define _SDF_LENGTH_UNITS \
216 ((Millimeter, "mm", 0.001)) \
217 ((Centimeter, "cm", 0.01)) \
218 ((Decimeter, "dm", 0.1)) \
219 ((Meter, "m", 1.0)) \
220 ((Kilometer, "km", 1000.0)) \
221 ((Inch, "in", 0.0254)) \
222 ((Foot, "ft", 0.3048)) \
223 ((Yard, "yd", 0.9144)) \
224 ((Mile, "mi", 1609.344))
226 #define _SDF_ANGULAR_UNITS \
227 ((Degrees, "deg", 1.0)) \
228 ((Radians, "rad", 57.2957795130823208768))
230 #define _SDF_DIMENSIONLESS_UNITS \
231 ((Percent, "%", 0.01)) \
232 ((Default, "default", 1.0))
235 ((Length, _SDF_LENGTH_UNITS), \
236 (Angular, _SDF_ANGULAR_UNITS), \
237 (Dimensionless, _SDF_DIMENSIONLESS_UNITS))
239 #define _SDF_UNIT_TAG(tup) TF_PP_TUPLE_ELEM(0, tup)
240 #define _SDF_UNIT_NAME(tup) TF_PP_TUPLE_ELEM(1, tup)
241 #define _SDF_UNIT_SCALE(tup) TF_PP_TUPLE_ELEM(2, tup)
243 #define _SDF_UNITSLIST_CATEGORY(tup) TF_PP_TUPLE_ELEM(0, tup)
244 #define _SDF_UNITSLIST_TUPLES(tup) TF_PP_TUPLE_ELEM(1, tup)
245 #define _SDF_UNITSLIST_ENUM(elem) TF_PP_CAT(TF_PP_CAT(Sdf, \
246 _SDF_UNITSLIST_CATEGORY(elem)), Unit)
248 #define _SDF_DECLARE_UNIT_ENUMERANT(tag, elem) \
249 TF_PP_CAT(Sdf ## tag ## Unit, _SDF_UNIT_TAG(elem)),
251 #define _SDF_DECLARE_UNIT_ENUM(elem) \
252 enum _SDF_UNITSLIST_ENUM(elem) { \
253 TF_PP_SEQ_FOR_EACH(_SDF_DECLARE_UNIT_ENUMERANT, \
254 _SDF_UNITSLIST_CATEGORY(elem), \
255 _SDF_UNITSLIST_TUPLES(elem)) \
258 #define _SDF_FOR_EACH_UNITS_IMPL(macro, ...) \
259 TF_PP_FOR_EACH(macro, __VA_ARGS__)
260 #define _SDF_FOR_EACH_UNITS(macro, args) \
261 _SDF_FOR_EACH_UNITS_IMPL(macro, TF_PP_EAT_PARENS(args))
335 #define _SDF_SCALAR_VALUE_TYPES \
336 ((Bool, bool, bool, () )) \
337 ((UChar, uchar, unsigned char, () )) \
338 ((Int, int, int, () )) \
339 ((UInt, uint, unsigned int, () )) \
340 ((Int64, int64, int64_t, () )) \
341 ((UInt64, uint64, uint64_t, () )) \
342 ((Half, half, GfHalf, () )) \
343 ((Float, float, float, () )) \
344 ((Double, double, double, () )) \
345 ((TimeCode, timecode, SdfTimeCode, () )) \
346 ((String, string, std::string, () )) \
347 ((Token, token, TfToken, () )) \
348 ((Asset, asset, SdfAssetPath, () )) \
349 ((Opaque, opaque, SdfOpaqueValue, () )) \
350 ((PathExpression, pathExpression, SdfPathExpression, () ))
352 #define _SDF_DIMENSIONED_VALUE_TYPES \
353 ((Matrix2d, matrix2d, GfMatrix2d, (2,2) )) \
354 ((Matrix3d, matrix3d, GfMatrix3d, (3,3) )) \
355 ((Matrix4d, matrix4d, GfMatrix4d, (4,4) )) \
356 ((Quath, quath, GfQuath, (4) )) \
357 ((Quatf, quatf, GfQuatf, (4) )) \
358 ((Quatd, quatd, GfQuatd, (4) )) \
359 ((Int2, int2, GfVec2i, (2) )) \
360 ((Half2, half2, GfVec2h, (2) )) \
361 ((Float2, float2, GfVec2f, (2) )) \
362 ((Double2, double2, GfVec2d, (2) )) \
363 ((Int3, int3, GfVec3i, (3) )) \
364 ((Half3, half3, GfVec3h, (3) )) \
365 ((Float3, float3, GfVec3f, (3) )) \
366 ((Double3, double3, GfVec3d, (3) )) \
367 ((Int4, int4, GfVec4i, (4) )) \
368 ((Half4, half4, GfVec4h, (4) )) \
369 ((Float4, float4, GfVec4f, (4) )) \
370 ((Double4, double4, GfVec4d, (4) ))
372 #define SDF_VALUE_TYPES _SDF_SCALAR_VALUE_TYPES _SDF_DIMENSIONED_VALUE_TYPES
375 #define SDF_VALUE_CPP_TYPE(tup) TF_PP_TUPLE_ELEM(2, tup)
376 #define SDF_VALUE_CPP_ARRAY_TYPE(tup) VtArray<TF_PP_TUPLE_ELEM(2, tup)>
390 #define SDF_DECLARE_VALUE_TYPE_TRAITS(unused, elem) \
392 struct SdfValueTypeTraits<SDF_VALUE_CPP_TYPE(elem)> { \
393 static const bool IsValueType = true; \
396 struct SdfValueTypeTraits<SDF_VALUE_CPP_ARRAY_TYPE(elem)> { \
397 static const bool IsValueType = true; \
427 #define SDF_VALUE_ROLE_NAME_TOKENS \
452 typedef std::map<std::string, SdfVariantSetSpecHandle>
462 const SdfRelocatesMap &reloMap );
467 const SdfTimeSampleMap &sampleMap );
470 std::ostream &
VtStreamOut(
const SdfVariantSelectionMap &, std::ostream &);
618 return !(*
this == other);
634 #endif // PXR_USD_SDF_TYPES_H
SdfValueTypeName Normal3d
SDF_API TfType SdfGetTypeForValueTypeName(TfToken const &name)
SdfValueTypeName Float2Array
SdfValueTypeName Color4dArray
SdfValueTypeName IntArray
SdfValueTypeName Color3fArray
SdfValueTypeName QuatdArray
SdfValueTypeName UCharArray
friend size_t hash_value(const SdfValueBlock &block)
SdfValueTypeName TexCoord2fArray
SdfValueTypeName HalfArray
SdfValueTypeName QuatfArray
SdfValueTypeName Matrix2dArray
SDF_API TfToken SdfGetRoleNameForValueTypeName(TfToken const &typeName)
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.
SdfValueTypeName DoubleArray
GA_API const UT_StringHolder uv
SdfValueTypeName Int4Array
SdfValueTypeName Frame4dArray
std::map< std::string, std::vector< std::string > > SdfVariantsMap
A map of variant set names to list of variants in those sets.
GLsizei const GLchar *const * string
SdfValueTypeName TokenArray
SdfValueTypeName Normal3hArray
SdfValueTypeName TexCoord3fArray
SdfValueTypeName Vector3hArray
SdfValueTypeName Vector3fArray
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.
SdfValueTypeName Color4fArray
friend const Sdf_ValueTypeNamesType * Sdf_InitializeValueTypeNames()
SdfValueTypeName Normal3f
#define SDF_VALUE_ROLE_NAME_TOKENS
SDF_API const TfEnum & SdfGetUnitFromName(const std::string &name)
Gets a unit for the given /a name.
SdfValueTypeName TexCoord3d
SdfValueTypeName TexCoord2hArray
SdfHumanReadableValue()=default
SdfValueTypeName Point3hArray
SdfValueTypeName Half2Array
SdfValueTypeName TimeCode
TF_DECLARE_PUBLIC_TOKENS(SdfValueRoleNames, SDF_API, SDF_VALUE_ROLE_NAME_TOKENS)
SdfValueTypeName TexCoord2h
HDX_API std::ostream & operator<<(std::ostream &out, const HdxShaderInputs &pv)
SdfValueTypeName Vector3h
class SdfListOp< class SdfUnregisteredValue > SdfUnregisteredValueListOp
SdfValueTypeName Normal3fArray
SdfValueTypeName Matrix4dArray
SdfValueTypeName Vector3dArray
SdfValueTypeName Point3fArray
SdfValueTypeName Int3Array
SdfValueTypeName FloatArray
TF_PP_SEQ_FOR_EACH(SDF_DECLARE_VALUE_TYPE_TRAITS,~, SDF_VALUE_TYPES)
SdfValueTypeName Normal3h
SdfValueTypeName StringArray
SdfValueTypeName TexCoord2f
SDF_API bool SdfConvertToValidMetadataDictionary(VtDictionary *dict, std::string *errMsg)
SDF_API SdfValueTypeName SdfGetValueTypeNameForValue(VtValue const &value)
SdfValueTypeName Double2Array
SdfValueTypeName Int2Array
SdfValueTypeName Matrix3d
bool SdfIsDefiningSpecifier(SdfSpecifier spec)
Returns true if the specifier defines a prim.
SDF_API TfEnum SdfDefaultUnit(TfToken const &typeName)
Gets the show default unit for the given /a typeName.
SdfValueTypeName UIntArray
SdfValueTypeName PathExpression
SdfValueTypeName Float4Array
SdfValueTypeName TexCoord2dArray
SDF_API std::ostream & VtStreamOut(const SdfVariantSelectionMap &, std::ostream &)
std::map< std::string, SdfVariantSetSpecHandle > SdfVariantSetSpecHandleMap
SdfValueTypeName Matrix2d
png_const_structrp png_const_inforp int * unit
SDF_DECLARE_HANDLES(SdfLayer)
GLuint const GLchar * name
const VtValue & GetValue() const
Returns the wrapped VtValue specified in the constructor.
SdfValueTypeName PathExpressionArray
std::string const & GetText() const
SDF_API bool operator==(const SdfUnregisteredValue &other) const
Returns true if the wrapped VtValues are equal.
SdfValueTypeName TimeCodeArray
SdfValueTypeName Double3Array
SdfValueTypeName UInt64Array
bool operator==(SdfHumanReadableValue const &other) const
SdfValueTypeName Matrix4d
SdfValueTypeName Matrix3dArray
SdfValueTypeName Color3dArray
SDF_API TfStaticData< const Sdf_ValueTypeNamesType, Sdf_ValueTypeNamesType::_Init > SdfValueTypeNames
SdfValueTypeName Color3hArray
SdfValueTypeName Normal3dArray
VT_API size_t GetHash() const
Return a hash code for the held object by calling VtHashValue() on it.
SDF_API ~Sdf_ValueTypeNamesType()
SdfValueTypeName Int64Array
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
SdfValueTypeName Color4hArray
SdfValueTypeName Vector3d
SdfValueTypeName Half4Array
ARCH_PRAGMA_PUSH ARCH_PRAGMA_MACRO_TOO_FEW_ARGUMENTS ARCH_PRAGMA_POP typedef std::map< std::string, VtValue > SdfMapperParametersMap
A map of mapper parameter names to parameter values.
TfToken GetSerializationName(const SdfValueTypeName &) const
SDF_API double SdfConvertUnit(const TfEnum &fromUnit, const TfEnum &toUnit)
#define PXR_NAMESPACE_CLOSE_SCOPE
bool operator!=(SdfHumanReadableValue const &other) const
GA_API const UT_StringHolder N
bool operator!=(const SdfValueBlock &block) const
#define ARCH_PRAGMA_MACRO_TOO_FEW_ARGUMENTS
SDF_API size_t hash_value(const SdfHumanReadableValue &hrval)
SdfHumanReadableValue(std::string const &text)
SdfValueTypeName TexCoord3hArray
SdfValueTypeName TexCoord3dArray
SdfValueTypeName TexCoord3f
SdfValueTypeName Point3dArray
SDF_API bool SdfValueHasValidType(VtValue const &value)
Given a value, returns if there is a valid corresponding valueType.
SdfValueTypeName Half3Array
#define SDF_DECLARE_VALUE_TYPE_TRAITS(unused, elem)
SdfValueTypeName QuathArray
std::map< double, VtValue > SdfTimeSampleMap
A map from sample times to sample values.
#define _SDF_FOR_EACH_UNITS(macro, args)
static const bool IsValueType
SdfValueTypeName AssetArray
SDF_API const std::string & SdfUnitCategory(const TfEnum &unit)
Gets the unit category for a given /a unit.
static SDF_API const Sdf_ValueTypeNamesType * New()
SdfValueTypeName Vector3f
SdfValueTypeName BoolArray
SdfValueTypeName Float3Array
SdfValueTypeName Double4Array
SDF_API const std::string & SdfGetNameForUnit(const TfEnum &unit)
Gets the name for a given /a unit.
#define _SDF_DECLARE_UNIT_ENUM(elem)
SdfValueTypeName TexCoord3h
bool operator==(const SdfValueBlock &block) const
SDF_API bool operator!=(const SdfUnregisteredValue &other) const
Returns true if the wrapped VtValues are not equal.
SdfValueTypeName TexCoord2d
friend size_t hash_value(const SdfUnregisteredValue &uv)
Hash.
SDF_API SdfUnregisteredValue()
Wraps an empty VtValue.