From 25e1db29bf5ae625388d85ef18829bf1a687661f Mon Sep 17 00:00:00 2001 From: Luis Gutierrez Date: Mon, 28 Aug 2023 20:29:55 -0700 Subject: [PATCH] Fix for IQM skeletons with multiple root bones (#218) Fix case where skeleton contains multiple root bones with no parent bone --- iqm/iqm.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/iqm/iqm.cpp b/iqm/iqm.cpp index d59d71844..195cb6727 100644 --- a/iqm/iqm.cpp +++ b/iqm/iqm.cpp @@ -4577,12 +4577,14 @@ void calcanimdata() pose &j = poses.add(); j.name = p.bonename; j.parent = -1; - loopk(p.remap) - { - if (!strcmp(poses[k].name, fr.pose[p.boneparent].bonename)) + if(p.boneparent >= 0) { + loopk(p.remap) { - j.parent = k; - break; + if (!strcmp(poses[k].name, fr.pose[p.boneparent].bonename)) + { + j.parent = k; + break; + } } } loopk(10) { j.offset[k] = 1e16f; j.scale[k] = -1e16f; }