Maya Training

Creating characters In Maya and Zbrush

Maya Training

Creating character renders in Maya 2017 and Arnold

Maya Training

Spach-Alspaugh House the complete courseware
You are here > Home > SimplyMaya Community Forums

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 16-07-2004, 02:31 AM   #1
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`;
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, 06:19 AM   #2
Registered User
mark_wilkins's Avatar
Join Date: Jan 2003
Posts: 161
Thanks: 0
Thanked 1 Time in 1 Post

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
mark_wilkins is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2017 SimplyMaya - vBulletin® Copyright © 2000-2017, Jelsoft Enterprises Ltd.