void MorphChannel::pushTargets(const MorphTargetList& targets) { // if the target sequence empty, we should initialize m_current to the beginning as well bool rew = m_targetSequence.empty(); MorphTargetList::const_iterator it = targets.begin(); while (it != targets.end()) { smoothTarget(*it); m_targetSequence.push_back(*it); ++it; } // m_targetSequence.insert(m_targetSequence.end(), targets.begin(), targets.end()); if(rew) rewind(); }
void AnimationCleanerVisitor::apply(osg::Geometry& geometry) { osgAnimation::MorphGeometry* morphGeometry = 0; osgAnimation::RigGeometry* rigGeometry = dynamic_cast<osgAnimation::RigGeometry*>(&geometry); if(rigGeometry) { if(std::find(_rigGeometries.begin(), _rigGeometries.end(), rigGeometry) == _rigGeometries.end()) { _rigGeometries.push_back(rigGeometry); } morphGeometry = dynamic_cast<osgAnimation::MorphGeometry*>(rigGeometry->getSourceGeometry()); if(morphGeometry) { _morphGeometries[morphGeometry] = rigGeometry; } } else { morphGeometry = dynamic_cast<osgAnimation::MorphGeometry*>(&geometry); if(morphGeometry && _morphGeometries.count(morphGeometry) == 0) { _morphGeometries[morphGeometry] = 0; } } if(morphGeometry) { typedef osgAnimation::MorphGeometry::MorphTargetList MorphTargetList; MorphTargetList morphTargetList = morphGeometry->getMorphTargetList(); for(MorphTargetList::iterator morphTarget = morphTargetList.begin(); morphTarget != morphTargetList.end(); ++morphTarget) { osgAnimation::MorphGeometry::MorphTarget& target = *morphTarget; _morphTargets[target.getGeometry()->getName()] = morphGeometry; } } }