Material Change...Save
I'm trying to write a script that will change the color of a material and save it off into a new JAS. Here's what I have so far, but Cheetah just closes due to something it disagrees with in my script:
This is in my "scripts/Macros" directory, as that seems to have some meaning.
ANY help would be greatly appreciated.
Also, will new documents for scripting be coming?
Thanks
I'm trying to write a script that will change the color of a material and save it off into a new JAS. Here's what I have so far, but Cheetah just closes due to something it disagrees with in my script:
Code:
function main(doc) {
//get path for file
var path=OS.runSavePanel("jas");
if (path==null) {
return;
}
// find the "CommandColor"
for(mat_indx=0;mat_indx < doc.materialCount(); ++mat_indx) {
var mat=doc.materialAtIndex(mat_indx);
if (mat.getParameter("name") == "CommandColor") {
break;
}
}
// i assume red, green, blue
var colors = Array(Vec4D(255,0,0,0), Vec4D(0,255,0,0), Vec4D(0,0,255,0));
for (color_indx= 0; color_indx < 3; ++color_indx) {
mat.setParameter("color", colors[color_indx], false);
doc.saveToFile(path,"file" + color_indx + ".jas");
}
}
This is in my "scripts/Macros" directory, as that seems to have some meaning.
ANY help would be greatly appreciated.
Also, will new documents for scripting be coming?
Thanks