Playing part of an animation xml file

The first step was to make RunAllAnimations running, so that my example from Play all animations in sequence - #8 by michalis works.

Please first make sure it works – that you have a working RunAllAnimations, in a simple test application.

Try to understand that code. Code from the outside should not call RunNextAnimation, this doesn’t make sense – RunNextAnimation is just a helper method, we need it as a the Params.StopNotification callback. Code from the outside should only call RunAllAnimations. I emphasize: make sure it works, and play with this code so you understand what it does.

Once you got it, the next step is to change RunAllAnimations into something like RunAnimationSequence . It should take, as arguments, the Scene, and the list of animation names, and look like

procedure xxx.RunAnimationSequence(const Scene: TCastleSceneCore; const Names: array of String);
begin
  ..// implementation should be similar to RunAllAnimations, but you have to initialize new AnimList with the contents of Names
end;

The only thing you have to do is initialize AnimList to be

  • a new instance of TStringList
  • to contain a copy of Names: array of String