[BEST PRACTICE] Use the 'initialize' Function for Better Movie Preloading
mark last edited by
I wanted to throw out a best practice based on a user ticket we recently received. Consider the following setup:
The 's' key uses a Value to set the speed of the movie to 1, and the 'p' key uses a Trigger Value to set the speed of the movie to 0. So far so good. But then there is an Enter Scene Trigger actor to set the speed of the movie to '1' when you enter the scene. The user needed this because they might have hit the 'p' key to set the speed to 0 during a previous rehearsal or run of the show, and the user wanted to ensure the movie always played when entering this scene the next time around.
The better solution to this would be the following:
It's a subtle change but makes a difference. Why? Because, before Isadora can activate a scene with movies, it must preload (i.e., prepare) all of those movies so they are ready to play. During this preload, the 'speed', 'loop start', and 'loop length' inputs all affect the how the movie is preloaded. When you use the 'initialize' function, the correct initial values are taken into account during the preload because Isadora knows what those values will be. When using the "Enter Scene Trigger" initialization shown above, Isadora will not have the correct values during the preload phase.
Here's a worst case scenario for this situation, and a detailed breakdown of why it matters
1) During rehearsal you enter the scene shown above which we'll call XXX. The 'play start' is set to 0 and the 'play length' is set to 20.
2) While in this scene, you press the 'p' key and the the 'play start' is set to 40 and the 'play length' is set to 10.
3) You continue on with rehearsal and save the file. At this point, the saved values for 'play start' and 'play length' in scene XXX are 40 and 10 because that's how they were set when you exited the scene during rehearsal.
4) Now you come back to to run the show. You are in the scene before XXX and you hit the space bar to jump into XXX.
5) Before entering XXX, Isadora must preload the movies in that scene so they will start instantly. The whole point of preloading is to get the first several frames at the 'play start' point loaded and ready to go. The 'play start' is 40% during this preload because that's how the file was saved. So the frames at 40% are preloaded.
6) Once all the movies in XXX are preloaded, and Isadora actually enters the scene and starts playback of the movie from 40%. At this point, the frame at the 40% point has been rendered to the Stage.
7) Now that the scene is active, Isadora starts executing the actors inside of it. Because Isadora executes actors from top to bottom, the first actor that gets executed is the the Enter Scene Trigger actor, which fires the first two Trigger Value actors, setting the 'play start' is set to 0 and the 'play length' is set to 20.
8) Because of this change in loop points, Isadora now jumps to the beginning of the clip.
The end result? Depending on the speed of your computer and the codec/resolution of the movie, it is entirely possible might see that frame at 40% render before seeing the first frame at 0%.
Using the 'initialize' function to set the 'play start' to 0 and the 'play length' to 10, avoids this problem because, if the 'initialize' checkbox is turned on, Isadora uses the 'initialize' value into when preloading the movies. By using the initialize function, you can be certain there you'll see the frame at the beginning of the movie each tiem you enter this scene.