xxandyy / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Crash loading 2.68a file with armature generated via rigify #316

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Rig a model using rigify
2. "play" this file in gamekit, see that it works as expected
3. Append all assets in another (new) file.  
4. "play" this file in gamekit, see that it crashes when trying to use a 
garbage root bone transform

What is the expected output? What do you see instead?

file loads

What version of the product are you using? On what operating system?

2.68a blender,  win 7 64bit, svn gamekit

Please provide any additional information below.

I've looked into this.  

In:

void gkBlenderSceneConverter::convert(bool createGroupInstances)

...

while (roots.hasMoreElements())
                    {
                        gkBone* bone = roots.getNext();
                        gkMatrix4 eobmat = gkMathUtils::getFromFloat(obMe->obmat);
                        gkMatrix4 sobmat = gkMathUtils::getFromFloat(obAr->obmat);

                        bone->applyRootTransform(eobmat.inverse() * sobmat);
                    }

                }
            }
        }
    }

    m_logic->resolveLinks();
}

The eobmat matrices in the original armature file all seem to be the indentity 
matrix.  In the appended file the values look like junk and end up making the 
roots m_bind matrix a series of +/- INFINITY values, which then crashes game 
kit in:

void gkSkeletonLoader::recurseBone(Ogre::Skeleton* skel, gkBone* cur, 
Ogre::Bone* par)
{
    GK_ASSERT(cur);

    Ogre::Bone* obone = skel->createBone(cur->getName());
    cur->_setOgreBone(obone);

    if (par != 0)
        par->addChild(obone);

    const gkTransformState& rest = cur->getRest();
    obone->setPosition(rest.loc);
    obone->setOrientation(rest.rot);
    obone->setScale(rest.scl);
    obone->setBindingPose();
    obone->setManuallyControlled(true);

    gkBone::BoneList& bl = cur->getChildren();
    for (UTsize i = 0; i < bl.size(); ++i)
        recurseBone(skel, bl[i], obone);
}

When setting the bones rest position.

I've attached two files. model_girl.blend loads fine, bugtest.blend crashes 
although it *should* have the same content, but must have some differences.

Original issue reported on code.google.com by colin.do...@gmail.com on 18 Aug 2013 at 7:03

Attachments:

GoogleCodeExporter commented 9 years ago
Invalid root bone transform is ignored in latest revision.
but, I don't know the exact reason of a invalid value.

Thanks for repoting.

Original comment by harkon...@gmail.com on 26 Aug 2013 at 7:34