mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-12 21:31:43 +00:00
fix: only omit default armature if it can be omitted for all lods
This commit is contained in:
committed by
Jan Laupetin
parent
f3859e6952
commit
618592e411
@@ -180,7 +180,7 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HasDefaultArmature(const XModel* model, const unsigned lod)
|
||||
bool HasDefaultArmatureForLod(const XModel* model, const unsigned lod)
|
||||
{
|
||||
if (model->numRootBones != 1 || model->numBones != 1)
|
||||
return false;
|
||||
@@ -212,6 +212,17 @@ namespace
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HasDefaultArmatureForAllLods(const XModel* model)
|
||||
{
|
||||
for (auto lod = 0u; lod < model->numLods; lod++)
|
||||
{
|
||||
if (!HasDefaultArmatureForLod(model, lod))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OmitDefaultArmature(XModelCommon& common)
|
||||
{
|
||||
@@ -557,7 +568,9 @@ namespace
|
||||
AddXModelVertices(out, model, lod);
|
||||
AddXModelFaces(out, model, lod);
|
||||
|
||||
if (!CanOmitDefaultArmature() || !HasDefaultArmature(model, lod))
|
||||
// Keep armature handling consistent across all LODs so dumped GLTF/GLB round-trips
|
||||
// preserve the same bone layout when re-imported.
|
||||
if (!CanOmitDefaultArmature() || !HasDefaultArmatureForAllLods(model))
|
||||
{
|
||||
AddXModelBones(out, context, model);
|
||||
AddXModelVertexBoneWeights(out, model, lod);
|
||||
|
||||
Reference in New Issue
Block a user