Clean up X macros and usages for mjOption, mjStatistic, and mjVisual.
* Replace various MJOPTION_ macros with a single MJOPTION_FIELDS. * Use XVEC macro to denote vector members where there is a mixture of vector and scalar members in a given struct type. * Split up MJVISUAL_FIELDS into separate macros for each substruct. * Modify engine_print.c and Python bindings struct.h/cc to use the new X macros. PiperOrigin-RevId: 869760513 Change-Id: Idac4fe9aa99f0258e7c79802ca9023a0d4486e2d
This commit is contained in:
committed by
Copybara-Service
parent
6d8b6028e2
commit
5274e5f720
@@ -83,16 +83,20 @@ inline std::size_t NConMax(const mjData* d) {
|
||||
} // namespace
|
||||
|
||||
// ==================== MJOPTION ===============================================
|
||||
#define X(var, dim) , var(InitPyArray(std::array{dim}, ptr_->var, owner_))
|
||||
#define X(type, var, dim)
|
||||
#define XVEC(type, var, dim) \
|
||||
, var(InitPyArray(std::array{dim}, ptr_->var, owner_))
|
||||
MjOptionWrapper::MjWrapper()
|
||||
: WrapperBase([]() {
|
||||
raw::MjOption* const opt = new raw::MjOption;
|
||||
mj_defaultOption(opt);
|
||||
return opt;
|
||||
}()) MJOPTION_VECTORS {}
|
||||
}()) MJOPTION_FIELDS {}
|
||||
|
||||
MjOptionWrapper::MjWrapper(raw::MjOption* ptr, py::handle owner)
|
||||
: WrapperBase(ptr, owner) MJOPTION_VECTORS {}
|
||||
: WrapperBase(ptr, owner) MJOPTION_FIELDS {}
|
||||
|
||||
#undef XVEC
|
||||
#undef X
|
||||
|
||||
MjOptionWrapper::MjWrapper(const MjOptionWrapper& other) : MjOptionWrapper() {
|
||||
|
||||
Reference in New Issue
Block a user