More fixes with wii u bone importing and updating matricies for custom bones
This commit is contained in:
parent
e50666be9e
commit
e3284f0a84
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -164,12 +164,12 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
shape.CopyUVChannel(dialog.SourceIndex, dialog.DestIndex);
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(GetResFileU() != null);
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
shape.CopyUVChannel(dialog.SourceIndex, dialog.DestIndex);
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
|
||||
shape.FlipUvsVertical();
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
|
||||
UpdateVertexData();
|
||||
@ -202,7 +202,7 @@ namespace Bfres.Structs
|
||||
return;
|
||||
}
|
||||
shape.FlipUvsHorizontal();
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
|
||||
UpdateVertexData();
|
||||
@ -232,7 +232,7 @@ namespace Bfres.Structs
|
||||
dlg.Color.B / 255.0f,
|
||||
dlg.Color.A / 255.0f));
|
||||
|
||||
shp.SaveVertexBuffer();
|
||||
shp.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
}
|
||||
UpdateVertexData();
|
||||
@ -243,7 +243,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
shp.CheckVertexColors();
|
||||
shp.SetVertexColor(new OpenTK.Vector4(1, 1, 1, 1));
|
||||
shp.SaveVertexBuffer();
|
||||
shp.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
UpdateVertexData();
|
||||
}
|
||||
@ -256,7 +256,7 @@ namespace Bfres.Structs
|
||||
if (HasNormals)
|
||||
shp.SmoothNormals();
|
||||
|
||||
shp.SaveVertexBuffer();
|
||||
shp.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
@ -270,7 +270,7 @@ namespace Bfres.Structs
|
||||
if (HasNormals)
|
||||
shp.CalculateNormals();
|
||||
|
||||
shp.SaveVertexBuffer();
|
||||
shp.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
@ -341,7 +341,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
|
||||
shp.CalculateTangentBitangent(UseUVLayer2);
|
||||
shp.SaveVertexBuffer();
|
||||
shp.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
|
||||
UpdateVertexData();
|
||||
@ -423,7 +423,7 @@ namespace Bfres.Structs
|
||||
else
|
||||
{
|
||||
foreach (var shape in shapes) {
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(GetResFileU() != null);
|
||||
}
|
||||
UpdateVertexData();
|
||||
}
|
||||
@ -635,7 +635,7 @@ namespace Bfres.Structs
|
||||
|
||||
shape.OptmizeAttributeFormats();
|
||||
shape.SaveShape(IsWiiU);
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(IsWiiU);
|
||||
|
||||
if (IsWiiU)
|
||||
{
|
||||
@ -969,7 +969,7 @@ namespace Bfres.Structs
|
||||
progressBar.Task = $"Saving vertex buffer. Mesh: {obj.ObjectName}";
|
||||
progressBar.Refresh();
|
||||
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(IsWiiU);
|
||||
|
||||
if (IsWiiU)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
SmoothNormals();
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -236,7 +236,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
CalculateNormals();
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -244,7 +244,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FillBitangentSpace(1);
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -252,7 +252,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
FillTangentSpace(1);
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -281,7 +281,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
CopyUVChannel(dialog.SourceIndex, dialog.DestIndex);
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -335,7 +335,7 @@ namespace Bfres.Structs
|
||||
dlg.Color.A / 255.0f));
|
||||
|
||||
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ namespace Bfres.Structs
|
||||
|
||||
SetVertexColor(new Vector4(1,1,1,1));
|
||||
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
}
|
||||
private void Remove(object sender, EventArgs args)
|
||||
@ -551,7 +551,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
|
||||
CalculateTangentBitangent(UseUVLayer2);
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -576,7 +576,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
|
||||
FlipUvsVertical();
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
}
|
||||
public void FlipUvsHorizontal(object sender, EventArgs args)
|
||||
@ -588,7 +588,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
|
||||
FlipUvsHorizontal();
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(GetResFileU() != null);
|
||||
UpdateVertexData();
|
||||
}
|
||||
public void ExportMaterials(object sender, EventArgs args)
|
||||
@ -718,7 +718,7 @@ namespace Bfres.Structs
|
||||
CreateNewBoundingBoxes();
|
||||
|
||||
SaveShape(IsWiiU);
|
||||
SaveVertexBuffer();
|
||||
SaveVertexBuffer(IsWiiU);
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
@ -1062,13 +1062,11 @@ namespace Bfres.Structs
|
||||
output.Z = input.X * matrix.M13 + input.Y * matrix.M23 + input.Z * matrix.M33 + matrix.M43;
|
||||
return output;
|
||||
}
|
||||
public void SaveVertexBuffer()
|
||||
public void SaveVertexBuffer(bool IsWiiU)
|
||||
{
|
||||
if (IsWiiU)
|
||||
{
|
||||
Console.WriteLine("Saving Buffer");
|
||||
BfresWiiU.SaveVertexBuffer(this);
|
||||
Console.WriteLine("Reading Buffer");
|
||||
BfresWiiU.ReadShapesVertices(this, ShapeU, VertexBufferU, GetParentModel());
|
||||
return;
|
||||
}
|
||||
@ -1078,7 +1076,6 @@ namespace Bfres.Structs
|
||||
|
||||
UpdateVertices();
|
||||
|
||||
|
||||
foreach (VertexAttribute att in vertexAttributes)
|
||||
{
|
||||
if (att.Name == "_p0")
|
||||
|
@ -599,8 +599,8 @@ namespace FirstPlugin
|
||||
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);
|
||||
List<string> names = fskl.bones.Select(o => o.Text).ToList();
|
||||
wrapper.Text = Utils.RenameDuplicateString(names, wrapper.Text);
|
||||
|
||||
wrapper.Bone.Name = wrapper.Text;
|
||||
fskl.node.Skeleton.Bones.Add(wrapper.Bone);
|
||||
|
@ -954,6 +954,9 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
fskl.update();
|
||||
fskl.reset();
|
||||
|
||||
fskl.Node_Array = new int[fskl.node.SkeletonU.MatrixToBoneList.Count];
|
||||
int nodes = 0;
|
||||
foreach (ushort node in fskl.node.SkeletonU.MatrixToBoneList)
|
||||
@ -967,10 +970,9 @@ namespace FirstPlugin
|
||||
VertexBuffer buffer = new VertexBuffer();
|
||||
buffer.Attributes = new ResDict<VertexAttrib>();
|
||||
|
||||
Console.WriteLine("Updating Buffer");
|
||||
|
||||
VertexBufferHelper helper = new VertexBufferHelper(buffer, Syroot.BinaryData.ByteOrder.BigEndian);
|
||||
List<VertexBufferHelperAttrib> atrib = new List<VertexBufferHelperAttrib>();
|
||||
|
||||
fshp.UpdateVertices();
|
||||
|
||||
Console.WriteLine("Creating Buffer");
|
||||
|
@ -108,7 +108,7 @@ namespace FirstPlugin
|
||||
if (att.Name == SelectedText)
|
||||
{
|
||||
shape.vertexAttributes.Remove(att);
|
||||
shape.SaveVertexBuffer();
|
||||
shape.SaveVertexBuffer(shape.IsWiiU);
|
||||
if (shape.IsWiiU)
|
||||
BfresWiiU.ReadShapesVertices(shape, shape.ShapeU, shape.VertexBufferU, ActiveFMDL);
|
||||
else
|
||||
|
@ -129,7 +129,7 @@ namespace FirstPlugin.Forms
|
||||
}
|
||||
}
|
||||
|
||||
activeShape.SaveVertexBuffer();
|
||||
activeShape.SaveVertexBuffer(activeShape.GetResFileU() != null);
|
||||
activeShape.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
CurrentAttribute.Name = encodeEditor.activeAttribute.Name;
|
||||
CurrentAttribute.Format = encodeEditor.activeAttribute.Format;
|
||||
activeShape.SaveVertexBuffer();
|
||||
activeShape.SaveVertexBuffer(activeShape.GetResFileU() != null);
|
||||
activeShape.UpdateVertexData();
|
||||
UpdateList();
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user