From 109f2d71190698c43175b557c2506fe34db69861 Mon Sep 17 00:00:00 2001 From: Kyle Bayes Date: Thu, 22 Feb 2024 08:35:42 -0800 Subject: [PATCH] Replace mj_makeEmptyFileVFS in Python bindings with mj_addBufferVFS. PiperOrigin-RevId: 609383859 Change-Id: Ib23ee49e803630a2895a471e9a3ed8b33551cbb9 --- python/mujoco/structs.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/mujoco/structs.cc b/python/mujoco/structs.cc index 0de15f76..40457f04 100644 --- a/python/mujoco/structs.cc +++ b/python/mujoco/structs.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include @@ -323,13 +325,11 @@ static raw::MjModel* LoadModelFileImpl( }); mj_defaultVFS(vfs.get()); for (const auto& asset : assets) { - const int vfs_error = InterceptMjErrors(mj_makeEmptyFileVFS)( - vfs.get(), asset.name, asset.content_size); + const int vfs_error = InterceptMjErrors(mj_addBufferVFS)( + vfs.get(), asset.name, asset.content, asset.content_size); if (vfs_error) { throw py::value_error("assets dict is too big"); } - std::memcpy(vfs->filedata[vfs->nfile - 1], - asset.content, asset.content_size); } } @@ -630,7 +630,7 @@ MjDataWrapper::MjWrapper(MjDataWrapper&& other) #define MJ_M(x) (x) #undef X - contact(MjContactList(ptr_->contact, NConMax(ptr_), &ptr_->ncon,owner_)), + contact(MjContactList(ptr_->contact, NConMax(ptr_), &ptr_->ncon, owner_)), #define X(dtype, var, dim0, dim1) var(InitPyArray(ptr_->var, owner_)), MJDATA_VECTOR