Skip to content
Snippets Groups Projects
Commit f43d2f41 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

- fix missing activation of animation buttons in some cases

- partial fix for skipping empty time steps
parent cf09ef90
No related branches found
No related tags found
No related merge requests found
......@@ -195,8 +195,8 @@ int ParseFile(std::string fileName, bool close, bool warnIfMissing)
gmsh_yyviewindex = old_yyviewindex;
#if defined(HAVE_FLTK) && defined(HAVE_POST)
if(FlGui::available() && numViewsBefore != (int)PView::list.size())
FlGui::instance()->updateViews();
if(FlGui::available())
FlGui::instance()->updateViews(numViewsBefore != (int)PView::list.size());
#endif
return 1;
......@@ -383,8 +383,8 @@ int MergeFile(std::string fileName, bool warnIfMissing)
CTX::instance()->mesh.changed = ENT_ALL;
#if defined(HAVE_FLTK) && defined(HAVE_POST)
if(FlGui::available() && numViewsBefore != (int)PView::list.size())
FlGui::instance()->updateViews();
if(FlGui::available())
FlGui::instance()->updateViews(numViewsBefore != (int)PView::list.size());
#endif
if(!status) Msg::Error("Error loading '%s'", fileName.c_str());
......
......@@ -654,17 +654,19 @@ void FlGui::setGraphicTitle(std::string title)
}
}
void FlGui::updateViews()
void FlGui::updateViews(bool numberOfViewsHasChanged)
{
for(unsigned int i = 0; i < graph.size(); i++)
graph[i]->checkAnimButtons();
if(menu->module->value() == 3)
menu->setContext(menu_post, 0);
options->resetBrowser();
options->resetExternalViewList();
fields->loadFieldViewList();
plugins->resetViewBrowser();
clipping->resetBrowser();
if(numberOfViewsHasChanged){
if(menu->module->value() == 3)
menu->setContext(menu_post, 0);
options->resetBrowser();
options->resetExternalViewList();
fields->loadFieldViewList();
plugins->resetViewBrowser();
clipping->resetBrowser();
}
}
void FlGui::updateFields()
......
......@@ -89,7 +89,7 @@ class FlGui{
// set the title of the graphic windows
void setGraphicTitle(std::string title);
// update the GUI when views get added or deleted
void updateViews();
void updateViews(bool numberOfViewsHasChanged=true);
// update the GUI when fields change
void updateFields();
// reset the visibility window
......
......@@ -230,10 +230,20 @@ void status_play_manual(int time, int step)
if(busy) return;
busy = true;
if(time) {
for(unsigned int i = 0; i < PView::list.size(); i++)
if(opt_view_visible(i, GMSH_GET, 0))
opt_view_timestep(i, GMSH_SET | GMSH_GUI,
opt_view_timestep(i, GMSH_GET, 0) + step);
for(unsigned int i = 0; i < PView::list.size(); i++){
if(opt_view_visible(i, GMSH_GET, 0)){
// skip any empty steps (useful when merging only some steps)
int newStep = (int)opt_view_timestep(i, GMSH_GET, 0) + step;
int totalSteps = (int)opt_view_nb_timestep(i, GMSH_GET, 0);
while(newStep < totalSteps){
if(PView::list[i]->getData()->hasTimeStep(newStep))
break;
else
newStep += step;
}
opt_view_timestep(i, GMSH_SET | GMSH_GUI, newStep);
}
}
}
else { // hide all views except view_in_cycle
if(step > 0) {
......
......@@ -226,8 +226,7 @@ void ConnectionManager::run(std::string args)
{
int n = PView::list.size();
PView::fillVertexArray(this, length, message, swap);
if(n != (int)PView::list.size())
FlGui::instance()->updateViews();
FlGui::instance()->updateViews(n != (int)PView::list.size());
drawContext::global()->draw();
}
break;
......
......@@ -315,7 +315,7 @@ void dgDofContainer::exportMsh(const std::string name)
fprintf(f,"1\n");
fprintf(f,"%d\n", _mshStep); // should print actual time here
fprintf(f,"%d\n", Msg::GetCommSize() > 1 ? 4 : 3);
fprintf(f,"%d\n 1\n %d\n", 0/*_mshStep*/, COUNT);
fprintf(f,"%d\n 1\n %d\n", _mshStep, COUNT);
if(Msg::GetCommSize() > 1) fprintf(f,"%d\n", Msg::GetCommRank());
for (int i=0;i < _groups.getNbElementGroups() ;i++){
dgGroupOfElements *group = _groups.getElementGroup(i);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment