From Cedric Pinson, Store the linkvisitor to be able to configure it by user, like changing the nodemaskoverride, or use a custom LinkVisitor

This commit is contained in:
Cedric Pinson
2009-07-23 12:42:01 +00:00
parent 48a1934ca8
commit 5a73834cbe
5 changed files with 91 additions and 29 deletions

View File

@@ -21,7 +21,7 @@ AnimationManagerBase::~AnimationManagerBase() {}
AnimationManagerBase::AnimationManagerBase()
{
_needToLink = false;
_needToLink = false;
}
void AnimationManagerBase::clearTargets()
@@ -95,11 +95,25 @@ void AnimationManagerBase::registerAnimation (Animation* animation)
bool AnimationManagerBase::needToLink() const { return _needToLink; }
void AnimationManagerBase::setLinkVisitor(LinkVisitor* visitor)
{
_linker = visitor;
}
LinkVisitor* AnimationManagerBase::getOrCreateLinkVisitor()
{
if (!_linker.valid())
_linker = new LinkVisitor;
return _linker.get();
}
void AnimationManagerBase::link(osg::Node* subgraph)
{
LinkVisitor linker(_animations);
subgraph->accept(linker);
LinkVisitor* linker = getOrCreateLinkVisitor();
linker->getAnimationList().clear();
linker->getAnimationList() = _animations;
subgraph->accept(*linker);
_needToLink = false;
buildTargetReference();
}