From Michael Platings, I've just added a few simple accessors I found necessary

This commit is contained in:
Cedric Pinson 2009-08-26 16:39:53 +00:00
parent 3c45fb1e6c
commit 729d5205ef
3 changed files with 20 additions and 3 deletions

View File

@ -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;

View File

@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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();}
};

View File

@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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 <osgAnimation/AnimationManagerBase>
#include <osgAnimation/LinkVisitor>
#include <algorithm>
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; }