1
0
mirror of synced 2024-09-24 19:48:21 +02:00

Fix dae exporting with only indices and no weights. Fix sharc crashes.

This commit is contained in:
KillzXGaming 2019-04-09 17:24:39 -04:00
parent 7fe264136c
commit bab9ce9022
14 changed files with 47 additions and 44 deletions

Binary file not shown.

View File

@ -207,7 +207,7 @@ namespace FirstPlugin
variationSymbolData.Read(reader); variationSymbolData.Read(reader);
variationSymbolDataFull.Read(reader); variationSymbolDataFull.Read(reader);
UniformBlocks.Read(reader, header.Version); UniformBlocks.Read(reader, header.Version, true);
if (header.Version <= 12) if (header.Version <= 12)
{ {

View File

@ -313,7 +313,6 @@ namespace FirstPlugin
public class VariationMacro public class VariationMacro
{ {
public string Name { get; set; } public string Name { get; set; }
public string[] Values { get; set; }
public string Value { get; set; } public string Value { get; set; }
public void Read(FileReader reader, uint Version) public void Read(FileReader reader, uint Version)
@ -321,38 +320,16 @@ namespace FirstPlugin
var pos = reader.Position; var pos = reader.Position;
uint SectionSize = reader.ReadUInt32(); uint SectionSize = reader.ReadUInt32();
if (Version >= 13) uint NameLength = reader.ReadUInt32();
{ uint ValueLength = reader.ReadUInt32();
uint NameLength = reader.ReadUInt32(); Name = reader.ReadString((int)NameLength);
uint ValueCount = reader.ReadUInt32(); Value = reader.ReadString((int)ValueLength);
Name = reader.ReadString((int)NameLength);
Value = reader.ReadString((int)ValueCount);
Values = new string[0];
Console.WriteLine("VariationMacro ------------------"); Console.WriteLine("VariationMacro ------------------");
Console.WriteLine(Name); Console.WriteLine(Name);
Console.WriteLine(Value); Console.WriteLine(Value);
Console.WriteLine("------------------"); Console.WriteLine("------------------");
}
else
{
uint NameLength = reader.ReadUInt32();
uint ValueCount = reader.ReadUInt32();
uint Unk = reader.ReadUInt32();
Name = reader.ReadString((int)NameLength);
Values = reader.ReadStrings((int)ValueCount, Syroot.BinaryData.BinaryStringFormat.ZeroTerminated);
foreach (string vl in Values)
Value += $" {vl}";
Console.WriteLine("VariationMacro ------------------");
Console.WriteLine(Name);
Console.WriteLine(Value);
Console.WriteLine("------------------");
}
reader.Seek(pos + SectionSize, System.IO.SeekOrigin.Begin); reader.Seek(pos + SectionSize, System.IO.SeekOrigin.Begin);
@ -407,18 +384,22 @@ namespace FirstPlugin
public class ShaderSymbolData public class ShaderSymbolData
{ {
public List<ShaderSymbol> symbols = new List<ShaderSymbol>(); public List<ShaderSymbol> symbols = new List<ShaderSymbol>();
public void Read(FileReader reader, uint Version = 12) public void Read(FileReader reader, uint Version = 12, bool SkipReading = false)
{ {
var SectionPos = reader.Position; var SectionPos = reader.Position;
uint SectionSize = reader.ReadUInt32(); uint SectionSize = reader.ReadUInt32();
uint SectionCount = reader.ReadUInt32(); uint SectionCount = reader.ReadUInt32();
for (int i = 0; i < SectionCount; i++) if (!SkipReading)
{ {
ShaderSymbol symbol = new ShaderSymbol(); for (int i = 0; i < SectionCount; i++)
symbol.Read(reader, Version); {
symbols.Add(symbol); ShaderSymbol symbol = new ShaderSymbol();
symbol.Read(reader, Version);
symbols.Add(symbol);
}
} }
reader.Seek(SectionPos + SectionSize, System.IO.SeekOrigin.Begin); reader.Seek(SectionPos + SectionSize, System.IO.SeekOrigin.Begin);
} }
} }

View File

@ -110,16 +110,16 @@ namespace FirstPlugin.Forms
foreach (var kcl in scene.KclObjects) foreach (var kcl in scene.KclObjects)
{ {
viewport.AddDrawable(kcl.Renderer); // viewport.AddDrawable(kcl.Renderer);
treeView1.Nodes.Add(kcl); // treeView1.Nodes.Add(kcl);
kcl.Checked = true; // kcl.Checked = true;
} }
foreach (var bfres in scene.BfresObjects) foreach (var bfres in scene.BfresObjects)
{ {
viewport.AddDrawable(bfres.BFRESRender); // viewport.AddDrawable(bfres.BFRESRender);
treeView1.Nodes.Add(bfres); // treeView1.Nodes.Add(bfres);
bfres.Checked = true; // bfres.Checked = true;
} }
IsLoaded = true; IsLoaded = true;
@ -190,16 +190,38 @@ namespace FirstPlugin.Forms
private void viewIntroCameraToolStripMenuItem_Click(object sender, EventArgs e) private void viewIntroCameraToolStripMenuItem_Click(object sender, EventArgs e)
{ {
//Sort list by camera number/id
scene.IntroCameras.Sort((x, y) => x.CameraNum.CompareTo(y.CameraNum));
foreach (var camera in scene.IntroCameras) foreach (var camera in scene.IntroCameras)
{ {
var pathMove = scene.Paths[camera.Camera_Path]; var pathMove = scene.Paths[camera.Camera_Path];
var pathLookAt = scene.Paths[camera.Camera_AtPath]; var pathLookAt = scene.Paths[camera.Camera_AtPath];
//The time elapsed for each point
int PathTime = camera.CameraTime / pathMove.PathPoints.Count;
//Go through each point
for (int p = 0; p < pathMove.PathPoints.Count; p++) for (int p = 0; p < pathMove.PathPoints.Count; p++)
{ {
//If lookat path is higher than the move path, break
if (pathLookAt.PathPoints.Count >= p)
break;
//Set our points
var pathMovePoint = pathMove.PathPoints[p]; var pathMovePoint = pathMove.PathPoints[p];
var pathLookAtPoint = pathLookAt.PathPoints[p]; var pathLookAtPoint = pathLookAt.PathPoints[p];
for (int frame = 0; frame < PathTime; frame++)
{
if (viewport.GL_ControlModern != null)
{
viewport.GL_ControlModern.CameraEye = pathLookAtPoint.Translate;
viewport.GL_ControlModern.CameraTarget = pathMovePoint.Translate;
viewport.UpdateViewport();
}
}
} }
} }
} }

View File

@ -110,7 +110,7 @@ namespace Switch_Toolbox.Library
else else
mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1)); mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1));
} }
else if ( v.boneWeights[j] > 0) else if (v.boneWeights.Count == 0 || v.boneWeights[j] > 0)
mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1)); mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1));
} }
} }

Binary file not shown.

Binary file not shown.