SimplyMaya Forums

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

Home / forum / Animation / Mel Scripts & Programming / Custom UI Help Please
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 22-03-2004, 12:15 AM   #1
Tattrpuff
Registered User
 
Join Date: Dec 2003
Location: Nebraska
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom UI Help Please

Hi I"m not good at all at Mel, and I can't figure this out. I want to make a script for this loop:

int $f;

for ($f = 1; $f <= 10; $f++) { currentTime $f; shaveWriteRib -frame $f ("c:\\file." + $f + ".rib"); }

and run it through this UI:

window -height 90 -title "RibWriter" -width 370; rowLayout -columnWidth4 80 100 100 80 -enable on -height 64 -numberOfColumns 4 -visible on -width 362; text -enable on -height 17 -label "Frames" -visible on -width 80; intField -editable on -enable on -height 23 -maxValue 1000 -minValue 1 -visible on -width 100; button -height 28 -label "Rib It" -width 80;

showWindow;

What I want is to use this UI to select the amount of frames to export. But I only know the loop and have no Idea how to write the script to run it off of that UI, I realize this might not get me any where but I"m having a hard time with this. Thanks!
Tattrpuff is offline   Reply With Quote
Old 22-03-2004, 12:53 AM   #2
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

You need to wrap your loop in a procedure and then call that procedure from the button in your UI. The procedure would be something like this:

Code:
global proc myShaveWriteProcedure()
{
   insert loop here...;
}
The button would then get an extra flag:

Code:
button -c "myShaveWriteProcedure";
The window script will also need to be put into a procedure:

Code:
global proc myShaveWindow()
{
   window stuff here...'
}
Save all this in a called myShaveWindow.mel and then you can run "myShaveWindow" from within Maya to bring up the window.
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 22-03-2004, 02:13 AM   #3
Tattrpuff
Registered User
 
Join Date: Dec 2003
Location: Nebraska
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well that got me alot further, than I would of gotten, thanks. Here is my new script, but I don't seem to have the float field connected to the amount of frames, here it is:

global proc myShaveWriteProcedure()
{
int $f;

for ($f = 1; $f <= 1000; $f++) { currentTime $f;
shaveWriteRib -frame $f ("c:\\file." + $f + ".rib"); }

}

global proc myShaveWindow()
{

window -height 90 -width 320;
rowLayout -columnWidth3 80 100 80 -height 64 -numberOfColumns 3 -width 312;
text -height 17 -label "Frames" -width 80;
floatField -height 23 -maxValue 1000 -minValue 1 -value 1 -width 100;
button -command "myShaveWriteProcedure" -height 28 -label "Rib It" -width 80;
}
showWindow;
Tattrpuff is offline   Reply With Quote
Old 22-03-2004, 02:30 AM   #4
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

You need to query the value from the floatField and then pass that value into your loop procedure. A couple of things to get you going in the right direction:

Querying the floatField's value and assigning it to a variable:

Code:
$frame = `floatfield -q -value fieldName`
Using the value in your loop procedure:

Code:
myShaveWriteProcedure($frame);
And declaring the procedure:

Code:
global proc myShaveWrite{$frame)()
{
   using $frame somehow...;
}
This might not be super accurate, but this, along with the MEL help files, should get you going in the right direction.
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 22-03-2004, 02:57 AM   #5
Tattrpuff
Registered User
 
Join Date: Dec 2003
Location: Nebraska
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I really don't know how to do this I guess I'll have to learn it, which I should of do first, so thanks for all ur help!
Tattrpuff 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.