Thanks Cedric. The only extra thing I need for this to work for me is Channel::setSampler() - I've attached the change.
The reason for needing setSampler() is that to create a default Channel I do this: Channel* channel = someAnimationChannel->clone(); channel->setSampler(0); channel->createKeyframeContainerFromTargetValue(); defaultAnim->addChannel(channel); Without the setSampler call createKeyframeContainerFromTargetValue will change someAnimationChannel's sampler. Maybe TemplateChannel::clone() should clone the Sampler rather than copying the pointer? My animation manager - I use BasicAnimationManager, as the FBX importer needs some way to store animations when importing them. Instead I'd prefer that Animations could be attached to a Node directly without requiring any animation manager. Then the application could traverse an imported model to find animations, and add handle those animations in whatever way is most appropriate for it. As an example, in my application I need to control the timing of each Animation separately, each one is controlled by a different object (the hack I'm currently using is to keep osg's time at zero, and set the start time of each animation to minus the time needed). While I'm suggesting changes: the biggest thing that jumped out at me while writing the FBX importer was the way UpdateCallbacks are linked with Channels according to their names. This seems inefficient and at odds with the way the rest of OpenSceneGraph works. It would be much easier to just link animation parts directly e.g. by calling channel->setTarget(), rather than giving objects particular names and relying on a linker to do the job with string comparisons. It should be the job of an importer to link things together (and deal with any possible naming conflicts that may appear with that particular format), rather than the core osgAnimation. An importer may even be able to link objects more easily with pointers than if it has to create unique strings. I'll be happy to update the FBX importer if you make this change. Cheers -Michael -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Cedric Pinson Sent: 09 September 2009 11:49 To: OpenSceneGraph Submissions Subject: Re: [osg-submissions] osgAnimation default animation creation & other fixes Hi Michael, Thank you for your submission, I commited partially your submissions, i have the feeling that createDefaultAnimation should be in your applications and not inside osgAnimation, it's specific to your use. I thought about if i would use it, but i dont manage animations in the same way so the answer is no ( I dont want to have a default animation that reset each channel, i have color animation, transform animation, skeleton animation, and variable in stateattribute animated. It does not work like that in my apps. Because of that we can all have a different way to manage animation that's why i prefer to keep the common part that everyone use instead of adding specific code for a usage (at least in 'generic' part). AnimationManagerBase should access 'low level' element in the animation manager point of view, and must be 'generic'. BasicAnimationManager give a basic way to manage animation but the minimum, it's an animation manager example, could be extended TimelineAnimationManager is more sophisticated way to handle animation with a timeline, callback ... I think that we would need an extended animation manager from BasicAnimationManager, because BasicAnimationManager is more an example than a powerful animation manager. In the future BasicAnimationManager should go in example directory and another animation manager should replace it with better feature (like callback ...) Could you describe your animation manager, i would like to ask you some questions about it. I updated the function to create your default animation with the code commited. osgAnimation::Animation* osgAnimation::createAnimationFromTargetValues(const AnimationList& animationList) { typedef std::map<Target*, Channel*> ChannelMap; ChannelMap channels; for (AnimationList::const_iterator iterAnim = animationList.begin(); iterAnim != animationList.end(); ++iterAnim ) { Animation* anim = (*iterAnim).get(); for (ChannelList::const_iterator it = anim->getChannels().begin(); it != anim->getChannels().end(); it++) { Channel* channel = it->get(); channels.insert(ChannelMap::value_type(channel->getTarget(), channel)); } } Animation* anim = new Animation; anim->setDuration(1.0); for (ChannelMap::const_iterator it = channels.begin(); it != channels.end(); ++it) { Channel* channel = it->second->clone(); if (!channel->createKeyframeContainerFromTargetValue()) osg::notify(osg::WARN) << "cant grab value for channel " << channel->getName() << std::endl; anim->addChannel(channel); } return anim; } Cheers, Cedric - +33 659 598 614 Cedric Pinson mailto:[email protected] http://www.plopbyte.net On Mon, 2009-09-07 at 20:12 +0100, Michael Platings wrote: > Hi Cedric, > further to your suggestion that a default animation could be played to > stop other animations, I've added a function to AnimationManagerBase > to create such an animation - createDefaultAnimation(). > > I have also removed Target::normalize() as calling it was incorrect - > the interpolation is already done in such a way that the Target's > value is always normalized. > > Finally, I have fixed TemplateTarget<osg::Quat>::lerp() as it was > giving incorrect results when interpolating between some small > rotations. > > ______________________________________________________________________ > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscene > graph.org ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ______________________________________________________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
Channel
Description: Channel
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
