mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 14:30:26 +00:00
Update single texture based image icons
This commit is contained in:
parent
b445590961
commit
de20881676
6 changed files with 57 additions and 0 deletions
|
@ -125,6 +125,9 @@ namespace Toolbox.Library
|
|||
|
||||
foreach (var texIcon in SingleTextureIcons)
|
||||
{
|
||||
if (texIcon == null || texIcon.IconTexture == null)
|
||||
continue;
|
||||
|
||||
var image = texIcon.IconTexture.GetBitmap();
|
||||
AddImageOnThread(image, texIcon.IconTexture);
|
||||
}
|
||||
|
@ -132,6 +135,35 @@ namespace Toolbox.Library
|
|||
Thread.Start();
|
||||
}
|
||||
|
||||
public void ReloadTextureIcons(ISingleTextureIconLoader textureIcon, Image image)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
ReloadTextureIcons(textureIcon.IconTexture, image);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ReloadTextureIcons(textureIcon.IconTexture, image);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReloadTextureIcons(TreeNode node, Image image)
|
||||
{
|
||||
if (node.ImageIndex != -1 && node.ImageIndex < this.ImageList.Images.Count)
|
||||
this.ImageList.Images[node.ImageIndex] = image;
|
||||
else
|
||||
{
|
||||
node.ImageIndex = this.ImageList.Images.Count;
|
||||
node.SelectedImageIndex = node.ImageIndex;
|
||||
|
||||
this.ImageList.Images.Add(image);
|
||||
}
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
public void ReloadTextureIcons(ISingleTextureIconLoader textureIcon)
|
||||
{
|
||||
if (Thread != null && Thread.IsAlive)
|
||||
|
|
|
@ -366,6 +366,18 @@ namespace Toolbox.Library.Forms
|
|||
|
||||
public Image BaseImage;
|
||||
|
||||
private void UpdateTreeIcon(TreeNode node, Image image)
|
||||
{
|
||||
if (node is ISingleTextureIconLoader)
|
||||
{
|
||||
ObjectEditor editor = LibraryGUI.GetObjectEditor();
|
||||
if (editor != null) //The editor isn't always in object editor so check
|
||||
{
|
||||
editor.UpdateTextureIcon((ISingleTextureIconLoader)node, image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePictureBox(int ChannelIndex = 0)
|
||||
{
|
||||
if (ActiveTexture == null)
|
||||
|
@ -466,6 +478,9 @@ namespace Toolbox.Library.Forms
|
|||
|
||||
private void PushImage(Image image)
|
||||
{
|
||||
if (image != null)
|
||||
UpdateTreeIcon(ActiveTexture, image);
|
||||
|
||||
if (pictureBoxCustom1.InvokeRequired)
|
||||
{
|
||||
pictureBoxCustom1.Invoke(this.OnDataAcquiredEvent,
|
||||
|
@ -732,6 +747,8 @@ namespace Toolbox.Library.Forms
|
|||
pictureBoxCustom1.Image = image;
|
||||
pictureBoxCustom1.Refresh();
|
||||
|
||||
UpdateTreeIcon(ActiveTexture, image);
|
||||
|
||||
TotalMipCount = ActiveTexture.MipCount - 1;
|
||||
TotalArrayCount = ActiveTexture.ArrayCount - 1;
|
||||
|
||||
|
|
|
@ -105,6 +105,10 @@ namespace Toolbox.Library.Forms
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateTextureIcon(ISingleTextureIconLoader texturIcon, Image image) {
|
||||
ObjectTree.UpdateTextureIcon(texturIcon, image);
|
||||
}
|
||||
|
||||
public void AddIArchiveFile(IFileFormat FileFormat){
|
||||
ObjectTree.AddIArchiveFile(FileFormat);
|
||||
}
|
||||
|
|
|
@ -249,6 +249,10 @@ namespace Toolbox.Library.Forms
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateTextureIcon(ISingleTextureIconLoader texturIcon, Image image) {
|
||||
treeViewCustom1.ReloadTextureIcons(texturIcon, image);
|
||||
}
|
||||
|
||||
public List<Control> GetEditors()
|
||||
{
|
||||
List<Control> controls = new List<Control>();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue