Add "cameraid" attribute to visual/global specifying the default camera to use at model load.

PiperOrigin-RevId: 773783069
Change-Id: I2fff2abdceedc982d89cee8d14b95abceea1c113
This commit is contained in:
Yuval Tassa
2025-06-20 11:39:59 -07:00
committed by Copybara-Service
parent 7dc7a349c5
commit 14dc7c2a60
15 changed files with 58 additions and 16 deletions
+4 -2
View File
@@ -127,8 +127,9 @@ const char* MJCF[nMJCF][mjXATTRNUM] = {
{"visual", "*", "0"},
{"<"},
{"global", "?", "12", "orthographic", "fovy", "ipd", "azimuth", "elevation", "linewidth",
"glow", "offwidth", "offheight", "realtime", "ellipsoidinertia", "bvactive"},
{"global", "?", "13", "cameraid", "orthographic", "fovy", "ipd", "azimuth", "elevation",
"linewidth", "glow", "offwidth", "offheight", "realtime", "ellipsoidinertia",
"bvactive"},
{"quality", "?", "5", "shadowsize", "offsamples", "numslices", "numstacks",
"numquads"},
{"headlight", "?", "4", "ambient", "diffuse", "specular", "active"},
@@ -2998,6 +2999,7 @@ void mjXReader::Visual(XMLElement* section) {
// global sub-element
if (name == "global") {
ReadAttrInt(elem, "cameraid", &vis->global.cameraid);
if (MapValue(elem, "orthographic", &n, bool_map, 2)) {
vis->global.orthographic = (n == 1);
}