PDA

View Full Version : proc problems


fred45
04-29-2003, 10:20 AM
this is my code crazy I'm sure but thats probably why I'm here i will explain what I'm trying to do at the end of the thread. Thanks

global proc buildLLwin ( string $win)
{

string $LocLabel = "Location";
int $postNUM = 0;
string $flip = `rotate -r 0 180 0`

global float $Pos75;
$Pos75 = 7.5;
global float $Neg75 = -7.5;
global float $Pos165 = 16.5;
global float $Neg165 = -16.5;
global float $Pos255 = 25.5;
global float $Neg255 = -25.5;

//clear $Sel_Set;

window -t "Location! Location!" $win;

columnLayout;

rowColumnLayout -nc 2;

button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws $Neg255 0 $Neg75");
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws $Neg165 0 $Neg75");
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws $Neg75 0 $Neg75");
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws $Neg75 0 $Neg165");

//Across the road the building must be rotated 180 degrees

button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws $Neg255 0 $Pos75; $flip;");

button -l "Close" -c ("deleteUI " + $win);

}

Maya doesn't think that $Neg75 is a variable this I believe is because the command in the button is being called externally and the variable doesn't exsist outside the proc.(maybe??) This I tried to fix by making the variables global but maya tells me I'm not aloud to do this! And now my brain is fryed and I everything I thought I knew I don't please help me from running backwards. Thanks

Matthew Blair
Student
CGC Melbourne

alexx
04-29-2003, 10:57 AM
if that is the copied source code, you are missing a ";"
at the end of line:
string $flip = `rotate -r 0 180 0`


cheers

alexx

Carina
04-29-2003, 11:39 AM
("move -a -ws $Neg255 0 $Neg75");

doesn't deal with $Neg255 and $Neg75 as variables.. as you put it there they're just part of the string.

alexx
04-29-2003, 11:53 AM
oups :)

did not even look that far..

to get what carina pointed out you need to use the variables in the following way:

yours:
("move -a -ws $Neg255 0 $Neg75");

take this way:
("move -a -ws "+$Neg255+" 0 "+$Neg75);

cheers

alexx

Carina
04-29-2003, 12:33 PM
suppose i could've been more helpful and supplied that as well.
:D

fred45
04-29-2003, 12:36 PM
Thanks heaps problem solved. Here is the fixed code....but there is a new problem again I'll write it at the bottom. Thanks again

global proc mbLL ()

{

// create the window

string $win = "LLwin";

if (`window -exists $win`)

deleteUI $win;



buildLLwin $win;

showWindow $win;



}


global proc buildLLwin ( string $win)

{
string $LocLabel = "Location";
int $postNUM = 0;

string $flip = `rotate -r 0 180 0`;

float $Pos75 = 7.5;
float $Neg75 = -7.5;
float $Pos165 = 16.5;
float $Neg165 = -16.5;
float $Pos255 = 25.5;
float $Neg255 = -25.5;

window -t "Location! Location!" $win;

columnLayout;

rowColumnLayout -nc 2;

button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg255 + " 0 " + $Neg75);
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg165 + " 0 " + $Neg75);
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg75 + " 0 " + $Neg75);
button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg75 + " 0 " + $Neg165);

// button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg255 + " 0 " + $Pos75, "$flip");

button -l "Close" -c ("deleteUI " + $win);
}

button -l ($LocLabel + ($postNUM++)) -c ("move -a -ws " + $Neg255 + " 0 " + $Pos75, "$flip");

This line doesn't work. The flip variable at the end is trying execute a rotate command this is so I don't need to write the whole rotate command again and again and so I can edit the variable and change everything through the script. Thanks again.

btw - I am using this tool for layout on a city scene at school. One of the shots requires me to show the whole city as the camera pulls back and up to a bird. We are really pushed to meet our deadline I am trying to build some tools help automate and layout of the city shopfronts and highrises. Any input on such a task I would greatly appreicate. Thanks

Matthew Blair
Student
CGC Melbourne Australia

fred45
04-29-2003, 12:45 PM
:wavey: Nice web page Carina I'm a big Pooh fan nice models

Carina
04-29-2003, 01:04 PM
Quick glance at the problematic code.. it's the same problem as before, "$flip" treats it $flip as a string, not a variable. Try changing it to $flip without the "".

And, thanks, glad you like it.:)
I'm not going to say what I misread your post as though.
:surprised

Sorry, I can't help much with the automation stuff you were asking about.. although I've been programming for years, I've only just started playing with MEL.

fred45
04-29-2003, 01:26 PM
Sorry I should have been a little more specific. the $flip variable is another command all together do you know how to seperate the commands from each i.e. the move from the rotate. I've tried using a ; and , thanks.

alexx
04-29-2003, 01:58 PM
since maya behaves a but confusing when attaching longer commands to buttons like you try to do i would recommend writing a procedure for the call.

then just call the procedure and pass your variables to it.

e.g.

global proc myHelper ($neg255, $neg75, $flip, ...)

cheers

alexx

CGTalk Moderation
01-15-2006, 01:00 AM
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.