Fix bone names on import and some import errors

This commit is contained in:
KillzXGaming 2019-05-06 17:19:07 -04:00
parent 9005b9ee0f
commit 72579451b8
11 changed files with 33 additions and 17 deletions

Binary file not shown.

View file

@ -581,6 +581,7 @@ namespace FirstPlugin
//Clone a generic bone with the generic data
BfresBone bn = new BfresBone(fskl);
bn.Text = genericBone.Text;
bn.CloneBaseInstance(genericBone);
//Set the bfres bone data

View file

@ -943,8 +943,6 @@ namespace FirstPlugin
{
uint Position = (uint)reader.Position;
reader.Seek(880, SeekOrigin.Current);
Color0Array = new ColorData[8];
Color1Array = new ColorData[8];

View file

@ -256,7 +256,7 @@ namespace FirstPlugin
}
}
if (header.IsSPBD)
reader.Seek(pos + 1072, SeekOrigin.Begin);
reader.Seek(pos + 1358, SeekOrigin.Begin);
else
reader.Seek(pos + 1616, SeekOrigin.Begin);
ColorPosition = reader.Position;

View file

@ -130,12 +130,15 @@ namespace Switch_Toolbox.Library
processNode();
Console.WriteLine("Scene object coun " + objects.Count);
if (scene.RootNode != null)
{
var idenity = Matrix4x4.Identity;
BuildSkeletonNodes(scene.RootNode, BoneNames, skeleton, ref idenity);
skeleton.update();
skeleton.reset();
}
var idenity = Matrix4x4.Identity;
BuildSkeletonNodes(scene.RootNode, BoneNames, skeleton, ref idenity);
skeleton.update();
skeleton.reset();
if (scene.HasMaterials)
{
@ -266,29 +269,35 @@ namespace Switch_Toolbox.Library
Matrix4x4 world = trafo * rootTransform;
Matrix4 worldTK = AssimpHelper.TKMatrix(world);
bool IsBone = boneNames.Contains(node.Name) && !boneNames.Contains(node.Parent.Name) ||
node.Name.Contains("Skl_Root") || node.Name.Contains("nw4f_root");
string ParentArmatureName = "";
if (node.Parent != null)
ParentArmatureName = node.Parent.Name;
bool IsBone = boneNames.Contains(node.Name) && !boneNames.Contains(ParentArmatureName) ||
node.Name.Contains("Skl_Root") || node.Name.Contains("nw4f_root");
short SmoothIndex = 0;
short RigidIndex = -1;
//Loop through all the bones. If the parent is not in the bone list, then it's Parent is the root
if (IsBone)
{
Console.WriteLine("ParentArmatureName " + ParentArmatureName);
var idenity = Matrix4x4.Identity;
var Root = node.Parent;
var Root = node;
if (node.Parent != null)
Root = node.Parent;
CreateByNode(node, skeleton, ParentArmatureName, SmoothIndex, RigidIndex, true, ref idenity);
}
else
{
foreach (Node child in node.Children)
BuildSkeletonNodes(child,boneNames, skeleton, ref world);
if (node.HasChildren)
{
foreach (Node child in node.Children)
BuildSkeletonNodes(child, boneNames, skeleton, ref world);
}
}
}

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<UserData>
</UserData>

View file

@ -402,6 +402,9 @@
<Content Include="LZ4.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Presets\UserData.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Projects\Recent\DUMMY.txt" />
<Content Include="Lib\x64\DirectXTexNetImpl.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -418,6 +421,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Presets\Materials\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>