Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[MeshSetPlugin] Composite Part Export #178

Merged
merged 1 commit into from
Oct 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ public void ExportFBX(dynamic meshAsset, string filename, string fbxVersion, str
FbxNode rootNode = FBXCreateSkeleton(scene, meshAsset, skeleton, ref boneNodes);
scene.RootNode.AddChild(rootNode);
}
//else if (meshSets[0].Lods[0].Type == MeshType.MeshType_Composite)
//{
// // composite skeleton has parts defined in mesh
// FrostyTask.Update("Writing composite skeleton");
// FbxNode rootNode = FBXCreateCompositeSkeleton(scene, meshSets[0].Lods[0].PartTransforms, ref boneNodes);
// scene.RootNode.AddChild(rootNode);
//}
else if (meshSets[0].Lods[0].Type == MeshType.MeshType_Composite)
{
// composite skeleton has parts defined in mesh
task.Update("Writing composite skeleton");
FbxNode rootNode = FBXCreateCompositeSkeleton(scene, meshSets[0].Lods[0].PartTransforms, ref boneNodes);
scene.RootNode.AddChild(rootNode);
}

currentProgress++;
foreach (MeshSet meshSet in meshSets)
Expand All @@ -388,24 +388,24 @@ public void ExportFBX(dynamic meshAsset, string filename, string fbxVersion, str
}

// move composite parts
//if (meshSets[0].Type == MeshType.MeshType_Composite)
//{
// MeshSetLod lod = meshSets[0].Lods[0];
// for (int i = 0; i < lod.PartTransforms.Count; i++)
// {
// LinearTransform lt = lod.PartTransforms[i];
// FbxNode node = boneNodes[i];
if (meshSets[0].Type == MeshType.MeshType_Composite)
{
MeshSetLod lod = meshSets[0].Lods[0];
for (int i = 0; i < lod.PartTransforms.Count; i++)
{
LinearTransform lt = lod.PartTransforms[i];
FbxNode node = boneNodes[i];

// Matrix boneMatrix = SharpDXUtils.FromLinearTransform(lt);
Matrix boneMatrix = SharpDXUtils.FromLinearTransform(lt);

// Vector3 scale = boneMatrix.ScaleVector;
// Vector3 translation = boneMatrix.TranslationVector;
// Vector3 euler = SharpDXUtils.ExtractEulerAngles(boneMatrix);
Vector3 scale = boneMatrix.ScaleVector;
Vector3 translation = boneMatrix.TranslationVector;
Vector3 euler = SharpDXUtils.ExtractEulerAngles(boneMatrix);

// node.LclTranslation = new Vector3(translation.X, translation.Y, translation.Z);
// node.LclRotation = new Vector3(euler.X, euler.Y, euler.Z);
// }
//}
node.LclTranslation = new Vector3(translation.X, translation.Y, translation.Z);
node.LclRotation = new Vector3(euler.X, euler.Y, euler.Z);
}
}

using (FbxExporter exporter = new FbxExporter(manager, ""))
{
Expand Down