Fix dupe name checking on bones and shapes
This commit is contained in:
parent
72579451b8
commit
e160f4cdc1
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -898,6 +898,9 @@ namespace Bfres.Structs
|
||||
|
||||
|
||||
FSHP shape = new FSHP();
|
||||
List<string> keyList = shapes.Select(o => o.Text).ToList();
|
||||
shape.Text = Utils.RenameDuplicateString(keyList, obj.Text);
|
||||
|
||||
Nodes["FshpFolder"].Nodes.Add(shape);
|
||||
shapes.Add(shape);
|
||||
|
||||
@ -988,17 +991,6 @@ namespace Bfres.Structs
|
||||
}
|
||||
}
|
||||
|
||||
progressBar.Task = $"Checking name duplicates.";
|
||||
progressBar.Value = 99;
|
||||
progressBar.Refresh();
|
||||
|
||||
//now rename dupes
|
||||
foreach (var shape in shapes)
|
||||
{
|
||||
List<string> keyList = shapes.Select(o => o.Text).ToList();
|
||||
shape.Text = Utils.RenameDuplicateString(keyList, shape.Text);
|
||||
}
|
||||
|
||||
progressBar.Value = 100;
|
||||
progressBar.Close();
|
||||
|
||||
|
@ -577,12 +577,10 @@ namespace FirstPlugin
|
||||
{
|
||||
genericBone.BillboardIndex = -1;
|
||||
|
||||
STConsole.WriteLine($"Applying bone " + genericBone.Text);
|
||||
|
||||
//Clone a generic bone with the generic data
|
||||
BfresBone bn = new BfresBone(fskl);
|
||||
bn.Text = genericBone.Text;
|
||||
bn.CloneBaseInstance(genericBone);
|
||||
bn.Text = genericBone.Text;
|
||||
|
||||
//Set the bfres bone data
|
||||
if (bn.Bone == null)
|
||||
@ -594,22 +592,18 @@ namespace FirstPlugin
|
||||
|
||||
fskl.node.Skeleton.InverseModelMatrices.Add(Syroot.Maths.Matrix3x4.Zero);
|
||||
|
||||
fskl.bones.Add(bn);
|
||||
}
|
||||
|
||||
foreach (BfresBone wrapper in fskl.bones)
|
||||
{
|
||||
//Check duplicated names
|
||||
List<string> names = fskl.bones.Select(o => o.Text).ToList();
|
||||
wrapper.Text = Utils.RenameDuplicateString(names, wrapper.Text);
|
||||
bn.Text = Utils.RenameDuplicateString(names, bn.Text);
|
||||
bn.Bone.Name = bn.Text;
|
||||
|
||||
wrapper.Bone.Name = wrapper.Text;
|
||||
fskl.node.Skeleton.Bones.Add(wrapper.Bone);
|
||||
fskl.bones.Add(bn);
|
||||
fskl.node.Skeleton.Bones.Add(bn.Bone);
|
||||
|
||||
//Add bones to tree
|
||||
if (wrapper.Parent == null)
|
||||
if (bn.Parent == null)
|
||||
{
|
||||
fskl.node.Nodes.Add(wrapper);
|
||||
fskl.node.Nodes.Add(bn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -933,27 +933,24 @@ namespace FirstPlugin
|
||||
if (bn.SmoothMatrixIndex != short.MaxValue)
|
||||
fskl.node.SkeletonU.MatrixToBoneList.Add(SmoothIndex++);
|
||||
|
||||
fskl.node.SkeletonU.InverseModelMatrices.Add(Syroot.Maths.Matrix3x4.Zero);
|
||||
|
||||
fskl.bones.Add(bn);
|
||||
}
|
||||
|
||||
foreach (BfresBone wrapper in fskl.bones)
|
||||
{
|
||||
//Check duplicated names
|
||||
List<string> names = fskl.bones.Select(o => o.Text).ToList();
|
||||
wrapper.Text = Utils.RenameDuplicateString(names, wrapper.Text);
|
||||
bn.Text = Utils.RenameDuplicateString(names, bn.Text);
|
||||
|
||||
wrapper.BoneU.Name = wrapper.Text;
|
||||
fskl.node.SkeletonU.Bones.Add(wrapper.Text, wrapper.BoneU);
|
||||
fskl.node.SkeletonU.InverseModelMatrices.Add(Syroot.Maths.Matrix3x4.Zero);
|
||||
fskl.bones.Add(bn);
|
||||
|
||||
bn.BoneU.Name = bn.Text;
|
||||
fskl.node.SkeletonU.Bones.Add(bn.Text, bn.BoneU);
|
||||
|
||||
//Add bones to tree
|
||||
if (wrapper.Parent == null)
|
||||
if (bn.Parent == null)
|
||||
{
|
||||
fskl.node.Nodes.Add(wrapper);
|
||||
fskl.node.Nodes.Add(bn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fskl.update();
|
||||
fskl.reset();
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user