Namespace plugin instances when attaching.
Fixes #2112. PiperOrigin-RevId: 681045462 Change-Id: I2c945c5405fcb91e0f9a1b0b1e94f68d174c84ee
This commit is contained in:
committed by
Copybara-Service
parent
89aea5e217
commit
dfe8e45101
@@ -1016,6 +1016,9 @@ void mjCBody::NameSpace_(const mjCModel* m, bool propagate) {
|
||||
if (!classname.empty() && m != model) {
|
||||
classname = m->prefix + classname + m->suffix;
|
||||
}
|
||||
if (!plugin_instance_name.empty()) {
|
||||
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
|
||||
}
|
||||
|
||||
for (auto& body : bodies) {
|
||||
body->prefix = m->prefix;
|
||||
@@ -2222,6 +2225,9 @@ void mjCGeom::NameSpace(const mjCModel* m) {
|
||||
if (!spec_meshname_.empty() && model != m) {
|
||||
spec_meshname_ = m->prefix + spec_meshname_ + m->suffix;
|
||||
}
|
||||
if (!plugin_instance_name.empty()) {
|
||||
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5649,6 +5655,9 @@ void mjCActuator::NameSpace(const mjCModel* m) {
|
||||
if (!name.empty()) {
|
||||
name = m->prefix + name + m->suffix;
|
||||
}
|
||||
if (!plugin_instance_name.empty()) {
|
||||
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
|
||||
}
|
||||
spec_target_ = m->prefix + spec_target_ + m->suffix;
|
||||
spec_refsite_ = m->prefix + spec_refsite_ + m->suffix;
|
||||
spec_slidersite_ = m->prefix + spec_slidersite_ + m->suffix;
|
||||
@@ -5979,6 +5988,9 @@ void mjCSensor::NameSpace(const mjCModel* m) {
|
||||
if (!name.empty()) {
|
||||
name = m->prefix + name + m->suffix;
|
||||
}
|
||||
if (!plugin_instance_name.empty()) {
|
||||
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
|
||||
}
|
||||
prefix = m->prefix;
|
||||
suffix = m->suffix;
|
||||
}
|
||||
@@ -6919,6 +6931,7 @@ mjCPlugin::mjCPlugin(mjCModel* _model) {
|
||||
|
||||
mjCPlugin::mjCPlugin(const mjCPlugin& other) {
|
||||
*this = other;
|
||||
id = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -6934,6 +6947,15 @@ mjCPlugin& mjCPlugin::operator=(const mjCPlugin& other) {
|
||||
|
||||
|
||||
|
||||
void mjCPlugin::NameSpace(const mjCModel* m) {
|
||||
mjCBase::NameSpace(m);
|
||||
if (!instance_name.empty()) {
|
||||
instance_name = m->prefix + instance_name + m->suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// compiler
|
||||
void mjCPlugin::Compile(void) {
|
||||
const mjpPlugin* plugin = mjp_getPluginAtSlot(spec.plugin_slot);
|
||||
|
||||
Reference in New Issue
Block a user