Ok, I've managed to do as follows:

Code:

template <typename ChannelType, typename ContainerType>
void setKeyFrameValues(ChannelType* pChannel,float value, double time)
{
ContainerType* kfc  = pChannel->getSamplerTyped()->getKeyframeContainerTyped();
if(!kfc){return;}

int closestFrame = -1;
double closestDiff = 99999.99f;
//loop all the keys
for(unsigned int i=0; i<kfc->size(); i++)
{
double diff = fabs(time - (*kfc)[i].getTime());
if( diff < closestDiff){
closestFrame = i;
closestDiff = diff;
}
}

(*kfc)[closestFrame].setValue(value);

...

for (unsigned int i = 0; i < 
m_animationManager->getAnimationList()[id]->getChannels().size(); i++) 
{
osgAnimation::Channel* pChannel = 
m_animationManager->getAnimationList()[id]->getChannels()[i].get();
osgAnimation::FloatLinearChannel* pFlc = 
dynamic_cast<osgAnimation::FloatLinearChannel*>(pChannel);
if (pFlc)
{
setKeyFrameValues/osgAnimation::FloatLinearChannel, 
osgAnimation::FloatKeyframeContainer>(pFlc, intensity, time);
continue;
}
}
}




But, for example, for an animation loaded from a fbx file, how can I change  
Vec2CubicBezierChannel channels?

Thank you!

Cheers,
Aitor

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=39705#39705





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to