Skip to content

Commit bca5d0c

Browse files
quaglacopybara-github
authored andcommitted
Update all references after attaching a plugin with multiple references.
PiperOrigin-RevId: 783784916 Change-Id: I11da14f11f9206b466bce424979264659bf9a819
1 parent 3cc8d7f commit bca5d0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/user/user_model.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ void mjCModel::CopyPlugin(const std::vector<mjCPlugin*>& source,
394394
delete candidate;
395395
}
396396
}
397+
398+
// update other elements in the list in case of multiple references
399+
for (auto& element : list) {
400+
if (!element->plugin_instance_name.empty()) {
401+
element->spec.plugin.element =
402+
instances.at(element->plugin_instance_name)->spec.plugin.element;
403+
}
404+
}
397405
}
398406

399407

0 commit comments

Comments
 (0)