Avoid changing semantics of mjsPlugin.name across XML sections.
The `extension` section used to discard the plugin name and write the instance name in `plugin.name`, while all of the other sections wrote the instance name in `plugin.instance_name` and optionally the plugin name in `plugin.name` (via the function `OnePlugin`). Now all plugin names are in `plugin.plugin_name` and the instance is written in `plugin.name`, so that it is possible to lookup a plugin via its unique instance name. PiperOrigin-RevId: 683183804 Change-Id: I179ef5d221143b720db24d745b09e327bf1449ef
This commit is contained in:
committed by
Copybara-Service
parent
5bfc7da7de
commit
66faba9aa5
@@ -204,8 +204,8 @@ void mjCMesh::PointToLocal() {
|
||||
spec.userface = &spec_face_;
|
||||
spec.usertexcoord = &spec_texcoord_;
|
||||
spec.userfacetexcoord = &spec_facetexcoord_;
|
||||
spec.plugin.name = &plugin_name;
|
||||
spec.plugin.instance_name = &plugin_instance_name;
|
||||
spec.plugin.plugin_name = &plugin_name;
|
||||
spec.plugin.name = &plugin_instance_name;
|
||||
spec.info = &info;
|
||||
file = nullptr;
|
||||
content_type = nullptr;
|
||||
@@ -249,8 +249,8 @@ void mjCMesh::CopyFromSpec() {
|
||||
maxhullvert_ = spec.maxhullvert;
|
||||
plugin.active = spec.plugin.active;
|
||||
plugin.element = spec.plugin.element;
|
||||
plugin.plugin_name = spec.plugin.plugin_name;
|
||||
plugin.name = spec.plugin.name;
|
||||
plugin.instance_name = spec.plugin.instance_name;
|
||||
|
||||
// clear precompiled asset. TODO: use asset cache
|
||||
if (center_) mju_free(center_);
|
||||
@@ -271,7 +271,7 @@ void mjCMesh::CopyFromSpec() {
|
||||
mjCMesh::~mjCMesh() {
|
||||
if (center_) mju_free(center_);
|
||||
if (graph_) mju_free(graph_);
|
||||
if (spec.plugin.active && spec.plugin.instance_name->empty()) {
|
||||
if (spec.plugin.active && spec.plugin.name->empty()) {
|
||||
model->DeleteElement(spec.plugin.element);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user