Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 23-02-2004 , 09:28 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695

trying to learn

I'm trying to learn to write my first tool, using other people's tools as a reference as well as the docs. I want to add a slider and the docs tell me to "see the "UI: Controls" section of the Command List by Function. "

This is where I feel very stupid, but I cannot find a section in the docs called "Command List by Function". I searched all throughout, but nothing! I searched the MEL Command reference, but there is nothing in there about UI: Controls either.

Help?!?

Thanks.

# 2 23-02-2004 , 10:42 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
OK, I found it eventually. I'm not sure where "UI:Controls" are listed, but I did find the attrFieldSliderGrp so I'm getting close.

I'm have 2 problems now.

1.) How do I get rid of the texture button next to my slider? My command is:
attrFieldSliderGrp -label "Film Offset Horizontal" -min -1.0 -max 1.0 -at $xOffset;

I'm rtying to make a reset button that conrtols 3 variables, but I can't figure out the syntax. How do I get to to work for something like:
button -l "Reset Camera" "setAttr $xOffset 0, setAttr $yOffset 0, setAttr $overscan 1.2" ;

Thanks.
-dann


Last edited by Dann; 23-02-2004 at 10:49 PM.
# 3 24-02-2004 , 02:52 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
what they heck, here is the actual script in case you wish to play. Feel free to use it and share it if you get it working (or even if you don't)

Attached Files
File Type: mel filmoffset.mel (3.6 KB, 168 views)
# 4 24-02-2004 , 06:52 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
From what I can see you need to add another function to reset the values e.g.

global proc reset()
{
setAttr $xOffset.horizontalFilmOffset 0;
setAttr $yOffset.verticalFilmOffset 0;
}

The only problem you will have is that $xOffset and $yOffset arent visible to this function as they are declared "in scope". So I would declare them as global or outside of that scope (or you will have to pass them in as params). That way it will work. I would also save off the users initial settings into variables and give them the option of restoring them rather than going back to 0.

One thing I should point out is that your variable names for the camera re really bad. I wouldn't bother with $xOffset and $yOffset (or at least change their names cause they are confusing user added image)

Hope this helps a bit.

Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 5 24-02-2004 , 08:00 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks Alan,

Helps a bit, but you confused me a bit.
"So I would declare them as global or outside of that scope " What does this mean, and how do i do it?

Also, how would I "save off the users initial settings into variables"?


Last edited by Dann; 24-02-2004 at 10:40 PM.
# 6 25-02-2004 , 12:33 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
When you "scope" a variable you enclose it in curly brackets (like those used for a function). What that means is that that variable can only be seen inside of that scope. However if you declare it outside of that scope then it can be used inside of that scope and outside. It basically allows you to have private variables within a function that can't be modified by any other function directly (you would have to pass them through as a param).

To save off the inital settings just use a getAttr on the variable and save it user added image

Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 7 25-02-2004 , 04:38 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
When I try decalring the variable outside the brackets, I get erros saying the variable is not defined. Someone else just told me that global variables are BAD anywhay, and I shouldn't use them. He didn't elaborate.

# 8 25-02-2004 , 04:51 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
they're not bad what he means is that they can be modified by any function (which isnt necessarily a bad thing, but can be). You're only option then is to pass them as parametres or get the value locally and modify it / set it there.

Hope that helps


Technical Director - Framestore

Currently working on: Your Highness

IMDB
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads