Show
Ignore:
Timestamp:
10/01/09 19:08:16 (5 years ago)
Author:
cedricpinson
Message:

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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgAnimation/MorphGeometry.cpp

    r10556 r10599  
    262262    if (weightIndex >= 0) 
    263263    { 
    264       osgAnimation::FloatLinearChannel* fc = dynamic_cast<osgAnimation::FloatLinearChannel*>(channel); 
    265       if (fc) 
    266       { 
    267           osgAnimation::FloatTarget* ft = new osgAnimation::FloatTarget; 
    268           _weightTargets[weightIndex] = ft; 
    269           ft->setValue(-1); 
    270           fc->setTarget(ft); 
    271           return true; 
    272       } 
    273   } 
     264        osgAnimation::FloatLinearChannel* fc = dynamic_cast<osgAnimation::FloatLinearChannel*>(channel); 
     265        if (fc) 
     266        { 
     267            osgAnimation::FloatTarget* ft = _weightTargets[weightIndex].get(); 
     268            if (ft == 0) 
     269            { 
     270                ft = new osgAnimation::FloatTarget; 
     271                _weightTargets[weightIndex] = ft; 
     272            } 
     273            fc->setTarget(ft); 
     274            return true; 
     275        } 
     276    } 
    274277    else 
    275   { 
    276       osg::notify(osg::WARN) << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class" << std::endl; 
    277   } 
    278   return false; 
    279 } 
     278    { 
     279        osg::notify(osg::WARN) << "Channel " << channel->getName() << " does not contain a valid symbolic name for this class" << std::endl; 
     280    } 
     281    return false; 
     282}