diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index b35c55917498b7f8b0b9b3e7c913faf098f78d15..cc2d7575542e356d3648ef88d00a2be824eaac4b 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -109,8 +109,16 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) if(!FlGui::instance()->plugins->record->value()) return; std::string fileName; - if(view) + int oldIndex = -1; + if(view){ + for(int i = 0; i < p->getNbOptions(); i++){ + if(p->getOption(i)->str == "iView") { + oldIndex = p->getOption(i)->def; + p->getOption(i)->def = view->getIndex(); + } + } fileName = view->getData()->getFileName(); + } else fileName = GModel::current()->getFileName(); @@ -123,6 +131,14 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) fprintf(fp, "%s", p->serialize().c_str()); fclose(fp); } + + if(view && oldIndex != -1){ + for(int i = 0; i < p->getNbOptions(); i++){ + if(p->getOption(i)->str == "iView"){ + p->getOption(i)->def = oldIndex; + } + } + } } static void plugin_run_cb(Fl_Widget *w, void *data)