From Michael Platings, In Target, the default constructor is explicitly called on _target. This is necessary for FloatTarget and DoubleTarget so that _target is initialised to 0, otherwise you get a junk value. In MorphGeometry.cpp, UpdateMorph::link now links channels of the same index to the same target. Previously a new FloatTarget was created for each channel, so multiple animations didn't work.
This commit is contained in:
@@ -50,7 +50,7 @@ namespace osgAnimation
|
||||
{
|
||||
public:
|
||||
|
||||
TemplateTarget() {}
|
||||
TemplateTarget() : _target() {}
|
||||
TemplateTarget(const T& v) { setValue(v); }
|
||||
TemplateTarget(const TemplateTarget& v) { setValue(v.getValue()); }
|
||||
|
||||
|
||||
@@ -261,19 +261,22 @@ bool UpdateMorph::link(osgAnimation::Channel* channel)
|
||||
|
||||
if (weightIndex >= 0)
|
||||
{
|
||||
osgAnimation::FloatLinearChannel* fc = dynamic_cast<osgAnimation::FloatLinearChannel*>(channel);
|
||||
if (fc)
|
||||
{
|
||||
osgAnimation::FloatTarget* ft = new osgAnimation::FloatTarget;
|
||||
_weightTargets[weightIndex] = ft;
|
||||
ft->setValue(-1);
|
||||
fc->setTarget(ft);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
osgAnimation::FloatLinearChannel* fc = dynamic_cast<osgAnimation::FloatLinearChannel*>(channel);
|
||||
if (fc)
|
||||
{
|
||||
osgAnimation::FloatTarget* ft = _weightTargets[weightIndex].get();
|
||||
if (ft == 0)
|
||||
{
|
||||
ft = new osgAnimation::FloatTarget;
|
||||
_weightTargets[weightIndex] = ft;
|
||||
}
|
||||
fc->setTarget(ft);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::WARN) << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class" << std::endl;
|
||||
}
|
||||
return false;
|
||||
{
|
||||
osg::notify(osg::WARN) << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class" << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user