Automatically search for a proper skl root bone if possible
This commit is contained in:
parent
f6a21ee01f
commit
d6e67ac6e6
Binary file not shown.
@ -217,7 +217,7 @@ namespace FirstPlugin
|
||||
else
|
||||
{
|
||||
sarcData.Files.Add(SetSarcPath(node, this),
|
||||
STLibraryCompression.CompressFile(OpenedFiles[node.FullPath], fileFormat));
|
||||
OpenedFiles[node.FullPath]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -417,6 +417,33 @@ namespace Switch_Toolbox.Library
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private Node GetSklRoot(Node node, List<string> 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<string> boneNames, STSkeleton skeleton, ref Matrix4x4 rootTransform)
|
||||
{
|
||||
Matrix4x4 trafo = node.Transform;
|
||||
@ -453,12 +480,20 @@ namespace Switch_Toolbox.Library
|
||||
else
|
||||
{
|
||||
if (node.HasChildren)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Node> tempBoneNodes = new List<Node>();
|
||||
private void CreateByNode(Node node, STSkeleton skeleton, string ParentArmatureName,
|
||||
|
Loading…
Reference in New Issue
Block a user