Add cache functions to Python bindings.

PiperOrigin-RevId: 807813218
Change-Id: Ieab2843d92e79c07bc9f98196db51297a456dedb
This commit is contained in:
Kyle Bayes
2025-09-16 13:02:05 -07:00
committed by Copybara-Service
parent f2fcd05b1b
commit 9740705510
2 changed files with 22 additions and 0 deletions
+21
View File
@@ -52,6 +52,27 @@ PYBIND11_MODULE(_functions, pymodule) {
// Virtual file system
// Skipped entire section
// Asset cache
Def<traits::mj_getCacheSize>(pymodule, [](void* cache) {
return mj_getCacheSize(static_cast<mjCache*>(cache));
});
Def<traits::mj_getCacheCapacity>(pymodule, [](void* cache) {
return mj_getCacheCapacity(static_cast<mjCache*>(cache));
});
Def<traits::mj_setCacheCapacity>(pymodule, [](void* cache, std::size_t size) {
return mj_setCacheCapacity(static_cast<mjCache*>(cache), size);
});
Def<traits::mj_getCache>(pymodule, []() {
return static_cast<void*>(mj_getCache());
});
Def<traits::mj_clearCache>(pymodule, [](void* cache) {
return mj_clearCache(static_cast<mjCache*>(cache));
});
// Parse and compile
// Skipped: mj_loadXML (have MjModel.from_xml_string)
DEF_WITH_OMITTED_PY_ARGS(traits::mj_saveLastXML, "error", "error_sz")(
+1
View File
@@ -16,6 +16,7 @@
#include <Python.h>
#include <cstddef>
#include <cstdint>
#include <ios>
#include <iostream>