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

 

 


SWN_do

SWN_do varName pattern code

varName
a variable which appears in the code parameter. The code will be evaluated with this variable being replaced by each of the elements which pattern matches.
pattern
a pattern which selects the elements whose names will be substituted for varName in the code
code
code which will be evaluated once for each element whose names matches the specified pattern. The elements name will replace varname within this code during one of the evaluations.

SWN_do performs the specified code one time for each element whose name the pattern represents. The name of each element is substituted for the varName when the code is evaluated. If we had a scene which had 2 elements whose names started with "card", namely card1 and card2, for example:

package require SWN
package require SW
.
.
.
SWN_pre
.
set scaleFactor 2.7
.
.
SWN_Do i card* {
regexp {([a-z]+)([0-9]+)} $i junk alphaJunk num
SW_expression "$i.etrnx = baseCard.etrnx + $scaleFactor * (Fc / $num)"
}

would evaluate the code passed as the last parameter to SWC_do twice, once with card1 substituted for i, like this:

regexp {([a-z]+)([0-9]+)} card1 junk alphaJunk num
SW_expression "card1.etrnx = baseCard.etrnx + $scaleFactor * (Fc / $num)"

and once with card2 substituted for i, like this:

regexp {([a-z]+)([0-9]+)} card2 junk alphaJunk num
SW_expression "card2.etrnx = baseCard.etrnx + $scaleFactor * (Fc / $num)"

When the code one is evaluating using SWN_do makes SAA calls or one must reference elements directly (not by name) use SWN_name2element.

Currently only models are represented by patterns.


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.