Adverti horiz upsell
Iteration thru a script
Iteration thru a script
throb, added 2006-05-19 07:52:57 UTC 14,088 views  Rating:
(1 rating)
Page 1 of 1

This very quick tutorial goes into a little more bits than Frank's excellent set. Kudos to Frank!

let's say you want to do certain things to a certain node type...
for instance, you want to change blurs only...

foreach $mynode [nodes] {
if {[class $mynode] == "Blur"} {
knob $mynode.size 10
}
}

This will iterate through the entire script, find all the nodes of type Blur and change their size to 10.
Now, if you want to find out the class of a node, this command does it:
class [selected_node]

if you want to take all the blur nodes and set their input to a specific read do this:

foreach $mynode [nodes] {
if {[class $mynode] == "Blur"} {
input $mynode 0 Read1
}
}

But Uncle Throbby, how do i use this with multiple input nodes??!?!
Well, captain...here it is..simple!

foreach $mynode [nodes] {
if {[class $mynode] == "Merge"} {
input $mynode 0 Read1
input $mynode 1 Read2
}
}


Ok, it's late...enough nerding for me!