- Timestamp:
- 10/23/09 22:35:31 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgAnimation/UpdateCallback
r10671 r10689 27 27 { 28 28 29 class AnimationUpdateCallbackBase 29 class AnimationUpdateCallbackBase : public virtual osg::Object 30 30 { 31 31 public: 32 virtual osg::Object* clone(const osg::CopyOp& copyop) const = 0;33 virtual AnimationManagerBase* getAnimationManager() = 0;34 virtual bool needLink() const = 0;35 32 virtual bool link(osgAnimation::Channel* channel) = 0; 36 33 virtual int link(osgAnimation::Animation* animation) = 0; 37 virtual void updateLink() = 0;38 virtual const std::string& getName() const = 0;39 34 }; 40 35 … … 42 37 class AnimationUpdateCallback : public AnimationUpdateCallbackBase, public T 43 38 { 44 protected:45 46 osg::observer_ptr<osgAnimation::AnimationManagerBase> _manager;47 48 39 public: 49 40 AnimationUpdateCallback(const std::string& name) { T::setName(name);} 50 41 AnimationUpdateCallback(const AnimationUpdateCallback& apc,const osg::CopyOp& copyop): 51 T(apc, copyop), 52 _manager(apc._manager) {} 42 T(apc, copyop) {} 53 43 54 osgAnimation::AnimationManagerBase* getAnimationManager() { return _manager.get(); }55 56 44 const std::string& getName() const { return T::getName(); } 57 45 int link(osgAnimation::Animation* animation) … … 73 61 } 74 62 return nbLinks; 75 }76 77 void updateLink()78 {79 if (_manager.valid())80 {81 if (needLink())82 {83 /** this item is not linked yet then we do it for all animation84 registered in the manager.85 Maybe this function should be on the manager side like86 _manager->linkItem(Bone);87 */88 const AnimationList& animationList = _manager->getAnimationList();89 for (AnimationList::const_iterator it = animationList.begin(); it != animationList.end(); it++)90 {91 AnimationUpdateCallbackBase* a = this;92 a->link(it->get());93 }94 _manager->buildTargetReference();95 }96 }97 63 } 98 64 }; … … 119 85 void update(osg::MatrixTransform& mat); 120 86 void update(osg::PositionAttitudeTransform& pat); 121 bool needLink() const;122 87 bool link(osgAnimation::Channel* channel); 123 88 … … 144 109 virtual void operator () (osg::StateAttribute*, osg::NodeVisitor*); 145 110 void update(osg::Material& material); 146 bool needLink() const;147 111 bool link(osgAnimation::Channel* channel); 148 112 osgAnimation::Vec4Target* getDiffuse();
