SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 16-07-2004, 01:31 AM   #1
suzanne
Registered User
 
Join Date: Jul 2004
Location: Vancouver
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default UI question

I am designing a simple user interface. I want user to input 2 separate float values, a text string, and select from a choice of 2 items. I want the window I create to behave like a `promptDialog ... ` but with the required embedded fields:
floatFieldGrp (2), textFieldGrp (1), and radioButtonGrp. I want execution of Mel script to stop until user presses "OK" button ... and then be able to query the inputs of the others fields entered and continue on ...

can a confirmDialog or promptDialog be embedded inside window command ?

How can I get Mel script to query field inputs and then close window ?

Here is some code ... but it doesn't do what I want ....
and its really a pain to do a series of `promptDialog ...` commands in order to get

all the info before Mel script continues.


---cut cut cut---

proc queryInput(string $posScaleField, string $distanceScaleField, string

$fileNameField, string $camSwField)
{
global float $posScale;
global float $distScale;
global string $fileName;
global int $camsw;

$posScale = `floatFieldGrp -q -v1 $posScaleField`;
$distScale = `floatFieldGrp -q -v1 $distanceScaleField`;
$fileName = `textFieldGrp -q -text $fileNameField`;
$camSw = `radioButtonGrp -q -select $camSwField`;

}


global proc mfExporter()
{
.
.
.

string $myWindow = `window -title "Export file" -rtf true`;
columnLayout;
string $posScaleField = `floatFieldGrp -label "position scale:" -v1 1.0`;
string $distanceScaleField = `floatFieldGrp -label "distance scale:" -v1 1.0`;
string $fileNameField = `textFieldGrp -label "input file name:"`;
string $camSwField = `radioButtonGrp
-numberOfRadioButtons 2
-label "Select camera type:"
-labelArray2 "Target" "Free"
-select 1`;
rowLayout -nc 2;
button -label "OK" -command "queryInput($posScaleField, $distanceScaleField,

$fileNameField, $camSwField)";
button -label "Cancel" -command "someExitProc()";

showWindow $myWindow;


----cut cut cut----

... if only button could behave like one from a promptDialog ???
suzanne is offline   Reply With Quote
Old 23-07-2004, 05:19 AM   #2
mark_wilkins
Registered User
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 161
Thanks: 0
Thanked 1 Time in 1 Post
Default

You're very close. Two things I notice: first, the names of the field groups need to be global variables to be accessible in the call to queryInput in the button command. Also, you should close the window in the queryInput proc.

There are an example or two of this in MEL Scripting for Maya Animators in the section on custom dialog boxes, by the way.

-- Mark
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com
mark_wilkins is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.