Fix sorting bone weights with duplicate indices

This commit is contained in:
KillzXGaming 2019-07-18 17:50:46 -04:00
parent 4428dd20ef
commit e5b57de5e8
21 changed files with 105 additions and 26 deletions

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public void Load(System.IO.Stream stream)
{

View file

@ -23,7 +23,11 @@ namespace FirstPlugin
public bool CanReplaceFiles { get; set; } = true;
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool CanSave { get; set; }
public string[] Description { get; set; } = new string[] { "Bevel Engine Archive" };

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
private uint Unknown1;
private uint Version;

View file

@ -93,7 +93,11 @@ namespace FirstPlugin
}
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool CanAddFiles { get; set; } = false;
public bool CanRenameFiles { get; set; } = false;

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public void Load(System.IO.Stream stream)
{

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public void Load(System.IO.Stream stream)
{

View file

@ -48,7 +48,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
private uint Alignment;
public void Load(System.IO.Stream stream)

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public void Load(System.IO.Stream stream)
{

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public void Load(System.IO.Stream stream)
{

View file

@ -46,7 +46,12 @@ namespace FirstPlugin
public List<FileEntry> files = new List<FileEntry>();
public List<INode> nodes = new List<INode>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public IEnumerable<INode> Nodes => nodes;
public string Name

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public bool CanDeleteFiles { get; set; } = true;
public List<SarcEntry> files = new List<SarcEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public SarcData sarcData;
public string SarcHash;

View file

@ -45,7 +45,10 @@ namespace FirstPlugin
}
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files {
get { return files; }
set { }
}
SDFTOC_Header Header;
public SDFTOC_Block2[] block2Array;

View file

@ -39,7 +39,11 @@ namespace FirstPlugin
}
public List<FileInfo> files = new List<FileInfo>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool CanAddFiles { get; set; }
public bool CanRenameFiles { get; set; }

View file

@ -46,8 +46,11 @@ namespace FirstPlugin
}
public List<FileInfo> files = new List<FileInfo>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool CanAddFiles { get; set; } = true;
public bool CanRenameFiles { get; set; } = true;

View file

@ -46,7 +46,12 @@ namespace FirstPlugin
public List<INode> nodes = new List<INode>();
public IEnumerable<ArchiveFileInfo> Files => null;
public IEnumerable<ArchiveFileInfo> Files
{
get { return null; }
set { }
}
public IEnumerable<INode> Nodes => nodes;
public string Name

View file

@ -1041,15 +1041,17 @@ namespace Bfres.Structs
{
int j = 0;
SortedDictionary<int, float> envelopes = new SortedDictionary<int, float>();
List<Tuple<int, float>> envelopes = new List<Tuple<int, float>>();
for (j = 0; j < v.boneIds.Count; j++)
envelopes.Add(v.boneIds[j], v.boneWeights[j]);
envelopes.Add(Tuple.Create(v.boneIds[j], v.boneWeights[j]));
envelopes.Sort((x, y) => y.Item1.CompareTo(x.Item1));
j = 0;
foreach (var envelope in envelopes)
foreach (var envelope in envelopes.OrderBy(x => x.Item1))
{
v.boneIds[j] = envelope.Key;
v.boneWeights[j] = envelope.Value;
v.boneIds[j] = envelope.Item1;
v.boneWeights[j] = envelope.Item2;
j++;
}

View file

@ -36,7 +36,11 @@ namespace FirstPlugin
public bool CanDeleteFiles { get; set; }
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool Identify(System.IO.Stream stream)
{

View file

@ -35,7 +35,11 @@ namespace FirstPlugin
public bool CanDeleteFiles { get; set; }
public List<NSP.FileEntry> files = new List<NSP.FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool Identify(System.IO.Stream stream)
{

View file

@ -35,7 +35,10 @@ namespace FirstPlugin
public bool CanDeleteFiles { get; set; }
public List<NSP.FileEntry> files = new List<NSP.FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files {
get { return Files; }
set { }
}
public bool Identify(System.IO.Stream stream)
{

View file

@ -45,7 +45,11 @@ namespace FirstPlugin
public bool CanDeleteFiles { get; set; }
public List<FileEntry> files = new List<FileEntry>();
public IEnumerable<ArchiveFileInfo> Files => files;
public IEnumerable<ArchiveFileInfo> Files
{
get { return files; }
set { }
}
public bool Identify(System.IO.Stream stream)
{

View file

@ -27,7 +27,7 @@ namespace Toolbox.Library
bool CanReplaceFiles { get; }
bool CanDeleteFiles { get; }
IEnumerable<ArchiveFileInfo> Files { get; }
IEnumerable<ArchiveFileInfo> Files { get; set; }
bool AddFile(ArchiveFileInfo archiveFileInfo);
bool DeleteFile(ArchiveFileInfo archiveFileInfo);
@ -296,6 +296,8 @@ namespace Toolbox.Library
progressBar.Task = "Repacking Files...";
progressBar.Refresh();
(ArchiveFile.Files as List<ArchiveFileInfo>)?.Clear();
for (int i = 0; i < ProccessedFiles.Count; i++)
{
progressBar.Value = (i * 100) / ProccessedFiles.Count;