Travel Time frameChanged Event Proccessor.

Hi All,

I have put together a script that will animate objects automatically via the frameChanged script link.

The code is too long to post in this text box, but you can find it here:
http://pasteall.org/176/python

USAGE:
Create a new scene and copy the code into the framechanged script link of the camera. You could paste the code into any object’s event, but the camera made the most sense to me.

Rename the default cube from “Cube” to “tt_Cube”. You can prefix any object with “tt_” to enable it for processing by the script. (tt stands for travel time). HINT: Font Objects

Press ALT-A and observe the results. Also take a look at what is being displayed in the console. You can see a series of events are generated representing the variaous states a travel time object goes through.

HOW IT WORKS:
The script scans the scene for objects that are named with the “tt_” prefix. It then uses the name of the object to create a registry entry using the python dictionary. This is how the script remembers variables between frameChangeg events. Typically Blender looses all variable information once a script link has been executed.
Frame #1 is special. When you rewind, the script fetches the starting location of the object and returns it to that location. The script processes location, scale and rotation.

A new object is set to the departing state. There is an intercept point in the script where you can execute code before an object leaves to travel to it’s destination or target. All the departing state does now is set the object to the idle state.

IDLE STATE:
A travel time command consists of two coordinates, a source LOC/ROT/SIZE and a target LOC/ROT/SIZE. Each command also has a state which can be polled as the object travels through time. Each object also has a frame count which is the number of frames it will take to travel from the source to the target. Each object also has an ID associated with the source/target pair. The ID is used to give a name to the coordinate set. For instance you may create a source target set to move an object from off camera to on camera. You might call something like this “onStage”. When the command is finished, the object will be on stage. When an object reaches it’s target locatrion, it’s internal ID is appended with the text “_complete”. this allows you to detect when an object has arrived (EXAMPLE: “onStage_complete”). You can then issue another coordinate set or any other custom code you can think of. To set the object in motion simply set it’s state to in-transit.

IN-TRANSIT STATE:
Once an object is in-transit it’s coordinates are managed by Blender. There is no “record to IPO” yet and scrubbing the timeline can cause the object to get out of sync. But if you simply rewind and play, the object will travel through time. There is a hard coded “targetThreshold” variable. This variable is used to detect when the object has reached it’s target destination. Once the object has reached it’s destination, it’s state is changed to arrived.

ARRIVED STATE:
The arrived state is another code intercept where you can reprogram the object. In the currently posted example code, the objects’ state is changed to bouncing and that is all.

BOUNCING STATE:
The bouncing state is what happens after the object arrives at it’s target. You can create as many states as you like. The bouncing intercept has a speed variable and decay, so you can adjust these and have some fun. Watch you object travel from point A-B and then bounce wildly once it arrives. The “bounceRange” variable is used to detect when the bouncing has camled down. This triggers another state, the final state where the object is returned to the idle state and it’s objectID is post fixed with the “_complete” tag.

Well, give it a try and offer feedback.:slight_smile: