[2.1] Bug OgreSkeletonInstance setSceneNodeAsParentOfBone

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Gdlk
Halfling
Posts: 53
Joined: Mon Dec 05, 2011 9:43 pm
x 1

[2.1] Bug OgreSkeletonInstance setSceneNodeAsParentOfBone

Post 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!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Bug OgreSkeletonInstance setSceneNodeAsParentOfBone

Post by dark_sylinc »

Indeed, your fix is what the code should be doing. Fix pushed.

Thanks!
Post Reply