Commit b5bd8dca authored by Sylvain Thery's avatar Sylvain Thery

import_Plugin: loading several times the same mesh

parent 7693a255
...@@ -38,8 +38,6 @@ MapHandlerGen* Surface_Import_Plugin::importMeshFromFile(const QString& nameOfFi ...@@ -38,8 +38,6 @@ MapHandlerGen* Surface_Import_Plugin::importMeshFromFile(const QString& nameOfFi
QFileInfo fi(fileName); QFileInfo fi(fileName);
if(fi.exists()) if(fi.exists())
{ {
pythonRecording("importMeshFromFile", fi.baseName(), fileName);
MapHandlerGen* mhg = m_schnapps->addMap(fi.baseName(), 2); MapHandlerGen* mhg = m_schnapps->addMap(fi.baseName(), 2);
if(mhg) if(mhg)
{ {
...@@ -60,6 +58,7 @@ MapHandlerGen* Surface_Import_Plugin::importMeshFromFile(const QString& nameOfFi ...@@ -60,6 +58,7 @@ MapHandlerGen* Surface_Import_Plugin::importMeshFromFile(const QString& nameOfFi
mhg->registerAttribute(orbit, QString::fromStdString(names[i]), QString::fromStdString(types[i])); mhg->registerAttribute(orbit, QString::fromStdString(names[i]), QString::fromStdString(types[i]));
} }
} }
pythonRecording("importMeshFromFile", mhg->getName(), fileName);
return mhg; return mhg;
} }
else else
......
...@@ -727,25 +727,33 @@ MapHandlerGen* SCHNApps::duplicateMap(const QString& name, bool properties) ...@@ -727,25 +727,33 @@ MapHandlerGen* SCHNApps::duplicateMap(const QString& name, bool properties)
MapHandlerGen* SCHNApps::addMap(const QString& name, unsigned int dim) MapHandlerGen* SCHNApps::addMap(const QString& name, unsigned int dim)
{ {
QString finalName = name;
if (m_maps.contains(name)) if (m_maps.contains(name))
return NULL; {
int i = 1;
do
{
finalName = name + QString("_") + QString::number(i);
++i;
} while (m_maps.contains(finalName));
}
MapHandlerGen* mh = NULL; MapHandlerGen* mh = NULL;
switch(dim) switch(dim)
{ {
case 2 : { case 2 : {
PFP2::MAP* map = new PFP2::MAP(); PFP2::MAP* map = new PFP2::MAP();
mh = new MapHandler<PFP2>(name, this, map); mh = new MapHandler<PFP2>(finalName, this, map);
break; break;
} }
case 3 : { case 3 : {
PFP3::MAP* map = new PFP3::MAP(); PFP3::MAP* map = new PFP3::MAP();
mh = new MapHandler<PFP3>(name, this, map); mh = new MapHandler<PFP3>(finalName, this, map);
break; break;
} }
} }
m_maps.insert(name, mh); m_maps.insert(finalName, mh);
DEBUG_EMIT("mapAdded"); DEBUG_EMIT("mapAdded");
emit(mapAdded(mh)); emit(mapAdded(mh));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment