diff --git a/include/osgAnimation/AnimationManagerBase b/include/osgAnimation/AnimationManagerBase index f30170ad3..4393848b5 100644 --- a/include/osgAnimation/AnimationManagerBase +++ b/include/osgAnimation/AnimationManagerBase @@ -34,7 +34,8 @@ namespace osgAnimation AnimationManagerBase(const AnimationManagerBase& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY); virtual ~AnimationManagerBase(); virtual void buildTargetReference(); - virtual void registerAnimation (Animation* animation); + virtual void registerAnimation (Animation*); + virtual void unregisterAnimation (Animation*); virtual void link(osg::Node* subgraph); virtual void update(double t) = 0; virtual bool needToLink() const; diff --git a/include/osgAnimation/UpdateCallback b/include/osgAnimation/UpdateCallback index 16c6b2a25..95d8910f9 100644 --- a/include/osgAnimation/UpdateCallback +++ b/include/osgAnimation/UpdateCallback @@ -1,5 +1,5 @@ /* -*-c++-*- - * Copyright (C) 2008 Cedric Pinson + * Copyright (C) 2008 Cedric Pinson * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or @@ -29,6 +29,7 @@ namespace osgAnimation class AnimationUpdateCallbackBase { public: + virtual osg::Object* clone(const osg::CopyOp& copyop) const = 0; virtual AnimationManagerBase* getAnimationManager() = 0; virtual bool needLink() const = 0; virtual bool link(osgAnimation::Channel* channel) = 0; @@ -119,6 +120,10 @@ namespace osgAnimation void update(osg::PositionAttitudeTransform& pat); bool needLink() const; bool link(osgAnimation::Channel* channel); + + osgAnimation::Vec3Target* getEuler() {return _euler.get();} + osgAnimation::Vec3Target* getPosition() {return _position.get();} + osgAnimation::Vec3Target* getScale() {return _scale.get();} }; diff --git a/src/osgAnimation/AnimationManagerBase.cpp b/src/osgAnimation/AnimationManagerBase.cpp index a157109bf..2fa40a75c 100644 --- a/src/osgAnimation/AnimationManagerBase.cpp +++ b/src/osgAnimation/AnimationManagerBase.cpp @@ -1,5 +1,5 @@ /* -*-c++-*- - * Copyright (C) 2008 Cedric Pinson + * Copyright (C) 2008 Cedric Pinson * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or @@ -14,6 +14,7 @@ #include #include +#include using namespace osgAnimation; @@ -92,6 +93,16 @@ void AnimationManagerBase::registerAnimation (Animation* animation) buildTargetReference(); } +void AnimationManagerBase::unregisterAnimation (Animation* animation) +{ + AnimationList::iterator it = std::find(_animations.begin(), _animations.end(), animation); + if (it != _animations.end()) + { + _animations.erase(it); + } + buildTargetReference(); +} + bool AnimationManagerBase::needToLink() const { return _needToLink; }