Load images after lists are loaded to prevent issues
This commit is contained in:
parent
c02e248a7b
commit
97dbb145ad
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -186,10 +186,7 @@ namespace FirstPlugin.Forms
|
||||
listViewCustom1.Items.Clear();
|
||||
listViewCustom1.View = View.SmallIcon;
|
||||
|
||||
Thread Thread = new Thread((ThreadStart)(() =>
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
int ImageIndex = 0;
|
||||
for (int Frame = 0; Frame <= anim.FrameCount; Frame++)
|
||||
{
|
||||
//Constants always show so break after first frame
|
||||
@ -199,9 +196,27 @@ namespace FirstPlugin.Forms
|
||||
var keyFrame = activeSampler.GetKeyFrame(Frame);
|
||||
if (keyFrame.IsKeyed || activeSampler.Constant)
|
||||
{
|
||||
AddKeyFrame((int)keyFrame.Value, Frame);
|
||||
AddKeyFrame((int)keyFrame.Value, Frame, ImageIndex++);
|
||||
}
|
||||
}
|
||||
|
||||
Thread Thread = new Thread((ThreadStart)(() =>
|
||||
{
|
||||
for (int Frame = 0; Frame <= anim.FrameCount; Frame++)
|
||||
{
|
||||
//Constants always show so break after first frame
|
||||
if (activeSampler.Constant && Frame != 0)
|
||||
break;
|
||||
|
||||
var keyFrame = activeSampler.GetKeyFrame(Frame);
|
||||
if (keyFrame.IsKeyed || activeSampler.Constant)
|
||||
{
|
||||
AddKeyFrameImage((int)keyFrame.Value, Frame);
|
||||
}
|
||||
}
|
||||
|
||||
IsLoading = true;
|
||||
|
||||
if (listViewCustom1.InvokeRequired)
|
||||
{
|
||||
listViewCustom1.Invoke((MethodInvoker)delegate
|
||||
@ -228,7 +243,35 @@ namespace FirstPlugin.Forms
|
||||
Thread.Start();
|
||||
}
|
||||
|
||||
private void AddKeyFrame(int Index, int Frame)
|
||||
private void AddKeyFrameImage(int Index, int Frame)
|
||||
{
|
||||
var tex = activeSampler.GetActiveTexture((int)Index);
|
||||
if (tex != null)
|
||||
{
|
||||
Bitmap temp = tex.GetBitmap();
|
||||
|
||||
if (!Images.ContainsKey(Frame))
|
||||
Images.Add(Frame, temp);
|
||||
else
|
||||
{
|
||||
Images.Remove(Frame);
|
||||
Images.Add(Frame, temp);
|
||||
}
|
||||
|
||||
KeyFrames.Add(Frame);
|
||||
|
||||
if (listViewCustom1.InvokeRequired)
|
||||
{
|
||||
listViewCustom1.Invoke((MethodInvoker)delegate {
|
||||
// Running on the UI thread
|
||||
imgList.Images.Add(temp);
|
||||
var dummy = imgList.Handle;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddKeyFrame(int Index, int Frame, int ImageIndex)
|
||||
{
|
||||
if (activeSampler == null)
|
||||
return;
|
||||
@ -236,37 +279,8 @@ namespace FirstPlugin.Forms
|
||||
string TextureKey = activeSampler.GetActiveTextureNameByIndex((int)Index);
|
||||
|
||||
var tex = activeSampler.GetActiveTexture((int)Index);
|
||||
int ImageIndex = imgList.Images.Count;
|
||||
|
||||
if (tex != null)
|
||||
{
|
||||
Bitmap temp = tex.GetBitmap();
|
||||
Images.Add(Frame, temp);
|
||||
KeyFrames.Add(Frame);
|
||||
|
||||
if (listViewCustom1.InvokeRequired)
|
||||
{
|
||||
listViewCustom1.Invoke((MethodInvoker)delegate {
|
||||
// Running on the UI thread
|
||||
listViewCustom1.Items.Add($"{Frame} / {ActiveMaterialAnim.FrameCount} \n" + tex.Text, ImageIndex);
|
||||
imgList.Images.Add(temp);
|
||||
var dummy = imgList.Handle;
|
||||
});
|
||||
}
|
||||
else
|
||||
listViewCustom1.Items.Add($"{Frame} / {ActiveMaterialAnim.FrameCount} \n" + tex.Text, ImageIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (listViewCustom1.InvokeRequired)
|
||||
{
|
||||
listViewCustom1.Invoke((MethodInvoker)delegate {
|
||||
listViewCustom1.Items.Add($"{Frame} / {ActiveMaterialAnim.FrameCount} \n" + TextureKey, ImageIndex);
|
||||
});
|
||||
}
|
||||
else
|
||||
listViewCustom1.Items.Add($"{Frame} / {ActiveMaterialAnim.FrameCount} \n" + TextureKey, ImageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectThumbnailItems()
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user