PDA

View Full Version : MEL scripting problem


Jozvex
02-26-2003, 06:16 AM
Hi guys,

I've been trying (for about 2-3 hours) to make myself a script that'll open up a colour palette for changing the perspective camera's environment colour. Unfortunately I got 90% of the way there in 10 minutes, but keep getting the same error no matter what I do. Here's the script:

_____________________________________________

float $chosenEnvColour[];

colorEditor;

if (`colorEditor -q -result` > 0)
{
$chosenEnvColour = `colorEditor -q -rgb`;
setAttr perspShape.backgroundColor -type double3 chosenEnvColour;
}

else
print "Colour was cancelled";
________________________________________________

The error I get it:

// Error: Error reading data element number 3: //

But, if I use 'print' to print the 'setAttr' line out it gives the right command to change the colour, because you can copy it and run it from the command line.

Any help would be very much appreciated! :hmm:

wrend
02-26-2003, 06:42 AM
heya jozvex,
unfortunately you cant just dump the array there, you need to split it into the components:

setAttr perspShape.backgroundColor -type double3 $chosenEnvColour[0] $chosenEnvColour[1] $chosenEnvColour[2] ;

bit of a poo aye!

bit of poo, too, that you cant use vector arrays like:

cube.ty = $vect[8].y;

whereas cube.ty = $vect.y; (non array vector), does work.

anybody get this too? :(

Jozvex
02-26-2003, 06:50 AM
Thanks Wrend, but I actually already tried that before and doing it that way always sets the colour to white no matter what colour you choose!

It's very strange!

Jozvex
02-26-2003, 06:52 AM
Aha!

Doing it your way splitting it up works if you change the query to rgb instead of hsv!

Strange, but at least it works!

CGTalk Moderation
01-14-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.