Merge child asset dictionary into parent spec during attach().

PiperOrigin-RevId: 717939728
Change-Id: I54f8ac87062cf19f55a16af37b777701545ed865
This commit is contained in:
Alessio Quaglino
2025-01-21 08:56:25 -08:00
committed by Copybara-Service
parent 4bb6aeb19f
commit 1412a29dac
2 changed files with 28 additions and 0 deletions
+8
View File
@@ -552,6 +552,14 @@ PYBIND11_MODULE(_specs, m) {
if (!attached_world) {
throw pybind11::value_error(mjs_getError(self.ptr));
}
for (const auto& asset : child.assets) {
if (self.assets.contains(asset.first)) {
throw pybind11::value_error("Asset " +
asset.first.cast<std::string>() +
" already exists in parent spec.");
}
self.assets[asset.first] = asset.second;
}
return mjs_bodyToFrame(&attached_world);
},
py::arg("child"), py::arg("prefix") = py::none(),