Do not self-attach custom tags.

Fixes #2162.

PiperOrigin-RevId: 688518165
Change-Id: Iad90e159514c96635676a8dd53fca41e3998d8fc
This commit is contained in:
Alessio Quaglino
2024-10-22 06:03:06 -07:00
committed by Copybara-Service
parent 1802d9b1a7
commit 9e1aa37b55
2 changed files with 22 additions and 2 deletions
+2 -2
View File
@@ -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
+20
View File
@@ -631,6 +631,10 @@ static constexpr char xml_child[] = R"(
</default>
</default>
<custom>
<numeric data="10" name="constant"/>
</custom>
<asset>
<texture name="texture" type="2d" builtin="checker" width="32" height="32"/>
<material name="material" texture="texture" texrepeat="1 1" texuniform="true"/>
@@ -694,6 +698,10 @@ TEST_F(MujocoTest, AttachSame) {
</default>
</default>
<custom>
<numeric data="10" name="constant"/>
</custom>
<asset>
<texture name="texture" type="2d" builtin="checker" width="32" height="32"/>
<material name="material" texture="texture" texrepeat="1 1" texuniform="true"/>
@@ -833,6 +841,10 @@ TEST_F(MujocoTest, AttachDifferent) {
</default>
</default>
<custom>
<numeric data="10" name="attached-constant-1"/>
</custom>
<asset>
<texture name="attached-texture-1" type="2d" builtin="checker" width="32" height="32"/>
<material name="attached-material-1" texture="attached-texture-1" texrepeat="1 1" texuniform="true"/>
@@ -957,6 +969,10 @@ TEST_F(MujocoTest, AttachFrame) {
</default>
</default>
<custom>
<numeric data="10" name="attached-constant-1"/>
</custom>
<asset>
<texture name="attached-texture-1" type="2d" builtin="checker" width="32" height="32"/>
<material name="attached-material-1" texture="attached-texture-1" texrepeat="1 1" texuniform="true"/>
@@ -1063,6 +1079,10 @@ void TestDetachBody(bool compile) {
<material name="material" texture="texture" texrepeat="1 1" texuniform="true"/>
</asset>
<custom>
<numeric data="10" name="constant"/>
</custom>
<worldbody>
<frame name="pframe">
<frame name="cframe">