Do not skip mjSpec's with repeated model names when attaching a new mjSpec.

PiperOrigin-RevId: 744705838
Change-Id: Ie47a3c029f443910629619b7f9ff43ab07646725
This commit is contained in:
Alessio Quaglino
2025-04-07 06:51:21 -07:00
committed by Copybara-Service
parent 58234b2217
commit d7027fb1c0
3 changed files with 33 additions and 18 deletions
+2 -2
View File
@@ -916,7 +916,7 @@ mjCBody& mjCBody::operator+=(const mjCBody& other) {
// attach frame to body
mjCBody& mjCBody::operator+=(const mjCFrame& other) {
// append a copy of the attached spec
if (other.model != model && !model->FindSpec(mjs_getString(other.model->spec.modelname))) {
if (other.model != model && !model->FindSpec(&other.model->spec.compiler)) {
model->AppendSpec(mj_copySpec(&other.model->spec), &other.model->spec.compiler);
}
@@ -2029,7 +2029,7 @@ mjCFrame& mjCFrame::operator=(const mjCFrame& other) {
// attach body to frame
mjCFrame& mjCFrame::operator+=(const mjCBody& other) {
// append a copy of the attached spec
if (other.model != model && !model->FindSpec(mjs_getString(other.model->spec.modelname))) {
if (other.model != model && !model->FindSpec(&other.model->spec.compiler)) {
model->AppendSpec(mj_copySpec(&other.model->spec), &other.model->spec.compiler);
}