From Cedric Pinson, this commit contains the following change:
* Change ref_ptr to observer_ptr to avoid cross reference and leak in Skinning * Set invalidate to true to re run the check visitor in Skeleton * Shallow copy Sampler in channel copy constructor * Add accessor in VertexInfluence * Remove dead code in Timeline.cpp * Dont force linking in Bone::UpdateBone, the decision is done by the user or the manager * Add offset in timeline stats to display each manager on the screen * Add a flag in animation manager base to enable or not automatic link when modifying the manager
This commit is contained in:
@@ -44,18 +44,27 @@ namespace osgAnimation
|
||||
/** Callback method called by the NodeVisitor when visiting a node.*/
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||||
|
||||
/// Operation that must be done each frame
|
||||
/** Reset the value of targets
|
||||
this Operation must be done each frame */
|
||||
void clearTargets();
|
||||
|
||||
|
||||
LinkVisitor* getOrCreateLinkVisitor();
|
||||
void setLinkVisitor(LinkVisitor*);
|
||||
|
||||
/// set a flag to define the behaviour
|
||||
void setAutomaticLink(bool);
|
||||
bool isAutomaticLink() const;
|
||||
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
|
||||
osg::ref_ptr<LinkVisitor> _linker;
|
||||
AnimationList _animations;
|
||||
TargetSet _targets;
|
||||
bool _needToLink;
|
||||
bool _automaticLink;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -77,10 +77,13 @@ namespace osgAnimation
|
||||
Channel* clone() const { return new TemplateChannel<SamplerType>(*this); }
|
||||
|
||||
TemplateChannel (const TemplateChannel& channel) :
|
||||
Channel(channel),
|
||||
_target(new TargetType(*channel.getTargetTyped())),
|
||||
_sampler(channel._sampler.get())
|
||||
Channel(channel)
|
||||
{
|
||||
if (channel.getTargetTyped())
|
||||
_target = new TargetType(*channel.getTargetTyped());
|
||||
|
||||
if (channel.getSamplerTyped())
|
||||
_sampler = new SamplerType(*channel.getSamplerTyped());
|
||||
}
|
||||
|
||||
TemplateChannel (SamplerType* s = 0,TargetType* target = 0)
|
||||
@@ -102,7 +105,7 @@ namespace osgAnimation
|
||||
// create a key from current target value
|
||||
typename KeyframeContainerType::KeyType key(0, _target->getValue());
|
||||
// recreate the keyframe container
|
||||
_sampler = 0;
|
||||
getOrCreateSampler()->setKeyframeContainer(0);
|
||||
getOrCreateSampler()->getOrCreateKeyframeContainer();
|
||||
// add the key
|
||||
_sampler->getKeyframeContainerTyped()->push_back(key);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osgAnimation
|
||||
public:
|
||||
META_Object(osgAnimation, UpdateSkeleton);
|
||||
UpdateSkeleton() : _needValidate(true) {}
|
||||
UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::Object(us, copyop), osg::NodeCallback(us, copyop) {}
|
||||
UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::Object(us, copyop), osg::NodeCallback(us, copyop) { _needValidate = true;}
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -46,11 +46,11 @@ namespace osgAnimation
|
||||
{
|
||||
public:
|
||||
BoneWeight(BoneType* bone, float weight) : _bone(bone), _weight(weight) {}
|
||||
const BoneType* getBone() const { return &(*_bone); }
|
||||
const BoneType* getBone() const { return _bone.get(); }
|
||||
float getWeight() const { return _weight; }
|
||||
void setWeight(float w) { _weight = w; }
|
||||
protected:
|
||||
osg::ref_ptr<BoneType> _bone;
|
||||
osg::observer_ptr<BoneType> _bone;
|
||||
float _weight;
|
||||
};
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace osgAnimation
|
||||
|
||||
const VertexList& vertexes = uniq.getVertexes();
|
||||
int vertexSize = vertexes.size();
|
||||
for (int j = 0; j < vertexSize; j++)
|
||||
for (int j = 0; j < vertexSize; j++)
|
||||
{
|
||||
int idx = vertexes[j];
|
||||
dst[idx] = src[idx] * matrix;
|
||||
|
||||
@@ -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
|
||||
@@ -96,6 +96,8 @@ namespace osgAnimation
|
||||
_bone2Vertexes.clear();
|
||||
_uniqVertexSetToBoneSet.clear();
|
||||
}
|
||||
|
||||
const VertexIndexToBoneWeightMap& getVertexToBoneList() const;
|
||||
protected:
|
||||
BoneToVertexList _bone2Vertexes;
|
||||
VertexIndexToBoneWeightMap _vertex2Bones;
|
||||
|
||||
Reference in New Issue
Block a user