Page 1 of 1

[2.1] Bug OgreSkeletonInstance setSceneNodeAsParentOfBone

Posted: Mon Nov 26, 2018 4:30 pm
by Gdlk
Hello!

I think it could be a bug in the setSceneNodeAsParentOfBone method:
- First call setSceneNodeAsParentOfBone with a nodeParent to be set to the bone
- Then call again, but use nullptr like nodeParent, so we can remove the attachment

The first if (line 340) will go in (because the bone exists in the mCustomParentSceneNodes), so we would call nodeParent->_detachBone although the nodeParent is nullptr =(. Also, when call the second time using a not null nodeParent, it crash when try to detach the bone.

I think the right code must be this:

Code: Select all

if( itor != end && itor->boneChild == bone )
{
    itor->sceneNodeParent->_detachBone( this, itor->boneChild );
    efficientVectorRemove( mCustomParentSceneNodes, itor );
}
Best regards!

Re: [2.1] Bug OgreSkeletonInstance setSceneNodeAsParentOfBone

Posted: Mon Nov 26, 2018 6:20 pm
by dark_sylinc
Indeed, your fix is what the code should be doing. Fix pushed.

Thanks!