mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-03-06 09:40:58 +00:00
Fix and greatly simplify texture group selection setting for texture browser
This commit is contained in:
parent
c2d8a09cc7
commit
76d969e592
1 changed files with 5 additions and 34 deletions
|
@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
internal partial class TextureBrowserForm : DelayedForm
|
||||
{
|
||||
//mxd. Constants
|
||||
private const string ALL_IMAGES = "[All]";
|
||||
private const string ALL_IMAGES = "All";
|
||||
|
||||
//mxd. Structs
|
||||
private struct TreeNodeData
|
||||
|
@ -134,45 +134,16 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd. Should we bother finding the correct texture set?
|
||||
if(General.Settings.LocateTextureGroup)
|
||||
{
|
||||
//mxd. Get the previously selected texture set
|
||||
string prevtextureset = General.Settings.ReadSetting("windows." + configname + ".textureset", "");
|
||||
TreeNode match;
|
||||
|
||||
// When texture set name is empty, select "All" texture set
|
||||
if(string.IsNullOrEmpty(prevtextureset))
|
||||
{
|
||||
match = tvTextureSets.Nodes[tvTextureSets.Nodes.Count - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
match = FindNodeByName(tvTextureSets.Nodes, prevtextureset);
|
||||
}
|
||||
|
||||
if(match != null)
|
||||
{
|
||||
IFilledTextureSet set = ((TreeNodeData)match.Tag).Set;
|
||||
foreach(ImageData img in (browseflats ? set.Flats : set.Textures))
|
||||
{
|
||||
if(img.LongName == longname)
|
||||
{
|
||||
selectedset = match;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. If the selected texture was not found in the last-selected set, try finding it in the other sets
|
||||
if(selectedset == null && selecttexture != "-")
|
||||
if(selecttexture != "-")
|
||||
{
|
||||
foreach(TreeNode n in tvTextureSets.Nodes)
|
||||
{
|
||||
selectedset = FindTextureByLongName(n, longname);
|
||||
if(selectedset != null) break;
|
||||
if (selectedset != null)
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Texture still not found? Then just select the last used set
|
||||
if(selectedset == null && match != null) selectedset = match;
|
||||
}
|
||||
|
||||
//mxd. Select the found set or "All", if none were found
|
||||
|
|
Loading…
Reference in a new issue