Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 16-07-2004 , 01:31 AM
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9

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

# 2 23-07-2004 , 05:19 AM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161
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
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