mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 14:30:26 +00:00
Root bone name adjustments and adjust csv settings
This commit is contained in:
parent
eab5c3ee55
commit
f6a21ee01f
6 changed files with 34 additions and 7 deletions
Binary file not shown.
|
@ -109,6 +109,7 @@ namespace FirstPlugin
|
|||
public byte[] DecompressBlock()
|
||||
{
|
||||
byte[] data = GetBlock();
|
||||
return data;
|
||||
Console.WriteLine("DATA " + data.Length);
|
||||
|
||||
var reader = new FileReader(data);
|
||||
|
@ -125,7 +126,7 @@ namespace FirstPlugin
|
|||
var comp = new STLibraryCompression.MTA_CUSTOM();
|
||||
return comp.Decompress(data, decompSize);
|
||||
}
|
||||
else if (compType == 0x30)
|
||||
else if (compType == 0x20)
|
||||
{
|
||||
uint decompSize = reader.ReadUInt32();
|
||||
uint compSize = (uint)reader.BaseStream.Length - 14;
|
||||
|
@ -136,6 +137,17 @@ namespace FirstPlugin
|
|||
|
||||
data = STLibraryCompression.ZLIB.Decompress(filedata);
|
||||
}
|
||||
else if (compType == 0x30)
|
||||
{
|
||||
uint decompSize = reader.ReadUInt32();
|
||||
uint compSize = (uint)reader.BaseStream.Length - 14;
|
||||
|
||||
byte[] filedata = reader.getSection(14, (int)compSize);
|
||||
reader.Close();
|
||||
reader.Dispose();
|
||||
|
||||
data = STLibraryCompression.GZIP.Decompress(filedata);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -599,6 +599,9 @@ namespace Bfres.Structs
|
|||
//Function addes shapes, vertices and meshes
|
||||
public void AddOjects(string FileName, ResFile resFileNX, ResU.ResFile resFileU, bool Replace = true)
|
||||
{
|
||||
//If using original attributes, this to look them up
|
||||
Dictionary<string, List<FSHP.VertexAttribute>> AttributeMatcher = new Dictionary<string, List<FSHP.VertexAttribute>>();
|
||||
|
||||
bool IsWiiU = (resFileU != null);
|
||||
|
||||
int MatStartIndex = materials.Count;
|
||||
|
@ -704,6 +707,17 @@ namespace Bfres.Structs
|
|||
//Match the skin count setting if names match
|
||||
//Only one match should be found as shapes can't have duped names
|
||||
csvModel.objects[i].VertexSkinCount = ((FSHP)Matches[0]).VertexSkinCount;
|
||||
|
||||
if (csvsettings.MapOriginalMaterials)
|
||||
csvModel.objects[i].MaterialIndex = ((FSHP)Matches[0]).MaterialIndex;
|
||||
|
||||
if (csvsettings.LimitSkinCount)
|
||||
csvModel.objects[i].VertexSkinCount = ((FSHP)Matches[0]).VertexSkinCount;
|
||||
|
||||
if (csvsettings.UseOriginalAttributes)
|
||||
{
|
||||
AttributeMatcher.Add(csvModel.objects[i].ObjectName, Matches[0].vertexAttributes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -747,7 +761,12 @@ namespace Bfres.Structs
|
|||
shape.VertexBufferIndex = shapes.Count;
|
||||
shape.vertices = obj.vertices;
|
||||
shape.MaterialIndex = 0;
|
||||
|
||||
if (AttributeMatcher.ContainsKey(obj.ObjectName))
|
||||
shape.vertexAttributes = csvsettings.CreateNewAttributes(AttributeMatcher[obj.ObjectName]);
|
||||
else
|
||||
shape.vertexAttributes = csvsettings.CreateNewAttributes();
|
||||
|
||||
shape.BoneIndex = 0;
|
||||
shape.Text = obj.ObjectName;
|
||||
shape.lodMeshes = obj.lodMeshes;
|
||||
|
@ -852,9 +871,6 @@ namespace Bfres.Structs
|
|||
settings.UpdateTexturePlaceholderSetting(HasTextures);
|
||||
}
|
||||
|
||||
//If using original attributes, this to look them up
|
||||
Dictionary<string, List<FSHP.VertexAttribute>> AttributeMatcher = new Dictionary<string, List<FSHP.VertexAttribute>>();
|
||||
|
||||
settings.SetModelAttributes(ImportedObjects[0]);
|
||||
if (settings.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -434,8 +434,7 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
bool IsBone = boneNames.Contains(Name) && !boneNames.Contains(ParentArmatureName) ||
|
||||
Name.Contains("Skl_Root") || Name.Contains("nw4f_root") ||
|
||||
Name.Contains("skl_root") || Name.Contains("_root") ||
|
||||
Name.Contains("skeleton_root");
|
||||
Name.Contains("skl_root") || Name.Contains("_root");
|
||||
|
||||
short SmoothIndex = 0;
|
||||
short RigidIndex = -1;
|
||||
|
|
Loading…
Reference in a new issue