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