SceneNode::isAnimated() request

What it says on the tin: a place to discuss proposed new features.
Post Reply
Stickymango
Hobgoblin
Posts: 540
Joined: Wed Nov 17, 2004 4:36 pm
Location: Middlesbrough, England

SceneNode::isAnimated() request

Post by Stickymango »

Hi,

I'd like to request a little test function which returns whether or not a SceneNode has an associated animation. I'm finding it difficult to Reset all my scene elements which have been moved around by animations.

I couldn't find anything which easily determines if a SceneNode is associated with an AnimationNodeTrack, so I could therefore do something like:

Code: Select all

if ( mSceneNode->isAnimated() ) mSceneNode->resetToInitialState();
Is there such a thing?

Or maybe a utility function within the SceneManager to reset all animations to their default with a single a call.

Thanks.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

The trouble is that nodes don't actually know they are animated, it's a one-way thing. SceneManager::_applySceneAnimations resets the animated nodes for you, and if you've turned off animations then they'll stay there, why do you have to do it manually?
Stickymango
Hobgoblin
Posts: 540
Joined: Wed Nov 17, 2004 4:36 pm
Location: Middlesbrough, England

Post by Stickymango »

That doesn't really help,

What the problem is is that I have an educational application which is divided up into sections, there are quite a lot of animations within the sections as a whole. You have the ability to 'jump' to any section at any point, I therefore need the ability to say reset all objects moved by animations to how they were at load time, then I can 'apply/enable' all the animations required to 'pose' the scene at the beginning of the desired section.

As I understand it I cannot use resetToInitialState() on un-animated SceneNodes to return them to their original position only animated SceneNodes, so a flag to indicate a SceneNode has been associated with a NodeAnimationTrack would be useful, to know when I can use resetToInitialState();
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

You can call resetToInitialState() on any Node at all - but you of course have to have set the initial state using setInitialState() for it to know what to return to. If you did that on every node after loading, you would be able to call resetToInitialState() on everything without worrying about it?
Stickymango
Hobgoblin
Posts: 540
Joined: Wed Nov 17, 2004 4:36 pm
Location: Middlesbrough, England

Post by Stickymango »

I see, I think I've got confused by the way our modellers have exported the animations with oFusion, because looking at the actual keyframe data the positions appear to be absolute world positions although I know animations are offsets. Thats why when I was resetting ALL nodes to their initial position, applying the required animations appeared to position the animated objects correctly but everything else was not rendered (it looked like only animated objects had their setInitialState() called).

So I can probably tweak the oFusion loader code to allow the use of resetToInitialState() for resetting.

I still think a utility function to test whether a SceneNode is animated and even better which animation(s) it is controlled by would be useful, but for now I'll try the setInitialState() route to achieve what I need.

Thanks,
Post Reply