Ok, but why on earth would you make many shaders since they all share common parts its way easier to just use a shading swich instead. But yes if you insist.
the second the R value, G, and then B
i assume the rgb values are somekind of integers in range of 256? Maya measures values in float.
{
string $fileName = "c:/temp/test.csv";
int $fileId = `fopen $fileName "r"`;
string $line = `fgetline $fileId`;
while ( size( $line ) > 0 )
{
string $buffer[];
tokenize $line "," $buffer;
string $name = `shadingNode -name ($buffer[0]) -asShader lambert`;
string $set = `sets -renderable 1 -noSurfaceShader 1
-empty -name ($name+"SG")`;
connectAttr -f ($name+".outColor") ($set+".surfaceShader");
for ($attrib in {"color","ambientColor","incandescence"})
{
// convert form 8 bit color to float
// is that wasnt your intention remove /255
setAttr ($name+"."+$attrib) -type double3 ((float)$buffer[1]/255)
((float)$buffer[2]/255)
((float)$buffer[3]/255);
}
$line = `fgetline $fileId`;
}
fclose $fileId;
}
color, ambient, and incandescence per shader.
why then use lambert? I mean surface shader is faster to calculate.
PS: why not use python its cleaner