Animating multiple SceneNodes with DotScene files

What it says on the tin: a place to discuss proposed new features.
chilly willy
Halfling
Posts: 65
Joined: Tue Jun 02, 2020 4:11 am
x 19

Animating multiple SceneNodes with DotScene files

Post by chilly willy »

I am looking at using the DotScene plugin and so I dove into the DTD. In the file format, <animations> elements are children of <node> elements and only animate that node. I looked into the DotSceneLoader code and it looks like when it imports these animations, it creates them unconditionally with a single track (and would fail if an animation of the same name already exists). It does not export any animations at all.

In OGRE, SceneNode Animations are global to the SceneManager and may have multiple Tracks controlling multiple SceneNodes. I suspect this was not implemented in the file format because the file format is designed to represent a "partial scene" (hence saveChildren and loadChildren) and there is no easy way to separate the Animation's tracks among the various partial scenes where the animated SceneNodes may be saved.

I appreciate the "partial scene" notion of a .scene file and that is actually how I intend to use them. But it would be ideal to take full advantage of OGRE's capabilities with these files and animate several SceneNodes with a single Animation. It is also very unfortunate that loading and then saving a file is a lossy process.

One idea I had was to keep the file structure the same, but when loading an animation for a node, first check if an animation by that name already exists and if it does then just add a track to that animation for the node being loaded. There would be an issue of possibly clashing attributes (length, loop, etc...) but that could be handled by throwing an exception (certainly no worse than throwing an exception on a matching animation name, which is the current implementation).

Conversely, when exporting nodes it would be easy enough to look through the SceneManager's AnimationList, find all Animations with Tracks that apply to the node and export those Tracks in the existing format.

I can roll my own for my own purposes but I thought this might be a good idea for improving the already awesome engine. I would be happy to implement it and submit it.

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: Animating multiple SceneNodes with DotScene files

Post by sercero »

Perhaps the DTD format should be changed so that there are global Animation objects and then there are Tracks associated with the SceneNodes.

This is likely a not very used feature and that is why it is somewhat neglected.

I think the best way would be to discuss here a better design for the DTD.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2106
Joined: Sun Mar 30, 2014 2:51 pm
x 1132

Re: Animating multiple SceneNodes with DotScene files

Post by paroj »

yes sure. feel free to implement a solution and submit a PR on github. It is always easier to talk about an actual implementation.