mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
- More speed improvements to the texture browser
This commit is contained in:
parent
48af52afcf
commit
44745bdbc8
2 changed files with 11 additions and 4 deletions
|
@ -20,6 +20,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq; // biwa
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
|
||||
|
@ -474,13 +475,17 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// C# not Java.
|
||||
public void AddItem(ImageData image, string tooltip = "")
|
||||
{
|
||||
// check if there are already items with this texturename.
|
||||
// remove them.
|
||||
ImageBrowserItem newItem = new ImageBrowserItem(image, tooltip, uselongtexturenames);
|
||||
items.RemoveAll(item => item.TextureName == newItem.TextureName);
|
||||
items.Add(newItem);
|
||||
}
|
||||
|
||||
// biwa. Removes all duplicates. That was done each time in AddItem before. Much faster
|
||||
// to do it in one go. Not sure when there are actually duplicates
|
||||
public void MakeTexturesUnique()
|
||||
{
|
||||
items = items.GroupBy(item => item.TextureName).Select(item => item.Last()).ToList();
|
||||
}
|
||||
|
||||
// This fills the list based on the objectname filter
|
||||
private void RefillList(bool selectfirst)
|
||||
{
|
||||
|
|
|
@ -547,7 +547,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Add all available textures
|
||||
foreach(ImageData img in set.Textures) browser.AddItem(img);
|
||||
}
|
||||
|
||||
|
||||
browser.MakeTexturesUnique(); // biwa
|
||||
|
||||
// Done adding
|
||||
browser.EndAdding();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue