LinchpinZA
03-28-2011, 05:09 PM
Hey guys.
I am a real newbie at scripting so excuse my stupidity. But basically I'm trying to create a script that creates a 2d ramp texture with a specified amount of color entries all evenly spaced.
So running the script with say a specified value of 300, would create a ramp texture with 300 colors , all evenly spaced (1/300 etc).
at the moment my script looks like this..
//////////////////////////////////////////////
{
createNode ramp -n "rampSpecial"
int $i;
for ($i = 0; $i<300; $i++) {
float $d = 1/300;
for ($d = 0; $d<1; $d++) {
setAttr ("rampSpecial"+".colorEntryList["+$i+"]"+".position"+$d+);
}
}
///////////////////////////////////////////
I'm currently getting a syntax error with the last line.
What I'm trying to do here is input an integer that counts from 1 to 300 in place of the colorEntryList value, and then the $d is my attempt at trying to evenly space the color entry values by inputting it into the ".position" input.
I'm not even sure if it's only my syntax that is wrong or whether its the way I'm trying to create more color entries which is incorrect aswell.
As you can tell I'm pretty clueless and I'm sure it may make some of you /ignore this post completely :p. But I would very much appreciate some help here, I know this is probably a really simple script to make.
Thanks,
Chris.
I am a real newbie at scripting so excuse my stupidity. But basically I'm trying to create a script that creates a 2d ramp texture with a specified amount of color entries all evenly spaced.
So running the script with say a specified value of 300, would create a ramp texture with 300 colors , all evenly spaced (1/300 etc).
at the moment my script looks like this..
//////////////////////////////////////////////
{
createNode ramp -n "rampSpecial"
int $i;
for ($i = 0; $i<300; $i++) {
float $d = 1/300;
for ($d = 0; $d<1; $d++) {
setAttr ("rampSpecial"+".colorEntryList["+$i+"]"+".position"+$d+);
}
}
///////////////////////////////////////////
I'm currently getting a syntax error with the last line.
What I'm trying to do here is input an integer that counts from 1 to 300 in place of the colorEntryList value, and then the $d is my attempt at trying to evenly space the color entry values by inputting it into the ".position" input.
I'm not even sure if it's only my syntax that is wrong or whether its the way I'm trying to create more color entries which is incorrect aswell.
As you can tell I'm pretty clueless and I'm sure it may make some of you /ignore this post completely :p. But I would very much appreciate some help here, I know this is probably a really simple script to make.
Thanks,
Chris.
