All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyConversions.h File Reference
#include "pxr/pxr.h"
#include "pxr/usd/usd/api.h"
#include "pxr/base/tf/pyObjWrapper.h"
+ Include dependency graph for pyConversions.h:

Go to the source code of this file.


USD_API TfPyObjWrapper UsdVtValueToPython (const VtValue &value)
USD_API VtValue UsdPythonToSdfType (TfPyObjWrapper pyVal, SdfValueTypeName const &targetType)
USD_API bool UsdPythonToMetadataValue (const TfToken &key, const TfToken &keyPath, TfPyObjWrapper pyVal, VtValue *result)

Function Documentation

USD_API bool UsdPythonToMetadataValue ( const TfToken key,
const TfToken keyPath,
TfPyObjWrapper  pyVal,
VtValue result 

Helper for converting a python value to a metadata value for metadata known to the SdfSchema. Generates a coding error if key is unknown to the SdfSchema.

For dictionary-valued metadata, keyPath may be specified as the path in the dictionary we are targeting, so that if the dictionary was registered with a fallback for that dictionary subcomponent, we will convert appropriately to its type.

true on successful conversion, which can happen even if the converted result is an empty VtValue
USD_API VtValue UsdPythonToSdfType ( TfPyObjWrapper  pyVal,
SdfValueTypeName const targetType 

Helper for converting a python value to the target Usd/Sdf type, if possible. Invokes VtValue::CastToTypeOf() to do the conversion, if required. This internally handles python buffers (e.g. numpy) -> VtArray and some python tuple/list -> VtArray conversions. If conversion fails, returns a VtValue extracted from the pyVal, which may produce a VtValue holding a python object.

USD_API TfPyObjWrapper UsdVtValueToPython ( const VtValue value)