Don't save an empty <default/> section.
PiperOrigin-RevId: 520594748 Change-Id: Ib5e1eb3a93e9d579adeda1052a2c29d724d6b497
This commit is contained in:
committed by
Copybara-Service
parent
ddfcd3b325
commit
3f9defa8d0
@@ -1057,6 +1057,13 @@ void mjXWriter::Default(XMLElement* root, mjCDef* def) {
|
||||
OneActuator(elem, &def->actuator, par);
|
||||
if (!elem->FirstAttribute()) section->DeleteChild(elem);
|
||||
|
||||
// if top-level class has no members or children, delete it and return
|
||||
if (def->parentid<0 && section->NoChildren() && def->childid.empty()) {
|
||||
root->DeleteChild(section);
|
||||
delete par;
|
||||
return;
|
||||
}
|
||||
|
||||
// add children recursively
|
||||
for (int i=0; i<(int)def->childid.size(); i++) {
|
||||
Default(section, model->defaults[def->childid[i]]);
|
||||
|
||||
Reference in New Issue
Block a user