Script using "polyColorPerVertex"?

Script using "polyColorPerVertex"?

Anonymous
Not applicable
418 Views
2 Replies
Message 1 of 3

Script using "polyColorPerVertex"?

Anonymous
Not applicable
I came up with the following Code to allow me to Select Objects in the scene and colour them in the same fashion as 3ds Max - but it is not working correctly.



//put selected objects into array
string $IF_Object[] = `ls - sl`;
//Loop through each object selected and colour it
for ($x=0; $x<size($IF_Object); $x++)
{
select $IF_Object;
polyColorPerVertex -rgb `rand 0 1` `rand 0 1` `rand 0 1` -cdo ;
}



It only works if I manually select the objects with the mouse and then run the script.

I added the following line at the start of the script:

select -all;


When run on its' own, the above line does select everything in the scene but when added into the script at the top it does not work at all!!!

I'm closer but not there yet!!!

Any help with this would be greatly appreciated.

Later...
0 Likes
419 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
//put selected objects into array
string $IF_Object[] = `ls -typ "mesh"`;
//Loop through each object selected and colour it
for ($x=0; $x<size($IF_Object); $x++)
{
polyColorPerVertex -rgb `rand 0 1` `rand 0 1` `rand 0 1` -cdo $IF_Object;
}
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks for clearing up my lack of knowledge.

This now does exactly what I needed.

Much obliged...
0 Likes