|
|
|
Behaviors
The Behaviors utilities consist of plugins for attaching code to Softimage objects, and evaluating that code each frame (or whenever the object to which the code is attached is modified). Attached code is a fast and easy way to build persistent effects without building the shareable libraries, .cus files and all the rest. Attached code can act as expressions with runtime binding of variables. For example, one could constrain an objects motion to always maintain a minimum distance from all other objects by moving itself and/or moving the other objects. Unlike expressions, behaviors can identify the objects they are to interact with at run time (using names, chapters or any other programmatically distinguishable characteristic). Attached code can read or write files and communicate with other processes or devices. The data read or communicated can be used for any purpose including animating the element to which the code is attached. This is often easier than writing a channel driver. Attached code can use Tk to build graphical user interface elements. Unlike Softimage dialogs these Tk widgets can be used at any time. Since Behaviors are a part of a model they are easily portable. Just drop the model into a new scene and its behaviors come with it. Behaviors can also build selected function curves. Once attached code has achieved the desired behavior the code can be disabled. The behaviors animation is preserved by the generated fcurves. You write and debug your code just as you would any SoftWish code, then use the BehaviorEdit immediate effect to attach the code to objects in the current scene. To "turn on" the code one enables one of the Behavior Evaluate persistent effect. These effects will execute the code attached to all elements in the scene every frame. BehaviorEdit can selectively disable code on any element or elements, so for instance if one had attached code to some dogs and cats but did not want to run the code which was attached to the cats, one would use BehaviorEdit to disable the code on the cats. When code is attached to an element one also specifies an order, which is a number from 0 to 1.0. Code with the lower order will be executed before code with a higher order. The code that you attach can consist of procedures, named after the various plugin entry points, namely: initBehavior, editBehavior, updateBehavior, cleanupBehavior and saveBehavior. Each such procedure will be evaluated at the appropriate time. For example the initBehavior procedures' code will be evaluated once, the first time that the attached code is evaluated. The updateBehavior procedures' code will be evaluated every frame, and so on. If none of these entry points is present in the attached code then ALL the attached code will be evaluated every frame (as update) The following are behaviors tutorials: |
|
copyright Video-Collage Inc. |