From Cedric Pinson, The following modification are
Update Timeline.cpp to add current layer to the ActionVisitor, use correctly the priority Add accessors in Action.cpp to retrieve protected data Split files and rename them to classname Change de default color of UpdateMaterial to FFOOFF to detect unset value Add accessors in LinkVisitor instead of accessing data directly Update osganimationtimeline example to fit the api callback
This commit is contained in:
@@ -166,7 +166,7 @@ namespace osgAnimation
|
||||
ActionAnimation() {}
|
||||
ActionAnimation(const ActionAnimation& a, const osg::CopyOp& c) : Action(a,c) { _animation = a._animation;}
|
||||
ActionAnimation(Animation* animation);
|
||||
void updateAnimation(unsigned int frame);
|
||||
void updateAnimation(unsigned int frame, int priority);
|
||||
Animation* getAnimation() { return _animation.get(); }
|
||||
|
||||
protected:
|
||||
@@ -192,8 +192,6 @@ namespace osgAnimation
|
||||
|
||||
unsigned int getLoop() const { return _animation->getLoop(); }
|
||||
void setLoop(unsigned int loop);
|
||||
void computeWeightAndUpdateAnimation(unsigned int frame);
|
||||
|
||||
void traverse(ActionVisitor& visitor);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -38,10 +38,8 @@ namespace osgAnimation
|
||||
class OSGANIMATION_EXPORT ActionVisitor : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
std::vector<FrameAction> _stackFrameAction;
|
||||
std::vector<Timeline*> _stackTimeline;
|
||||
|
||||
META_ActionVisitor(osgAnimation, ActionVisitor);
|
||||
ActionVisitor();
|
||||
void traverse(Action& visitor);
|
||||
|
||||
void pushFrameActionOnStack(const FrameAction& fa);
|
||||
@@ -51,6 +49,10 @@ namespace osgAnimation
|
||||
void popTimeline();
|
||||
|
||||
Timeline* getCurrentTimeline();
|
||||
void setCurrentLayer(int layer) { _currentLayer = layer;}
|
||||
int getCurrentLayer() const { return _currentLayer; }
|
||||
|
||||
const std::vector<FrameAction>& getStackedFrameAction() const { return _stackFrameAction; }
|
||||
|
||||
virtual void apply(Action& action);
|
||||
virtual void apply(Timeline& tm);
|
||||
@@ -58,6 +60,11 @@ namespace osgAnimation
|
||||
virtual void apply(BlendOut& action);
|
||||
virtual void apply(ActionAnimation& action);
|
||||
virtual void apply(StripAnimation& action);
|
||||
|
||||
protected:
|
||||
std::vector<FrameAction> _stackFrameAction;
|
||||
std::vector<Timeline*> _stackTimeline;
|
||||
int _currentLayer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -56,25 +56,6 @@ namespace osgAnimation
|
||||
|
||||
void setDefaultUpdateCallback(const std::string& name = "");
|
||||
|
||||
struct BoneMapVisitor : public osg::NodeVisitor
|
||||
{
|
||||
BoneMap _map;
|
||||
BoneMapVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
META_NodeVisitor("osgAnimation","BoneMapVisitor")
|
||||
|
||||
void apply(osg::Node&) { return; }
|
||||
void apply(osg::Transform& node)
|
||||
{
|
||||
Bone* bone = dynamic_cast<Bone*>(&node);
|
||||
if (bone)
|
||||
{
|
||||
_map[bone->getName()] = bone;
|
||||
traverse(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class OSGANIMATION_EXPORT UpdateBone : public AnimationUpdateCallback <osg::NodeCallback>
|
||||
{
|
||||
protected:
|
||||
@@ -131,6 +112,8 @@ namespace osgAnimation
|
||||
|
||||
const osg::Vec3& getTranslation() const { return _position;}
|
||||
const osg::Quat& getRotation() const { return _rotation;}
|
||||
const osg::Vec3& getScale() const { return _scale;}
|
||||
|
||||
osg::Matrix getMatrixInBoneSpace() const { return (osg::Matrix(getRotation())) * osg::Matrix::translate(getTranslation()) * _bindInBoneSpace;}
|
||||
const osg::Matrix& getBindMatrixInBoneSpace() const { return _bindInBoneSpace; }
|
||||
const osg::Matrix& getMatrixInSkeletonSpace() const { return _boneInSkeletonSpace; }
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace osgAnimation
|
||||
|
||||
AnimationList& getAnimationList();
|
||||
void reset();
|
||||
unsigned int getNbLinkedTarget() const { return _nbLinkedTarget; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace osgAnimation
|
||||
public:
|
||||
|
||||
Target();
|
||||
virtual ~Target();
|
||||
virtual ~Target() {}
|
||||
virtual void normalize() = 0;
|
||||
void reset() { _weight = 0; _priorityWeight = 0; }
|
||||
int getCount() const { return referenceCount(); }
|
||||
|
||||
Reference in New Issue
Block a user