diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 8a9a278d..2f6d9bb7 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/Switch_FileFormatsMain/FileFormats/Archives/SARC_OLD.cs b/Switch_FileFormatsMain/FileFormats/Archives/SARC_OLD.cs index c9bd2c7b..5ef9a282 100644 --- a/Switch_FileFormatsMain/FileFormats/Archives/SARC_OLD.cs +++ b/Switch_FileFormatsMain/FileFormats/Archives/SARC_OLD.cs @@ -217,7 +217,7 @@ namespace FirstPlugin else { sarcData.Files.Add(SetSarcPath(node, this), - STLibraryCompression.CompressFile(OpenedFiles[node.FullPath], fileFormat)); + OpenedFiles[node.FullPath]); } } } diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 09f9b9a6..37d5a12b 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 f6f7a228..ce686309 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/FileFormats/Assimp/Assimp.cs b/Switch_Toolbox_Library/FileFormats/Assimp/Assimp.cs index 3cc2bdaa..082c83c0 100644 --- a/Switch_Toolbox_Library/FileFormats/Assimp/Assimp.cs +++ b/Switch_Toolbox_Library/FileFormats/Assimp/Assimp.cs @@ -417,6 +417,33 @@ namespace Switch_Toolbox.Library return 0; } } + + private Node GetSklRoot(Node node, List boneNames) + { + string Name = node.Name; + + if (DaeHelper.IDMapToName.ContainsKey(node.Name)) + Name = DaeHelper.IDMapToName[node.Name]; + + string ParentArmatureName = node.Parent != null ? node.Parent.Name : ""; + if (ParentArmatureName != string.Empty && DaeHelper.IDMapToName.ContainsKey(ParentArmatureName)) + ParentArmatureName = DaeHelper.IDMapToName[ParentArmatureName]; + + bool IsBone = boneNames.Contains(Name) && !boneNames.Contains(ParentArmatureName) || + Name.Contains("Skl_Root") || Name.Contains("nw4f_root") || + Name.Contains("skl_root"); + + if (IsBone) + return node; + + if (node.HasChildren) + { + foreach (Node child in node.Children) + GetSklRoot(child, boneNames); + } + return null; + } + private void BuildSkeletonNodes(Node node, List boneNames, STSkeleton skeleton, ref Matrix4x4 rootTransform) { Matrix4x4 trafo = node.Transform; @@ -454,8 +481,16 @@ namespace Switch_Toolbox.Library { if (node.HasChildren) { - foreach (Node child in node.Children) - BuildSkeletonNodes(child, boneNames, skeleton, ref world); + var SklRoot = GetSklRoot(node, boneNames); + if (SklRoot != null) + { + BuildSkeletonNodes(SklRoot, boneNames, skeleton, ref world); + } + else + { + foreach (Node child in node.Children) + BuildSkeletonNodes(child, boneNames, skeleton, ref world); + } } } }