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

View file

@ -1965,7 +1965,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Plugins.ProgramReconfigure(); General.Plugins.ProgramReconfigure();
// Reload resources if a map is open // 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 // Redraw display
RedrawDisplay(); RedrawDisplay();