Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   Adjusting transparency (https://simplymaya.com/forum/showthread.php?t=33734)

I-Iybrid 08-02-2010 02:39 PM

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?

Lion`I 08-02-2010 05:16 PM

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

:beer:

I-Iybrid 08-02-2010 09:31 PM

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

stwert 08-02-2010 09:58 PM

Turn on and off X-ray mode. Under shading (I think) in the panel menu set.

NextDesign 09-02-2010 10:20 PM

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;


I-Iybrid 10-02-2010 03:53 PM

NextDesign,

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

What am I doing wrong? lol

ColdWave 10-02-2010 05:12 PM

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 :)

NextDesign 11-02-2010 01:40 AM

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.

ColdWave 11-02-2010 01:48 AM

I tried it . It works just fine i'll use it too. I was looking for something like that ... :beer:

I-Iybrid 11-02-2010 06:22 PM

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


All times are GMT. The time now is 02:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018