From 5cca8c14328baee8eadf4871f337b60ddb5ebadd Mon Sep 17 00:00:00 2001 From: Robert Braun Date: Thu, 22 Aug 2024 08:35:43 +0200 Subject: [PATCH] Keep custom FMIWrapper name when loading model --- HopsanGUI/loadFunctions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HopsanGUI/loadFunctions.cpp b/HopsanGUI/loadFunctions.cpp index 6adca133f..1ee325e7b 100644 --- a/HopsanGUI/loadFunctions.cpp +++ b/HopsanGUI/loadFunctions.cpp @@ -401,7 +401,13 @@ ModelObject* loadModelObject(const QDomElement &domElement, SystemObject* pSyste QDomElement xmlParameter = xmlParameters.firstChildElement(hmf::parameter::root); while (!xmlParameter.isNull()) { + QString tempName = pObj->getName(); + loadParameterValue(xmlParameter, pObj, NoUndo); + + //Some components might change name depending on a parameter (e.g. FMIWrapper), make sure to change it back if it was changed. + pSystem->renameModelObject(pObj->getName(), tempName, NoUndo); + xmlParameter = xmlParameter.nextSiblingElement(hmf::parameter::root); }