Update all references after attaching a plugin with multiple references.

PiperOrigin-RevId: 783784916
Change-Id: I11da14f11f9206b466bce424979264659bf9a819
This commit is contained in:
Alessio Quaglino
2025-07-16 09:22:05 -07:00
committed by Copybara-Service
parent 3cc8d7f58a
commit bca5d0c671
+8
View File
@@ -394,6 +394,14 @@ void mjCModel::CopyPlugin(const std::vector<mjCPlugin*>& source,
delete candidate;
}
}
// update other elements in the list in case of multiple references
for (auto& element : list) {
if (!element->plugin_instance_name.empty()) {
element->spec.plugin.element =
instances.at(element->plugin_instance_name)->spec.plugin.element;
}
}
}