Home Technical Talk

[MEL] Cleanup script error on run

I've been trying to work on my MEL Scripting by creating a cleanup script in Maya and I've hit a roadbump.

The script creates a new window with a few checkboxes with two buttons to confirm and close the window.  Before running, it checks to see if you have an object selected before doing anything.  In the back end, it's querying the checkboxes and running the commands.  Here's what the window prints out:

This error pops up when I select all of the text in the script and hit Enter:
PolishObjectUI;
// Error: line 98: Please select an Object(s) // 

When I try to run PolishObjectUI, it gives me this 
PolishObjectUI;
// Error: line 34: Flags must come before objects: -c // 

I've attached the script to this post for people to see and run.  Hopefully someone just finds a typo :'(

Replies

  • Fansub
    Options
    Offline / Send Message
    Fansub sublime tool
    When I try to run PolishObjectUI, it gives me this...
    That's because you added the button titles without specifying the -label flag.

    button -w 1 "Polish" -c "buttonAction"; // Original
    button -w 1 -label "Polish" -c "buttonAction"; // tweaked
    I didn't get the first error,but got a :

    // Error: Line 89.53: "$lightmaps" is an undeclared variable.

    Fixed it by swapping $lightmapUV variable and $lightmaps variable at line 89.Then another error came because you wrote checkbox instead of checkBox in the procedures.Fixed it,and now i had a confirm dialog about pivot point or something.Either yes or no resulted in two different errors.
    Even after fixing the -label error the UI looked badly structured due to multiple layouts not closed (by using setParent command).
    In short,the code you provided is either not complete,not properly written or i might have failed to really understand it :(


  • Sheers
    Options
    Offline / Send Message
    Man, how did that get overlooked?! Many thanks for catching my mistake.  I do apologize for the garbage layout I have and the unclear structure.  I'll invest more time into window designs as soon as I have this script working. 
  • Fansub
    Options
    Offline / Send Message
    Fansub sublime tool
    What you could do to work faster in MEL is divide the project into small chunks.You should first finish the UI without giving any command to a button,just a nice useless UI that looks like what you're after.
    Once you're done work on procedures by following the buttons order (from top to bottom) or simply start with the procedures you are more/less comfortable with.

    Good luck with the script,really nice idea btw :)
Sign In or Register to comment.