Reset pending keyframes in source model after attaching.

Fixes #2101.

PiperOrigin-RevId: 680526395
Change-Id: I3bd06db5231d653b1c5bc1c2ba6b03b52e65f288
This commit is contained in:
Alessio Quaglino
2024-09-30 05:04:12 -07:00
committed by Copybara-Service
parent 58a49bad96
commit 40b2ae92e5
2 changed files with 61 additions and 0 deletions
+10
View File
@@ -899,6 +899,11 @@ mjCBody& mjCBody::operator+=(const mjCFrame& other) {
// attach referencing elements
*model += *other.model;
// leave the source model in a clean state
if (other.model != model) {
other.model->key_pending_.clear();
}
// clear namespace and return body
other.model->prefix.clear();
other.model->suffix.clear();
@@ -1785,6 +1790,11 @@ mjCFrame& mjCFrame::operator+=(const mjCBody& other) {
// attach referencing elements
*model += *other.model;
// leave the source model in a clean state
if (other.model != model) {
other.model->key_pending_.clear();
}
// clear suffixes and return
other.model->suffix.clear();
other.model->prefix.clear();