Update single texture based image icons
This commit is contained in:
parent
b445590961
commit
de20881676
@ -125,6 +125,9 @@ namespace Toolbox.Library
|
|||||||
|
|
||||||
foreach (var texIcon in SingleTextureIcons)
|
foreach (var texIcon in SingleTextureIcons)
|
||||||
{
|
{
|
||||||
|
if (texIcon == null || texIcon.IconTexture == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
var image = texIcon.IconTexture.GetBitmap();
|
var image = texIcon.IconTexture.GetBitmap();
|
||||||
AddImageOnThread(image, texIcon.IconTexture);
|
AddImageOnThread(image, texIcon.IconTexture);
|
||||||
}
|
}
|
||||||
@ -132,6 +135,35 @@ namespace Toolbox.Library
|
|||||||
Thread.Start();
|
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)
|
public void ReloadTextureIcons(ISingleTextureIconLoader textureIcon)
|
||||||
{
|
{
|
||||||
if (Thread != null && Thread.IsAlive)
|
if (Thread != null && Thread.IsAlive)
|
||||||
|
@ -366,6 +366,18 @@ namespace Toolbox.Library.Forms
|
|||||||
|
|
||||||
public Image BaseImage;
|
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)
|
private void UpdatePictureBox(int ChannelIndex = 0)
|
||||||
{
|
{
|
||||||
if (ActiveTexture == null)
|
if (ActiveTexture == null)
|
||||||
@ -466,6 +478,9 @@ namespace Toolbox.Library.Forms
|
|||||||
|
|
||||||
private void PushImage(Image image)
|
private void PushImage(Image image)
|
||||||
{
|
{
|
||||||
|
if (image != null)
|
||||||
|
UpdateTreeIcon(ActiveTexture, image);
|
||||||
|
|
||||||
if (pictureBoxCustom1.InvokeRequired)
|
if (pictureBoxCustom1.InvokeRequired)
|
||||||
{
|
{
|
||||||
pictureBoxCustom1.Invoke(this.OnDataAcquiredEvent,
|
pictureBoxCustom1.Invoke(this.OnDataAcquiredEvent,
|
||||||
@ -732,6 +747,8 @@ namespace Toolbox.Library.Forms
|
|||||||
pictureBoxCustom1.Image = image;
|
pictureBoxCustom1.Image = image;
|
||||||
pictureBoxCustom1.Refresh();
|
pictureBoxCustom1.Refresh();
|
||||||
|
|
||||||
|
UpdateTreeIcon(ActiveTexture, image);
|
||||||
|
|
||||||
TotalMipCount = ActiveTexture.MipCount - 1;
|
TotalMipCount = ActiveTexture.MipCount - 1;
|
||||||
TotalArrayCount = ActiveTexture.ArrayCount - 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){
|
public void AddIArchiveFile(IFileFormat FileFormat){
|
||||||
ObjectTree.AddIArchiveFile(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()
|
public List<Control> GetEditors()
|
||||||
{
|
{
|
||||||
List<Control> controls = new List<Control>();
|
List<Control> controls = new List<Control>();
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user