| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <mujoco/experimental/usd/utils.h> |
| |
|
| | #include <mujoco/mujoco.h> |
| | #include <pxr/usd/sdf/path.h> |
| |
|
| | namespace mujoco { |
| | namespace usd { |
| |
|
| | constexpr const char* kUsdPrimPathKey = "usd_primpath"; |
| |
|
| | void SetUsdPrimPathUserValue(mjsElement* element, |
| | const pxr::SdfPath& prim_path) { |
| | |
| | |
| | const pxr::SdfPath* usd_primpath = new pxr::SdfPath(prim_path); |
| | mjs_setUserValueWithCleanup( |
| | element, kUsdPrimPathKey, usd_primpath, |
| | [](const void* data) { delete static_cast<const pxr::SdfPath*>(data); }); |
| | } |
| |
|
| | pxr::SdfPath GetUsdPrimPathUserValue(mjsElement* element) { |
| | const void* user_data = mjs_getUserValue(element, kUsdPrimPathKey); |
| | if (user_data) { |
| | return *static_cast<const pxr::SdfPath*>(user_data); |
| | } |
| | return pxr::SdfPath(); |
| | } |
| |
|
| | } |
| | } |
| |
|