Add light radius attribute.

Also fix bug: light defaults were not being saved.

PiperOrigin-RevId: 625142278
Change-Id: I8ec3a5a06e9f314e98b7c34346db3c24b34d7e0b
This commit is contained in:
Yuval Tassa
2024-04-15 17:54:05 -07:00
committed by Copybara-Service
parent 683929ab34
commit 0cd28d2423
14 changed files with 135 additions and 48 deletions
+6
View File
@@ -508,6 +508,7 @@ void mjXWriter::OneLight(XMLElement* elem, mjCLight* plight, mjCDef* def) {
}
// defaults and regular
WriteAttr(elem, "radius", 1, &plight->radius, &def->light.radius);
WriteAttrKey(elem, "directional", bool_map, 2, plight->directional, def->light.directional);
WriteAttrKey(elem, "castshadow", bool_map, 2, plight->castshadow, def->light.castshadow);
WriteAttrKey(elem, "active", bool_map, 2, plight->active, def->light.active);
@@ -1172,6 +1173,11 @@ void mjXWriter::Default(XMLElement* root, mjCDef* def) {
OneCamera(elem, &def->camera, par);
if (!elem->FirstAttribute()) section->DeleteChild(elem);
// light
elem = InsertEnd(section, "light");
OneLight(elem, &def->light, par);
if (!elem->FirstAttribute()) section->DeleteChild(elem);
// pair
elem = InsertEnd(section, "pair");
OnePair(elem, &def->pair, par);