// Malcolm Kesson
// Useage:
// addArnoldIntAttr("map_id", 0, 8);
// Adds a attribute to the shape with the name "mtoa_constant_map_id"
// In an .ass file the attribute would appear as,
//
// declare map_id constant INT
// map_id 2
//
//
global proc addArnoldIntAttr(string $name, int $min, int $max) {
string $sel[] = `ls -sl`;
int $value;
$name = "mtoa_constant_" + $name;
$max += 1;
for($current in $sel) {
string $shapes[] = `listRelatives -s $current`;
string $shape = $shapes[0];
if(size($shape) == 0)
continue;
if(attributeExists($name, $shape) == 0) {
addAttr -at short -ln $name -sn $name -nn $name -k 1 $shape;
}
$value = rand($min, $max);
setAttr ($shape + "." + $name) $value;
print("Added int attribute \"" + $name + "\" with a value of " + $value + "\n");
}
}
// Useage:
// addArnoldIntAttr("map_id", 0, 8);
// Adds a attribute to the shape with the name "mtoa_constant_map_id"
// In an .ass file the attribute would appear as,
//
// declare map_id constant INT
// map_id 2
//
//
global proc addArnoldIntAttr(string $name, int $min, int $max) {
string $sel[] = `ls -sl`;
int $value;
$name = "mtoa_constant_" + $name;
$max += 1;
for($current in $sel) {
string $shapes[] = `listRelatives -s $current`;
string $shape = $shapes[0];
if(size($shape) == 0)
continue;
if(attributeExists($name, $shape) == 0) {
addAttr -at short -ln $name -sn $name -nn $name -k 1 $shape;
}
$value = rand($min, $max);
setAttr ($shape + "." + $name) $value;
print("Added int attribute \"" + $name + "\" with a value of " + $value + "\n");
}
}