PDA

View Full Version : New to scripting


fusedgore
07-15-2009, 04:13 AM
HI .First i am new to scripting and i had a few questions .When coding mel scripts i know you can put all your tools into a window like the code below .But my question is how do i change like the backround color of the window ,or add like a logo to the window .Or would it be possible to actually make the window outline like animated by changing colors .



This was a script i did for myself to launch cs2,cs3 and zbrush .I tried hilighting my problem areas .Thanks allot .I also been looking at the autodek help website and documentation but cant really seem to figure it out .


Also can someone point me in a direction to learn some advanced MEL or would it be better to move onto Python .

Thanks Allot


// Application designed to intergrate workflow by launching Applications of
//zbrush,cs2,cs3
proc launchProgram(int $choice){

if ($choice == 1)
{
system("start C:/Program Files (x86)/Adobe/Adobe Photoshop CS2/Photoshop.exe" ); //Launch Photoshop CS2
}
if ($choice == 2)
{
system("start C:/Program Files (x86)/Adobe/Adobe Photoshop CS3/Photoshop.exe " ); // Launch Photoshop CS3
}
if ($choice == 3)
{
system("start C:/Program Files (x86)/Pixologic/ZBrush3/ZBrush3.exe" ); //Launch Pixologic Zbrush
}
}


// Makes The Window
string $window = `window -rtf true -
title "External Workflow Widget By Shaun Keenan"
-bgc 0.5 1.0 _ this line dont seem to work - i am guessing this is for the button backround color ?
-sizeable 0
-widthHeight 100 200`;


// Define The Layout Of The Buttons In The Window

rowColumnLayout -numberOfRows 2
-rowHeight 1 50
-rowHeight 1 100;

symbolButton -image "cs2.xpm" -c "launchProgram(1)"; text -label "Launch Photoshop cs2";

symbolButton -image "cs3.xpm" -c "launchProgram(2)"; text -label "Launch Photoshop cs3";
symbolButton -image "ZBrush.xpm" -c "launchProgram(3)"; text -label "Launch Pixologic ZBrush";


showWindow $window;

Robert Bateman
07-15-2009, 10:27 AM
you need 3 colour values, 0 to 1, for the -bgc flag

fusedgore
07-15-2009, 03:38 PM
So it would be like


// Makes The Window
string $window = `window -rtf true -
title "External Workflow Widget By Shaun Keenan"
-bgc 0.5 1.0 1.1_ this line dont seem to work - i am guessing this is for the button backround color ?
-sizeable 0
-widthHeight 100 200`;


Because i have tried this and it still doesnt work .


Also if you guys could point me in a direction to really dive into MEL and learn it that would be great

ftaswin
07-16-2009, 04:38 AM
-bgc flag works well if you define your colors as variables:

$r = 0.1;
$g = 1;
$b = 0.6;

window -bgc $r $g $b

davegreenwood
07-16-2009, 06:01 AM
Hi, this is a Windows only flag... it doesn't work on osx or linux, could that be the problem?
Dave

Robert Bateman
07-16-2009, 03:21 PM
Hi, this is a Windows only flag... it doesn't work on osx or linux, could that be the problem?
Dave

Thought that, but judging by the executable paths in the system commands, he's on windows. By the sounds of it, it's just not parsing the command.


Because i have tried this and it still doesnt work .

1.1 is not a value between 0 and 1. Not sure why you're an underscore in the value either (1.1_ ). Use a valid floating point number and it will work.


// Makes The Window
string $window = `window -rtf true -
title "External Workflow Widget By Shaun Keenan"
-bgc 0.5 1.0 1.0
-sizeable 0
-widthHeight 100 200`;

IIRC, setting the bgc flag on the window doesn't do much - so set it on the rowColumnLayout as well

fusedgore
07-16-2009, 04:32 PM
ha ha bingo it worked .Yes thanks allot .Few more questions for you guys .Is there a way to like change the title bar color or like the window outline bar color , is well and is there a way to like play a sound when you press a button .I been looking through the maya help commands and since i am a beginner i either and to new to figure it out or just to well idk .



And any tips on learning MEL or places i can find some good resources for learning cause you guys seem to know allot .


Thanks

efecto
07-16-2009, 10:54 PM
It's right here. Read all threads you can.

ha ha bingo it worked .Yes thanks allot .Few more questions for you guys .Is there a way to like change the title bar color or like the window outline bar color , is well and is there a way to like play a sound when you press a button .I been looking through the maya help commands and since i am a beginner i either and to new to figure it out or just to well idk .



And any tips on learning MEL or places i can find some good resources for learning cause you guys seem to know allot .


Thanks

CGTalk Moderation
07-16-2009, 10:54 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.