From c380ac5a1fc341b7e385ddbc4c38c0bc83dda8a8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 8 Jan 2009 14:52:11 +0000 Subject: [PATCH] From Cedric Pinson, "Here the updated osganimationskinning.cpp that works as before" --- .../osganimationskinning/osganimationskinning.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/osganimationskinning/osganimationskinning.cpp b/examples/osganimationskinning/osganimationskinning.cpp index 974309182..4cf906254 100644 --- a/examples/osganimationskinning/osganimationskinning.cpp +++ b/examples/osganimationskinning/osganimationskinning.cpp @@ -162,20 +162,24 @@ int main (int argc, char* argv[]) viewer.setCameraManipulator(new osgGA::TrackballManipulator()); osg::ref_ptr skelroot = new osgAnimation::Skeleton; + skelroot->setDefaultUpdateCallback(); osg::ref_ptr root = new osgAnimation::Bone; { root->setBindMatrixInBoneSpace(osg::Matrix::identity()); root->setBindMatrixInBoneSpace(osg::Matrix::translate(-1,0,0)); root->setName("root"); + root->setDefaultUpdateCallback(); } osg::ref_ptr right0 = new osgAnimation::Bone; right0->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0)); right0->setName("right0"); + right0->setDefaultUpdateCallback("right0"); osg::ref_ptr right1 = new osgAnimation::Bone; right1->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0)); right1->setName("right1"); + right1->setDefaultUpdateCallback("right1"); root->addChild(right0.get()); right0->addChild(right1.get()); @@ -196,11 +200,9 @@ int main (int argc, char* argv[]) osgAnimation::QuatSphericalLinearSampler* sampler = new osgAnimation::QuatSphericalLinearSampler; sampler->setKeyframeContainer(keys0); osgAnimation::AnimationUpdateCallback* cb = dynamic_cast(right0->getUpdateCallback()); - cb->setName("right0"); osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler); channel->setName("quaternion"); channel->setTargetName("right0"); - //cb->link(channel); anim->addChannel(channel); } @@ -215,10 +217,8 @@ int main (int argc, char* argv[]) sampler->setKeyframeContainer(keys1); osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler); osgAnimation::AnimationUpdateCallback* cb = dynamic_cast(right1->getUpdateCallback()); - cb->setName("right1"); channel->setName("quaternion"); channel->setTargetName("right1"); - //cb->link(channel); anim->addChannel(channel); } manager->registerAnimation(anim); @@ -237,10 +237,10 @@ int main (int argc, char* argv[]) osg::MatrixTransform* trueroot = new osg::MatrixTransform; trueroot->setMatrix(osg::Matrix(root->getMatrixInBoneSpace().ptr())); trueroot->addChild(createAxis()); + trueroot->addChild(skelroot); trueroot->setDataVariance(osg::Object::DYNAMIC); -// rootTransform->addChild(scene.get()); + rootTransform->addChild(trueroot); scene->addChild(rootTransform); -// manager->addChild(skelroot.get()); osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0); osg::Geode* geode = new osg::Geode;