Combine all mjs_attach functions into one.

PiperOrigin-RevId: 742702092
Change-Id: I89e35c59ada017cd061e2031584eeea71776743d
This commit is contained in:
Alessio Quaglino
2025-04-01 08:04:58 -07:00
committed by Copybara-Service
parent 08d22baea1
commit a02a27d4a4
13 changed files with 202 additions and 319 deletions
+2 -2
View File
@@ -3566,7 +3566,7 @@ void mjXReader::Body(XMLElement* section, mjsBody* body, mjsFrame* frame,
UpdateString(suffix, count, i);
// attach to parent
if (!mjs_attachFrame(body, pframe, /*prefix=*/"", suffix.c_str())) {
if (!mjs_attach(body->element, pframe->element, /*prefix=*/"", suffix.c_str())) {
throw mjXError(elem, mjs_getError(spec));
}
}
@@ -3642,7 +3642,7 @@ void mjXReader::Body(XMLElement* section, mjsBody* body, mjsFrame* frame,
if (!child) {
throw mjXError(elem, "could not find body '%s''%s'", body_name.c_str());
}
if (!mjs_attachBody(pframe, child, prefix.c_str(), "")) {
if (!mjs_attach(pframe->element, child->element, prefix.c_str(), "")) {
throw mjXError(elem, mjs_getError(spec));
}
} else {