aa_setColor
/*
***************************************************************************
This is a function that will create a new shader group based on red, green, blue and transparency, and
assign that shader to an object. The function returns the name of the new shader group.
aa_setColor(string $object, string $type, float $r, float $g, float $b, float $t)
example:
//This example creates a shader of type 'lambert' with 4. red, .4 green, .4 blue
(which would make gray) and .2 transparency (1 is fully transparent).
//create object
sphere -name sphere1;
aa_setColor("sphere1","lambert",.4,.4,.4,.2);
copyright
Cory Clarke cory@nthd.org
***************************************************************************
*/
global proc string aa_setColor(string $object, string $type, float $r, float $g, float $b, float $t){
$color = `createRenderNodeCB -asShader "surfaceShader" $type ""`;
//check if color create worked
if($color != ""){
//add the name and the word '.color' to the end
$attribute = $color + ".color";
//set the attribute .color
setAttr $attribute -type double3 $r $g $b;
//add the name and the word '.transparency' to the end
$attribute = $color + ".transparency";
//set the attribute .transparency
setAttr $attribute -type double3 $t $t $t;
//add the name and 'SG'
$sgword = $color + "SG";
//assign the color
sets -e -forceElement $sgword $object;
}
return $color;
}
print("aa_setColor....loaded\n");
There are no threads for this page.
Be the first to start a new thread.