mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2025-02-16 22:08:26 +00:00
DAE : Add progressbar and dialog confirmation for new exporter.
This commit is contained in:
parent
c3b1dd845a
commit
181afe6b02
1 changed files with 28 additions and 2 deletions
|
@ -60,6 +60,13 @@ namespace Toolbox.Library
|
||||||
if (Materials == null)
|
if (Materials == null)
|
||||||
Materials = new List<STGenericMaterial>();
|
Materials = new List<STGenericMaterial>();
|
||||||
|
|
||||||
|
STProgressBar progressBar = new STProgressBar();
|
||||||
|
progressBar.Task = "Exporting Model...";
|
||||||
|
progressBar.Value = 0;
|
||||||
|
progressBar.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
progressBar.Show();
|
||||||
|
progressBar.Refresh();
|
||||||
|
|
||||||
if (settings.UseOldExporter)
|
if (settings.UseOldExporter)
|
||||||
{
|
{
|
||||||
AssimpSaver saver = new AssimpSaver();
|
AssimpSaver saver = new AssimpSaver();
|
||||||
|
@ -84,6 +91,11 @@ namespace Toolbox.Library
|
||||||
textureNames.Add(Textures[i].Text);
|
textureNames.Add(Textures[i].Text);
|
||||||
|
|
||||||
if (settings.ExportTextures) {
|
if (settings.ExportTextures) {
|
||||||
|
|
||||||
|
progressBar.Task = $"Exporting Texture {Textures[i].Text}";
|
||||||
|
progressBar.Value = ((i * 100) / Textures.Count);
|
||||||
|
progressBar.Refresh();
|
||||||
|
|
||||||
var bitmap = Textures[i].GetBitmap();
|
var bitmap = Textures[i].GetBitmap();
|
||||||
|
|
||||||
string textureName = Textures[i].Text;
|
string textureName = Textures[i].Text;
|
||||||
|
@ -188,9 +200,15 @@ namespace Toolbox.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int meshIndex = 0;
|
||||||
|
|
||||||
writer.StartLibraryGeometries();
|
writer.StartLibraryGeometries();
|
||||||
foreach (var mesh in Meshes)
|
foreach (var mesh in Meshes)
|
||||||
{
|
{
|
||||||
|
progressBar.Task = $"Exporting Mesh {mesh.Text}";
|
||||||
|
progressBar.Value = ((meshIndex++ * 100) / Meshes.Count);
|
||||||
|
progressBar.Refresh();
|
||||||
|
|
||||||
int[] IndexTable = null;
|
int[] IndexTable = null;
|
||||||
if (NodeArray != null)
|
if (NodeArray != null)
|
||||||
IndexTable = NodeArray.ToArray();
|
IndexTable = NodeArray.ToArray();
|
||||||
|
@ -294,10 +312,14 @@ namespace Toolbox.Library
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int index = -1;
|
||||||
if (IndexTable != null)
|
if (IndexTable != null)
|
||||||
bIndices.Add((int)IndexTable[vertex.boneIds[b]]);
|
index = (int)IndexTable[vertex.boneIds[b]];
|
||||||
else
|
else
|
||||||
bIndices.Add((int)vertex.boneIds[b]);
|
index = (int)vertex.boneIds[b];
|
||||||
|
|
||||||
|
if (index != -1 && index < skeleton?.bones.Count)
|
||||||
|
bIndices.Add(index);
|
||||||
|
|
||||||
//Some models may only use indices (single bind, rigid skin)
|
//Some models may only use indices (single bind, rigid skin)
|
||||||
if (vertex.boneWeights.Count > b)
|
if (vertex.boneWeights.Count > b)
|
||||||
|
@ -380,6 +402,10 @@ namespace Toolbox.Library
|
||||||
}
|
}
|
||||||
writer.EndGeometrySection();
|
writer.EndGeometrySection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progressBar?.Close();
|
||||||
|
|
||||||
|
System.Windows.Forms.MessageBox.Show($"Exported {FileName} Successfuly!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue