From Cedric Pinson, fix copy constructor for clone operation for Bone, add a missing contructor with quaternion for Target
This commit is contained in:
parent
c78e41ede6
commit
b2943aa50a
@ -93,7 +93,7 @@ namespace osgAnimation
|
||||
|
||||
class OSGANIMATION_EXPORT UpdateBone : public AnimationUpdateCallback
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
osg::ref_ptr<osgAnimation::Vec3Target> _position;
|
||||
osg::ref_ptr<osgAnimation::QuatTarget> _quaternion;
|
||||
osg::ref_ptr<osgAnimation::Vec3Target> _scale;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -17,11 +17,11 @@
|
||||
#include <osgAnimation/Skeleton>
|
||||
|
||||
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<osg::NodeCallback> updatecallback = getUpdateCallback();
|
||||
setUpdateCallback(0);
|
||||
while (updatecallback.valid()) {
|
||||
osg::NodeCallback* ucb = dynamic_cast<osg::NodeCallback*>(updatecallback->clone(copyop));
|
||||
ucb->setNestedCallback(0);
|
||||
ucb->setName(updatecallback->getName());
|
||||
addUpdateCallback(ucb);
|
||||
updatecallback = updatecallback->getNestedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
osgAnimation::Bone::Bone(const std::string& name)
|
||||
|
Loading…
Reference in New Issue
Block a user