From 9e1aa37b55a092c230d809768601c722c742e4d8 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Tue, 22 Oct 2024 06:03:06 -0700 Subject: [PATCH] Do not self-attach `custom` tags. Fixes #2162. PiperOrigin-RevId: 688518165 Change-Id: Iad90e159514c96635676a8dd53fca41e3998d8fc --- src/user/user_model.cc | 4 ++-- test/user/user_api_test.cc | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/user/user_model.cc b/src/user/user_model.cc index e0dc7e77..51eb89c0 100644 --- a/src/user/user_model.cc +++ b/src/user/user_model.cc @@ -386,6 +386,8 @@ mjCModel& mjCModel::operator+=(const mjCModel& other) { for (const auto& key : other.key_pending_) { key_pending_.push_back(key); } + CopyList(numerics_, other.numerics_); + CopyList(texts_, other.texts_); } CopyList(flexes_, other.flexes_); CopyList(pairs_, other.pairs_); @@ -394,8 +396,6 @@ mjCModel& mjCModel::operator+=(const mjCModel& other) { CopyList(equalities_, other.equalities_); CopyList(actuators_, other.actuators_); CopyList(sensors_, other.sensors_); - CopyList(numerics_, other.numerics_); - CopyList(texts_, other.texts_); CopyList(tuples_, other.tuples_); // create new plugins and map them diff --git a/test/user/user_api_test.cc b/test/user/user_api_test.cc index 22bb76e6..6e33580f 100644 --- a/test/user/user_api_test.cc +++ b/test/user/user_api_test.cc @@ -631,6 +631,10 @@ static constexpr char xml_child[] = R"( + + + + @@ -694,6 +698,10 @@ TEST_F(MujocoTest, AttachSame) { + + + + @@ -833,6 +841,10 @@ TEST_F(MujocoTest, AttachDifferent) { + + + + @@ -957,6 +969,10 @@ TEST_F(MujocoTest, AttachFrame) { + + + + @@ -1063,6 +1079,10 @@ void TestDetachBody(bool compile) { + + + +