vcanim.gif (8357 bytes)SW_elementAttachBehavior
Home ] Sales ] Products ] Services ] Support ] Downloads ]

 

 


SW_elementAttachBehavior

A library function which attaches a TCL script (behavior) to an element.

package require SW

SW_elementAttachBehavior elementID execOrder execState behaviorScript [ sceneID ] [ fcurves fcState ]

elementID
The element to which a script will be attached.
execOrder
A real number from 0 to 1 which defines the order of execution of the attached tcl scripts. For example, 0.23 would execute before 0.37.
execState
Allows you to enable or disable the attached tcl script. If the execState is 0, then the Behavior Evaluator will not execute the attached TCL script. If the execState is 1, then the Behavior Evaluator will execute the attached TCL script.
behaviorScript
TCL script which will be attached to the element. This is ascii text.
sceneID (optional)
The scene in which the element occurs. This is an optional parameter. If it is missing then the current scene is the default.
fcurves  (optional)
The list of selected Fcurves  which will be attached to the element. For example, {scalx scaly scalz etrnx etrny etrnz}
fcState  (optional)
Allows you to enable or disable the attached selected Fcurves. If the fcState is 0, then the Behavior Evaluator will not execute the attached Fcurves. If the fcState is 1, then the Behavior Evaluator will execute the attached Fcurves.
 
 

Return Value

There is no return value if function succeeds. If an error condition occurs, the return value will be a descriptive string message giving information about the error.

Example

Attach simple TCL to model sphere1. 

set elementID [SW_name2Element sphere1 $curSceneID]
Elem2
set script {
set name [SWB_getCurrentElementName]
puts "Hello World! I am $name"
}
set name [SWB_getCurrentElementName]
puts "Hello World! I am $name"
SW_elementAttachBehavior $elementID 0.1 1 $script
 

Behaviors Overview ] Behavior Evaluate ] Behavior Edit ] Debugger ] Console ] Find ] SAA Library ] SW library ] SWC library ] SWN library index ] SWU library ] Attributes Index ] Scripting Examples ]

copyright Video-Collage Inc.