From Cedric Pinson, Fix warning in osgAnimation, UpdateCallback. Fix bug removing callback in Action. Fix warning Stats
This commit is contained in:
@@ -51,10 +51,12 @@ namespace osgAnimation
|
||||
Callback* getNestedCallback() { return _nestedCallback.get(); }
|
||||
void addNestedCallback(Callback* callback)
|
||||
{
|
||||
if (_nestedCallback.valid())
|
||||
_nestedCallback->addNestedCallback(callback);
|
||||
else
|
||||
_nestedCallback = callback;
|
||||
if (callback) {
|
||||
if (_nestedCallback.valid())
|
||||
_nestedCallback->addNestedCallback(callback);
|
||||
else
|
||||
_nestedCallback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
void removeCallback(Callback* cb)
|
||||
@@ -64,7 +66,7 @@ namespace osgAnimation
|
||||
|
||||
if (_nestedCallback.get() == cb)
|
||||
_nestedCallback = _nestedCallback->getNestedCallback();
|
||||
else
|
||||
else if (_nestedCallback.valid())
|
||||
_nestedCallback->removeCallback(cb);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -10,7 +10,7 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef OSGANIMATION_TIMELINE_ANIMATION_MANAGER_H
|
||||
#define OSGANIMATION_TIMELINE_ANIMATION_MANAGER_H
|
||||
|
||||
@@ -37,11 +37,15 @@ namespace osgAnimation
|
||||
class AnimationUpdateCallback : public AnimationUpdateCallbackBase, public T
|
||||
{
|
||||
public:
|
||||
AnimationUpdateCallback() {}
|
||||
AnimationUpdateCallback(const std::string& name) { T::setName(name);}
|
||||
AnimationUpdateCallback(const AnimationUpdateCallback& apc,const osg::CopyOp& copyop):
|
||||
T(apc, copyop) {}
|
||||
|
||||
META_Object(osgAnimation, AnimationUpdateCallback<T>);
|
||||
|
||||
const std::string& getName() const { return T::getName(); }
|
||||
bool link(osgAnimation::Channel* channel) { return 0; }
|
||||
int link(osgAnimation::Animation* animation)
|
||||
{
|
||||
if (T::getName().empty())
|
||||
|
||||
@@ -140,8 +140,9 @@ void UpdateActionVisitor::apply(ActionAnimation& action)
|
||||
{
|
||||
unsigned int frame = getLocalFrame();
|
||||
apply(static_cast<Action&>(action));
|
||||
// action.updateAnimation(frame, getCurrentLayer());
|
||||
action.updateAnimation(frame, -_currentAnimationPriority++);
|
||||
int pri = static_cast<int>(_currentAnimationPriority);
|
||||
_currentAnimationPriority++;
|
||||
action.updateAnimation(frame, -pri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -424,8 +424,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
|
||||
pos.y() -= characterSize *2 + backgroundMargin;
|
||||
|
||||
for (std::map<std::string, StatAction >::iterator it = _actions.begin(); it != _actions.end(); it++) {
|
||||
//if ((*it).second.update())
|
||||
(*it).second._group->setNodeMask(~1);
|
||||
(*it).second._group->setNodeMask(~osg::Node::NodeMask(1));
|
||||
}
|
||||
|
||||
const std::vector<std::string>& channels = visitor->getChannels();
|
||||
@@ -441,7 +440,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
|
||||
_actions[name].setPosition(pos);
|
||||
//_actions[name].touch();
|
||||
}
|
||||
_actions[name]._group->setNodeMask(~0);
|
||||
_actions[name]._group->setNodeMask(~osg::Node::NodeMask(0x0));
|
||||
size[name] = 0;
|
||||
pos.y() -= characterSize + graphSpacing;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ void StatsActionVisitor::apply(ActionStripAnimation& action)
|
||||
if (isActive(action))
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(), action.getAnimation()->getAnimation()->getWeight());
|
||||
double value;
|
||||
std::string name = action.getName();
|
||||
if (_stats->getAttribute(_frame, name, value))
|
||||
name += "+";
|
||||
_stats->setAttribute(_frame, action.getName(), action.getAnimation()->getAnimation()->getWeight());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user