diff --git a/python/mujoco/render.cc b/python/mujoco/render.cc index c621cd0e..d16af680 100644 --- a/python/mujoco/render.cc +++ b/python/mujoco/render.cc @@ -158,25 +158,6 @@ PYBIND11_MODULE(_render, pymodule) { // for MjWrapper types and therefore generates prettier docstrings. py::module::import("mujoco._structs"); - py::class_ mjrRect(pymodule, "MjrRect"); - mjrRect.def(py::init([](int left, int bottom, int width, int height) { - return raw::MjrRect{left, bottom, width, height}; - }), - py::arg("left"), py::arg("bottom"), py::arg("width"), - py::arg("height")); - mjrRect.def("__copy__", - [](const raw::MjrRect& other) { return raw::MjrRect(other); }); - mjrRect.def("__deepcopy__", [](const raw::MjrRect& other, py::dict) { - return raw::MjrRect(other); - }); - DefineStructFunctions(mjrRect); -#define X(var) mjrRect.def_readwrite(#var, &raw::MjrRect::var) - X(left); - X(bottom); - X(width); - X(height); -#undef X - py::class_ mjrContext(pymodule, "MjrContext"); mjrContext.def(py::init<>()); mjrContext.def(py::init()); diff --git a/python/mujoco/structs.cc b/python/mujoco/structs.cc index d8a88f0b..9f616650 100644 --- a/python/mujoco/structs.cc +++ b/python/mujoco/structs.cc @@ -898,6 +898,27 @@ This is useful for example when the MJB is not available as a file on disk.)")); X(tolrange); #undef X + + // ==================== MJRRECT ============================================== + py::class_ mjrRect(m, "MjrRect"); + mjrRect.def(py::init([](int left, int bottom, int width, int height) { + return raw::MjrRect{left, bottom, width, height}; + }), + py::arg("left"), py::arg("bottom"), py::arg("width"), + py::arg("height")); + mjrRect.def("__copy__", + [](const raw::MjrRect& other) { return raw::MjrRect(other); }); + mjrRect.def("__deepcopy__", [](const raw::MjrRect& other, py::dict) { + return raw::MjrRect(other); + }); + DefineStructFunctions(mjrRect); +#define X(var) mjrRect.def_readwrite(#var, &raw::MjrRect::var) + X(left); + X(bottom); + X(width); + X(height); +#undef X + // ==================== MJVPERTURB =========================================== py::class_ mjvPerturb(m, "MjvPerturb"); mjvPerturb.def(py::init<>());