Add plugin tests for mjSpec.

Fixes #1903.

PiperOrigin-RevId: 663352920
Change-Id: I3a9e17aec5694e49c20b542f4b0a4402f88a2f17
This commit is contained in:
Alessio Quaglino
2024-08-15 10:18:56 -07:00
committed by Copybara-Service
parent 64575f399b
commit e0e134ca63
5 changed files with 79 additions and 5 deletions
+6 -3
View File
@@ -1017,9 +1017,12 @@ PYBIND11_MODULE(_specs, m) {
mjsTuple.def("delete", [](raw::MjsTuple& self) { mjs_delete(self.element); });
// ============================= MJSPLUGIN ===================================
mjsPlugin.def_property_readonly("id", [](raw::MjsPlugin& self) -> int {
return mjs_getId(self.instance);
});
mjsPlugin.def_property(
"id",
[](raw::MjsPlugin& self) -> int { return mjs_getId(self.instance); },
[](raw::MjsPlugin& self, raw::MjsPlugin* other) {
self.instance = other->instance;
});
mjsPlugin.def("delete",
[](raw::MjsPlugin& self) { mjs_delete(self.instance); });