Beer glass scene creation
This course contains a little bit of everything with modeling, UVing, texturing and dynamics in Maya, as well as compositing multilayered EXR's in Photoshop.
# 1 10-08-2004 , 12:32 PM
mumbojumbo_13's Avatar
Subscriber
Join Date: Oct 2002
Location: The Land Down Under
Posts: 1,047

MEL scripting for maya animators help

hey i've been doing the book's crowd system
got to page 393 trying to creat the dialogue box i used this code:

//Interface

global proc crowdSystem()
{

window
-title "Crowd System"
-widthHeight 300 200
crowdWin;

//Create button
string $button1 = `button -label "Create"`;

//Place button in window
formLayout -edit
-attachForm $button1 "bottom" 10
-attachForm $button1 "right" 10
formLayout;

//Add command to button to call createCrowd function and
//then kill window after script has been executed

button -edit -command ("createCrowd; deleteUI crowdWin;") $button1;

showWindow crowdWin;

}
(copyright user added image )
but it doesn't show the window? ? ?
i using maya 5 did they change anything ?


Thanks for wasting your time reading this line.
# 2 10-08-2004 , 03:37 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
no copy of maya in front of me but as far as I know the window stuff is the same.

Try it outside of the function and see if that works, maybe it needs this stuff to be global (but that's unlikely). Just to check, you are calling the function once you've written right? (Sorry i just want to check every possibility! user added image)

user added image
Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 3 10-08-2004 , 10:18 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I don't own this book so I can only guess.... To me it looks like this procedure isn't going work alone. Looks like there's more to this script than just this procedure.


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 4 15-08-2004 , 05:34 AM
mumbojumbo_13's Avatar
Subscriber
Join Date: Oct 2002
Location: The Land Down Under
Posts: 1,047
ok ive been playing round with it and i now got thie error:
"objects name not unique"
i couldn't find anything on it maya doesn't have an error list like delphi does it?
anyone know what the error means??
thanks
mumbo


Thanks for wasting your time reading this line.
# 5 15-08-2004 , 12:55 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
if you run it more than once and you dont delete the window prefs it will keep it in memory. You need to delete the window prefs but I can't remember the syntax at them moment. I will post it tomorrow when I am at work

Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 6 15-08-2004 , 11:06 PM
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9
try inserting this statement at start of proc :

if (`window -exists crowdWin` == true)
deleteUI crowdWin;

BEFORE you define crowdWin in this statement:

window
-title "Crowd System"
-widthHeight 300 200
crowdWin;

# 7 16-08-2004 , 12:15 PM
mumbojumbo_13's Avatar
Subscriber
Join Date: Oct 2002
Location: The Land Down Under
Posts: 1,047
ok thanks
you two ill work on it
much appreciated


Thanks for wasting your time reading this line.
# 8 16-08-2004 , 01:17 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
if ( `window -exists myWindow` )
deleteUI -window myWindow;

if(`windowPref -ex myWindow`)
windowPref -remove myWindow;

Try these these are what I used when I had a similar problem

Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 9 16-08-2004 , 04:50 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
what book are you referring to?

# 10 17-08-2004 , 01:11 AM
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9
Hey Dann,

I wasn't the original poster here ... but I'm pretty sure the book is "MEL Scripting for Maya Animators" by Mark R. Wilkins & Chris Kazmier ... Morgan Kaufmann publisher

mumbojumbo_13 was referring to example in CH 18

I believe one of the authors posted a resonse to my UI question and I forgot to thank him (Thanks !)

... the book is really good and I only know of 1 other that covers Mel in any depth. That is Complete Maya Programming by David Gould also Morgan Kaufman ... includes both Mel and Maya API.

Cheers

# 11 18-08-2004 , 11:39 AM
mumbojumbo_13's Avatar
Subscriber
Join Date: Oct 2002
Location: The Land Down Under
Posts: 1,047
thanks pure, suzanne
got it all working with window and all user added image


Thanks for wasting your time reading this line.
# 12 30-08-2004 , 08:13 PM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161
Hi, sorry about missing this thread! Thanks for the kind words, suzanne!

Yes, that script has problems if you already have the window open. Page 431, later in the example, recommends adding a test for the window already existing.

However, what that code should be doing, ideally, is checking the return value from the window command and storing the actual name of the created window rather than just assuming that a window named crowdWin gets created. I'll make a note of it for any future revisions.

Meanwhile, if you run into problems while working through the book, please feel free to post on the melscripting.com forums at

https://forums.melscripting.com/

I check those boards daily and can jump in and help if someone else doesn't get to it first. user added image

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