Bouncing Ball Script (Transform Channels)
Transform Channel Overview
modo takes a somewhat unique approach to item transforms. Rather than include the transforms as part of the item itself, the item is linked to secondary transform-specific items.
Channels
Every item in modo has channels, and these are the primary manner in which item state is exposed for editing. Some channels are hidden from the user, or represent [Common Datatypes#Complex Datatypes|complex datatypes]] such as mesh stacks and item links. In general, scripts deal only with simple datatypes, notably numeric and string channels.
As described previously, most item channels can be walked through the Sceneservice ScriptQuery interface, and can be read or set using the Item.channel command. Transform channels, however, are a little different.
Transform Items
Locator item types (which includes Mesh, Camera, Light and so on) do not directly have their own position, rotation and scale channels. Instead, they have links to transform items that handle these properties. This allows multiple items to share the same transform items, and to save memory by not creating the transform items and associated channels when they aren’t required.
This unique system complicates how the position, rotation and scale of an item are read. You can’t directly ask the item for its channels, since they aren't on that item. Instead, you must ask the item for its transform item, and then query that item's channels. The sceneservice ScriptQuery interface provides a series of item.xfrm??? attributes to simplify getting the IDs of the transform items.
|