Resources are now only reloaded when needed due to changing resource related settings on the Game Configurations dialog

This commit is contained in:
codeimp 2009-05-13 22:46:03 +00:00
parent e5dc72d140
commit 9b446458c4
2 changed files with 18 additions and 2 deletions

View file

@ -41,6 +41,11 @@ namespace CodeImp.DoomBuilder.Windows
private GameConfiguration gameconfig;
private ConfigurationInfo configinfo;
private List<DefinedTextureSet> copiedsets;
private bool preventchanges = false;
private bool reloadresources = false;
// Properties
public bool ReloadResources { get { return reloadresources; } }
// Constructor
public ConfigForm()
@ -106,6 +111,8 @@ namespace CodeImp.DoomBuilder.Windows
// Enable panels
tabs.Enabled = true;
preventchanges = true;
// Get config info of selected item
configinfo = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
@ -184,6 +191,9 @@ namespace CodeImp.DoomBuilder.Windows
EditModeInfo emi = (lvi.Tag as EditModeInfo);
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
}
// Done
preventchanges = false;
}
}
@ -226,6 +236,7 @@ namespace CodeImp.DoomBuilder.Windows
// Apply to selected configuration
configinfo.Resources.Clear();
configinfo.Resources.AddRange(configdata.GetResources());
if(!preventchanges) reloadresources = true;
}
// Nodebuilder selection changed
@ -404,6 +415,7 @@ namespace CodeImp.DoomBuilder.Windows
item.Tag = s;
item.ImageIndex = 0;
listtextures.Sort();
reloadresources = true;
}
}
@ -419,6 +431,7 @@ namespace CodeImp.DoomBuilder.Windows
form.ShowDialog(this);
listtextures.SelectedItems[0].Text = s.Name;
listtextures.Sort();
reloadresources = true;
}
}
@ -432,6 +445,7 @@ namespace CodeImp.DoomBuilder.Windows
DefinedTextureSet s = (listtextures.SelectedItems[0].Tag as DefinedTextureSet);
configinfo.TextureSets.Remove(s);
listtextures.SelectedItems[0].Remove();
reloadresources = true;
}
}
@ -479,6 +493,7 @@ namespace CodeImp.DoomBuilder.Windows
configinfo.TextureSets.Add(s);
}
listtextures.Sort();
reloadresources = true;
}
}
@ -499,6 +514,7 @@ namespace CodeImp.DoomBuilder.Windows
configinfo.TextureSets.Add(s);
}
listtextures.Sort();
reloadresources = true;
}
}

View file

@ -1965,7 +1965,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Plugins.ProgramReconfigure();
// Reload resources if a map is open
if(General.Map != null) General.Actions.InvokeAction("builder_reloadresources");
if((General.Map != null) && cfgform.ReloadResources) General.Actions.InvokeAction("builder_reloadresources");
// Redraw display
RedrawDisplay();