diff --git a/include/osgAnimation/Bone b/include/osgAnimation/Bone index af5f90241..c006f6f23 100644 --- a/include/osgAnimation/Bone +++ b/include/osgAnimation/Bone @@ -93,7 +93,7 @@ namespace osgAnimation class OSGANIMATION_EXPORT UpdateBone : public AnimationUpdateCallback { - public: + protected: osg::ref_ptr _position; osg::ref_ptr _quaternion; osg::ref_ptr _scale; diff --git a/include/osgAnimation/Target b/include/osgAnimation/Target index bbb40df14..85f1d92c1 100644 --- a/include/osgAnimation/Target +++ b/include/osgAnimation/Target @@ -90,7 +90,7 @@ namespace osgAnimation public: TemplateTarget () {} - + TemplateTarget (const osg::Quat& q) { setValue(q); } const osg::Quat& getValue() const { return _target;} void update(float weight, const osg::Quat& val) { diff --git a/src/osgAnimation/Bone.cpp b/src/osgAnimation/Bone.cpp index faf5f7322..ab228172a 100644 --- a/src/osgAnimation/Bone.cpp +++ b/src/osgAnimation/Bone.cpp @@ -17,11 +17,11 @@ #include osgAnimation::Bone::UpdateBone::UpdateBone(const osgAnimation::Bone::UpdateBone& apc,const osg::CopyOp& copyop) : - osgAnimation::AnimationUpdateCallback(apc, copyop), - _position(apc._position), - _quaternion(apc._quaternion), - _scale(apc._scale) + osgAnimation::AnimationUpdateCallback(apc, copyop) { + _quaternion = new osgAnimation::QuatTarget(apc._quaternion->getValue()); + _position = new osgAnimation::Vec3Target(apc._position->getValue()); + _scale = new osgAnimation::Vec3Target(apc._scale->getValue()); } @@ -30,8 +30,20 @@ osgAnimation::Bone::Bone(const Bone& b, const osg::CopyOp& copyop) : _position(b._position), _rotation(b._rotation), _scale(b._scale), + _bindInBoneSpace(b._bindInBoneSpace), + _invBindInSkeletonSpace(b._invBindInSkeletonSpace), + _boneInSkeletonSpace(b._boneInSkeletonSpace), _needToRecomputeBindMatrix(true) { + osg::ref_ptr updatecallback = getUpdateCallback(); + setUpdateCallback(0); + while (updatecallback.valid()) { + osg::NodeCallback* ucb = dynamic_cast(updatecallback->clone(copyop)); + ucb->setNestedCallback(0); + ucb->setName(updatecallback->getName()); + addUpdateCallback(ucb); + updatecallback = updatecallback->getNestedCallback(); + } } osgAnimation::Bone::Bone(const std::string& name)