Adding Maya Panels to MEL GUIs

Problem:
Adding default scripted panels(Visor, Reference Editor etc) in Maya to custom UIs created using MEL
Solution:

 if(!`scriptedPanelType -exists visorPanel1`)
 scriptedPanelType
 -createCallback "createVisorPanel"
 -initCallback "initVisorPanel"
 -addCallback "addVisorPanel"
 -removeCallback "removeVisorPanel"
 -saveStateCallback "saveStateVisorPanel"
 -deleteCallback "deleteVisorPanel"
 -unique true
 visorPanel1;

if (`window -exists myWindow`)deleteUI myWindow;
 {
 window -t "My Window" myWindow;
 frameLayout -lv false -bv false myLayout;
 scriptedPanel -e -p myLayout -type visorPanel1 visorPanel1;
 showWindow myWindow;
 }
 

Commands:
scriptedPanelType, scriptedPanel, getMayaPanelTypes

Discussion:

Default Scripted panels can be added to your custom GUIs using the scriptedPanel command. Before specifying the command the scripted panel should be defined using the command scriptedPanelType. By specifying the type of scripted panel using the -type flag in scriptedPanel command creates an instance of the specific scripted panel. You can also get a list of the default scripted panels in Maya using the command getMayaPanelTypes(1). In the above example an instance of Visor panel is created and then added to the custom UI myWindow.

The query regarding this functionality in MEL was raised by one of the visitors to this blog. Hence I thought it would be great to include this as a tutorial just in case some of you might find it useful. You may feel free to mail me in case you have any topics which you feel could be included in the Tutorials section. I am not guaranteeing a quick reply, but whenever I get free time from my work schedule I would try to include those topics too (provided I know the answer to your question).

Advertisements

2 thoughts on “Adding Maya Panels to MEL GUIs

  1. idem

    that mel dont work, i want attach visor to my window?
    but

    if(!`scriptedPanelType -exists visorPanel1`)

    scriptedPanelType

    -createCallback “createVisorPanel”
    -initCallback “initVisorPanel”
    -addCallback “addVisorPanel”
    -removeCallback “removeVisorPanel”
    -saveStateCallback “saveStateVisorPanel”
    -deleteCallback “deleteVisorPanel”
    -unique true
    visorPanel1;

    if (`window -exists myWindow`)deleteUI myWindow;

    {

    window -t “My Window” myWindow;

    frameLayout -lv false -bv false myLayout;

    scriptedPanel -e -p myLayout -type visorPanel1 visorPanel1;

    showWindow myWindow;

    }

    result -clear myWindow maya 2010

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s