Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 08-02-2010 , 02:39 PM
I-Iybrid's Avatar
Simply Maya OG
Join Date: Dec 2002
Location: Queensbury NY, US A
Posts: 1,438

Adjusting transparency

As Im working on projects, I realized its a PITA to have to go into the material's properties, and adjust the transparency by hand. Is there an easier way to do this? Blendshape, MEL script, etc? Something that can be adjusted by a slider of some sort.

Its just annoying to have to change the transparency to something like 0.3, make a few adjustments according to my ref image, then go back in, and put it back to 0 once Im done..... thoughts?


- Hybrid
# 2 08-02-2010 , 05:16 PM
Lion`I's Avatar
Registered User
Join Date: Apr 2009
Posts: 136
Hi I-Iybrid, if i understand correctly u want 2 switch between a bit of transparency to full transparency with something easy to get 2 right

well i'm no expert but u can use the "Time Slider" by simply "set key" to the transparency attribute. frame 1 = 0 transparency, frame 5 = transparency 0.3

so just scratch over the Time Slider

Hope This Helps

user added image




Autume Challenge Nov 09


Moving Forward
# 3 08-02-2010 , 09:31 PM
I-Iybrid's Avatar
Simply Maya OG
Join Date: Dec 2002
Location: Queensbury NY, US A
Posts: 1,438
Never thought about key framing it.....good idea. I was hoping for more of a pop-up GUI window.... but the time slider idea would definately work.....


- Hybrid
# 4 08-02-2010 , 09:58 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Turn on and off X-ray mode. Under shading (I think) in the panel menu set.

# 5 09-02-2010 , 10:20 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Quick script I whipped together.

Code:
string $material = "lambert2";

global proc transSliderButton( string $HUD )
{
    undoInfo -swf true;

    float $value = `hudSliderButton -q -v $HUD`;

    setAttr ($material + ".transparency") -type double3 $value $value $value ;
}

hudSliderButton -s 5
                -b 5
                -vis 1
                -sl "Trans:"
                -value 0
                -type "float"
                -min -0
                -max 1
                -slw 50
                -vw 50
                -sln 100
                -bl "Close"
                -bw 60
                -bsh "rectangle"
                -brc "headsUpDisplay -remove HUDTransSliderButton"
                -sdc "transSliderButton( \"HUDTransSliderButton\" )"
                HUDTransSliderButton;


Imagination is more important than knowledge.
# 6 10-02-2010 , 03:53 PM
I-Iybrid's Avatar
Simply Maya OG
Join Date: Dec 2002
Location: Queensbury NY, US A
Posts: 1,438
NextDesign,

that script errors out on me. Says "$material" is an undeclared variable.

What am I doing wrong? lol


- Hybrid
# 7 10-02-2010 , 05:12 PM
ColdWave's Avatar
Registered User
Join Date: Sep 2006
Location: Bulgaria, Vidin
Posts: 1,310
The $material is defined outside the

"global proc transSliderButton( string $HUD )"

So it will not work ...

in the global... you must declare it

so the script will go like that

"


global proc transSliderButton( string $HUD )
{
string $material = "lambert2";

undoInfo -swf true;

float $value = `hudSliderButton -q -v $HUD`;

setAttr ($material + ".transparency") -type double3 $value $value $value ;
}

hudSliderButton -s 5
-b 5
-vis 1
-sl "Trans:"
-value 0
-type "float"
-min -0
-max 1
-slw 50
-vw 50
-sln 100
-bl "Close"
-bw 60
-bsh "rectangle"
-brc "headsUpDisplay -remove HUDTransSliderButton"
-sdc "transSliderButton( \"HUDTransSliderButton\" )"
HUDTransSliderButton;



I hope i helped user added image

# 8 11-02-2010 , 01:40 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Ah, sorry about that. Yes, paste this script into your script editor, change "lambert2" to the name of your material, but make sure to keep the quotes, grab that line, and paste it into the function, and run it.

Good catch mate.


Imagination is more important than knowledge.

Last edited by NextDesign; 11-02-2010 at 01:43 AM.
# 9 11-02-2010 , 01:48 AM
ColdWave's Avatar
Registered User
Join Date: Sep 2006
Location: Bulgaria, Vidin
Posts: 1,310
I tried it . It works just fine i'll use it too. I was looking for something like that ... user added image

# 10 11-02-2010 , 06:22 PM
I-Iybrid's Avatar
Simply Maya OG
Join Date: Dec 2002
Location: Queensbury NY, US A
Posts: 1,438
Thanks for the help, guys! Im JUST starting to get into MEL scripting, so when it errored out, I was like "ok...wtf do I do now?"

But yea, it works like a charm. Thanks for the script!

Quick question tho.... would it be possible to make that slider in a seperate window? So when you run the script, it opens up a new window, sort of like the blendshape editor.... If I knew more about scripting, I could do it myself. But...Im a putz when it comes to programming of any kind. Unless its Visual Basic...that I know ALITTLE of. lol


- Hybrid
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