Remember compiler options during attach.

Note:
- Move compiler options into `mjsCompiler` struct.
- The compiler options from the attached model are not written by mj_SaveXML.
PiperOrigin-RevId: 689391440
Change-Id: I1d63c146a32f87c737b7a55b64a54b0ffe3aecc9
This commit is contained in:
Alessio Quaglino
2024-10-24 08:29:03 -07:00
committed by Copybara-Service
parent 1043633cc3
commit 159f23e6b4
24 changed files with 302 additions and 204 deletions
+10 -10
View File
@@ -920,8 +920,8 @@ void mjXWriter::Compiler(XMLElement* root) {
XMLElement* section = InsertEnd(root, "compiler");
// settings
if (!model->convexhull) {
WriteAttrTxt(section, "convexhull", FindValue(bool_map, 2, model->convexhull));
if (!model->compiler.convexhull) {
WriteAttrTxt(section, "convexhull", FindValue(bool_map, 2, model->compiler.convexhull));
}
WriteAttrTxt(section, "angle", "radian");
if (!model->get_meshdir().empty()) {
@@ -930,20 +930,20 @@ void mjXWriter::Compiler(XMLElement* root) {
if (!model->get_texturedir().empty()) {
WriteAttrTxt(section, "texturedir", model->get_texturedir());
}
if (!model->usethread) {
if (!model->compiler.usethread) {
WriteAttrTxt(section, "usethread", "false");
}
if (model->boundmass) {
WriteAttr(section, "boundmass", 1, &model->boundmass);
if (model->compiler.boundmass) {
WriteAttr(section, "boundmass", 1, &model->compiler.boundmass);
}
if (model->boundinertia) {
WriteAttr(section, "boundinertia", 1, &model->boundinertia);
if (model->compiler.boundinertia) {
WriteAttr(section, "boundinertia", 1, &model->compiler.boundinertia);
}
if (model->alignfree) {
if (model->compiler.alignfree) {
WriteAttrTxt(section, "alignfree", "true");
}
if (!model->autolimits) {
if (!model->compiler.autolimits) {
WriteAttrTxt(section, "autolimits", "false");
}
}
@@ -1611,7 +1611,7 @@ void mjXWriter::Body(XMLElement* elem, mjCBody* body, mjCFrame* frame, string_vi
WriteVector(elem, "user", body->get_userdata());
// write inertial
if (body->explicitinertial && model->inertiafromgeom!=mjINERTIAFROMGEOM_TRUE) {
if (body->explicitinertial && model->compiler.inertiafromgeom!=mjINERTIAFROMGEOM_TRUE) {
XMLElement* inertial = InsertEnd(elem, "inertial");
WriteAttr(inertial, "pos", 3, body->ipos);
WriteAttr(inertial, "quat", 4, body->iquat, unitq);