1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
[
set tok [split $OBJPATH |]
set tnode [lindex $tok end-1]
set scale [mattr $tnode.size $F]
set n [clientcmd "polyEvaluate -v $tnode"]
set n [lindex $n 0]
set out ""
# Setup the initial definition of the blobby
append out "Blobby $n \[\n"
# Make each an ellipsoid and provide its arry index
# The array indices monotonously increment by 16
for {set i 0} {$i < $n} {incr i} {
append out "1001 [expr $i * 16]\n"
}
# Specify the blending code "0" and the
# number of blobs to blend
append out "0 $n "
# Followed by a list of the indices from the first
# to the last blob
for {set i 0} {$i < $n} {incr i} {
append out " $i"
}
append out "\]\n"
# Now specify the transformations of each blob
append out "\[\n"
# Lock the random number generator
expr srand(1)
for {set i 0} {$i < $n} {incr i} {
set str $tnode
append str ".vtx\[$i\]"
set pnt [clientcmd "pointPosition -local $str"]
set size [expr $scale + rand() * 0.4]
set blobdata "$size 0 0 0 0 $size 0 0 0 0 \
$size 0 $pnt 1\n"
append out $blobdata
}
append out "\]\n"
append out "\[\"\"\]"
append out "Opacity 0 0 0\n"
return $out
]
|