Enable attaching plugins not instantiated in the extension section.

Fixes #2217.

PiperOrigin-RevId: 695766524
Change-Id: I534b63400810bd6ef888f39f6665213280fd93ac
This commit is contained in:
Alessio Quaglino
2024-11-12 09:33:32 -08:00
committed by Copybara-Service
parent eb77d5b933
commit 45f908c165
6 changed files with 164 additions and 16 deletions
+7 -1
View File
@@ -268,10 +268,16 @@ void mjCMesh::CopyFromSpec() {
void mjCMesh::CopyPlugin() {
model->CopyExplicitPlugin(this);
}
mjCMesh::~mjCMesh() {
if (center_) mju_free(center_);
if (graph_) mju_free(graph_);
if (spec.plugin.active && spec.plugin.name->empty()) {
if (spec.plugin.active && spec.plugin.name->empty() && model) {
model->DeleteElement(spec.plugin.element);
}
}