From Cedric Pinson, Fix the drop of the first frame of action when adding action with addActionNow\nReport stats only for active animations\nAdd priority to RunAction callback
This commit is contained in:
@@ -15,20 +15,22 @@
|
||||
#ifndef OSGANIMATION_ACTION_CALLBACK_H
|
||||
#define OSGANIMATION_ACTION_CALLBACK_H
|
||||
|
||||
#include <osgAnimation/Export>
|
||||
#include <osgAnimation/Action>
|
||||
|
||||
namespace osgAnimation
|
||||
{
|
||||
|
||||
/** Callback used to run new action on the timeline.*/
|
||||
class RunAction : public Action::Callback
|
||||
class OSGANIMATION_EXPORT RunAction : public Action::Callback
|
||||
{
|
||||
public:
|
||||
RunAction(Action* a) : _action(a) {}
|
||||
RunAction(Action* a, int priority = 0) : _action(a), _priority(priority) {}
|
||||
virtual void operator()(Action* action, ActionVisitor* visitor);
|
||||
|
||||
protected:
|
||||
osg::ref_ptr<Action> _action;
|
||||
int _priority;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
void osgAnimation::RunAction::operator()(Action* action, ActionVisitor* visitor)
|
||||
{
|
||||
Timeline* tm = visitor->getCurrentTimeline();
|
||||
tm->addActionNow(_action.get());
|
||||
tm->addActionNow(_action.get(), _priority);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ void osgAnimation::StatsActionVisitor::apply(Timeline& tm)
|
||||
|
||||
void osgAnimation::StatsActionVisitor::apply(Action& action)
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(),0);
|
||||
if (isActive())
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
@@ -43,8 +41,6 @@ void osgAnimation::StatsActionVisitor::apply(Action& action)
|
||||
|
||||
void osgAnimation::StatsActionVisitor::apply(BlendIn& action)
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(),0);
|
||||
if (isActive())
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
@@ -54,8 +50,6 @@ void osgAnimation::StatsActionVisitor::apply(BlendIn& action)
|
||||
|
||||
void osgAnimation::StatsActionVisitor::apply(BlendOut& action)
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(),0);
|
||||
if (isActive())
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
@@ -65,8 +59,6 @@ void osgAnimation::StatsActionVisitor::apply(BlendOut& action)
|
||||
|
||||
void osgAnimation::StatsActionVisitor::apply(ActionAnimation& action)
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(),0);
|
||||
if (isActive())
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
@@ -76,8 +68,6 @@ void osgAnimation::StatsActionVisitor::apply(ActionAnimation& action)
|
||||
|
||||
void osgAnimation::StatsActionVisitor::apply(StripAnimation& action)
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
_stats->setAttribute(_frame,action.getName(),0);
|
||||
if (isActive())
|
||||
{
|
||||
_channels.push_back(action.getName());
|
||||
|
||||
@@ -161,7 +161,7 @@ void osgAnimation::Timeline::addActionAt(double t, Action* action, int priority)
|
||||
|
||||
void osgAnimation::Timeline::addActionNow(Action* action, int priority)
|
||||
{
|
||||
addActionAt(getCurrentFrame(), action, priority);
|
||||
addActionAt(getCurrentFrame()+1, action, priority);
|
||||
}
|
||||
|
||||
void osgAnimation::Timeline::processPendingOperation()
|
||||
|
||||
Reference in New Issue
Block a user