diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 7c8e43b0..fbefd809 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index da230c6e..ee208e19 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 177c7594..cdf68b26 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs index a85ec651..e0589627 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs @@ -611,6 +611,9 @@ namespace Bfres.Structs Cursor.Current = Cursors.WaitCursor; + bool ForceSkinInfluence = false; + int ForceSkinInfluenceMax = 4; + foreach (STGenericObject obj in csvModel.objects) { FSHP shape = new FSHP(); @@ -625,7 +628,7 @@ namespace Bfres.Structs shape.Text = obj.ObjectName; shape.lodMeshes = obj.lodMeshes; shape.CreateNewBoundingBoxes(); - shape.CreateBoneList(obj, this); + shape.CreateBoneList(obj, this, ForceSkinInfluence, ForceSkinInfluenceMax); shape.CreateIndexList(obj, this); shape.ApplyImportSettings(csvsettings, GetMaterial(shape.MaterialIndex)); shape.BoneIndices = shape.GetIndices(Skeleton); @@ -925,6 +928,10 @@ namespace Bfres.Structs Console.WriteLine("Processing Data. Object count " + assimp.objects.Count); + bool ForceSkinInfluence = true; + int ForceSkinInfluenceMax = 4; + + int curShp = 0; foreach (STGenericObject obj in assimp.objects) { @@ -970,7 +977,7 @@ namespace Bfres.Structs progressBar.Task = $"Creating Bone list. Mesh: {obj.ObjectName}"; progressBar.Refresh(); - shape.CreateBoneList(obj, this); + shape.CreateBoneList(obj, this, ForceSkinInfluence, ForceSkinInfluenceMax); progressBar.Task = $"Creating Index list. Mesh: {obj.ObjectName}"; progressBar.Refresh(); diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FSHP.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FSHP.cs index bedfab00..a429381d 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FSHP.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FSHP.cs @@ -707,7 +707,7 @@ namespace Bfres.Structs Cursor.Current = Cursors.WaitCursor; VertexBufferIndex = obj.VertexBufferIndex; vertices = obj.vertices; - CreateBoneList(obj, (FMDL)Parent.Parent); + CreateBoneList(obj, (FMDL)Parent.Parent, false); CreateIndexList(obj, (FMDL)Parent.Parent); VertexSkinCount = obj.GetMaxSkinInfluenceCount(); vertexAttributes = settings.CreateNewAttributes(); @@ -756,7 +756,7 @@ namespace Bfres.Structs } } } - public void CreateBoneList(STGenericObject ob, FMDL mdl) + public void CreateBoneList(STGenericObject ob, FMDL mdl, bool ForceSkinCount, int ForcedSkinAmount = 4) { if (mdl.Skeleton.Node_Array == null) mdl.Skeleton.Node_Array = new int[0]; @@ -774,6 +774,19 @@ namespace Bfres.Structs List BonesNotMatched = new List(); + if (ForceSkinCount && !ob.HasIndices) + { + var attributeIndex = new FSHP.VertexAttribute(); + attributeIndex.Format = ResGFX.AttribFormat.Format_8_8_8_8_UInt; + attributeIndex.Name = "_i0"; + vertexAttributes.Add(attributeIndex); + + var attributeWeight = new FSHP.VertexAttribute(); + attributeWeight.Format = ResGFX.AttribFormat.Format_32_32_32_32_Single; + attributeWeight.Name = "_w0"; + vertexAttributes.Add(attributeWeight); + } + int vtxIndex = 0; foreach (Vertex v in ob.vertices) { @@ -822,6 +835,18 @@ namespace Bfres.Structs } } + if (ForceSkinCount) + { + for (int i = 0; i < ForcedSkinAmount; i++) + { + if (v.boneIds.Count < ForcedSkinAmount) + { + v.boneIds.Add(0); + v.boneWeights.Add(1); + } + } + } + vtxIndex++; } diff --git a/Switch_FileFormatsMain/GUI/TextureUI/Importers/BNTX/BinaryTextureImporterList.cs b/Switch_FileFormatsMain/GUI/TextureUI/Importers/BNTX/BinaryTextureImporterList.cs index bc95899f..2c90dad3 100644 --- a/Switch_FileFormatsMain/GUI/TextureUI/Importers/BNTX/BinaryTextureImporterList.cs +++ b/Switch_FileFormatsMain/GUI/TextureUI/Importers/BNTX/BinaryTextureImporterList.cs @@ -85,7 +85,7 @@ namespace FirstPlugin - compressionModeCB.SelectedIndex = 1; + compressionModeCB.SelectedIndex = 0; compressionModeCB.Enabled = false; diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 27bed619..469e0760 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 38f0bc91..58f1507c 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ