Docking Panels

Hello experts,

Somehow i'm not able to find easy readible information about custom panels within maya. I have a lot off mel scrips from highend and custom made. The idea is to create some dockable panels with the scrips that persists within maya. It would be ideal to have some button to turn the panels on and off. Now i have a lot off floating windows that I prefer to dock

The information within maya about scriptedpanels and scriptedPanelType

I have searched highend and did find some related forums but i don't seem to get it :wink:
How do I add my own menu's - Board Index.htm
How To Modify Initchannelslayers To Embed Outliner And Its Button - Board Index.htm

Maybe someone can point me in the right direction

Regards,

Dawn3

Ok firstof you have 2 issues. how to make a panel and how to make it persistent.

Persistence is easy you just need to make sure the codes run every time you open up Maya. Usually easiest is jut to launch the proc form userSetup.mel.

The second is described under scriptedPanelType, read the refernce the example covers it all.

Yes, thanks JooJaa..........

But as far as i understood the scripted panels are docked onto each other not docked onto the general windows off the main gui.

maybe i dont just get the example...... what code should be used to dock the panel on main gui components.

For example docking to the panel to the channelbox...........

Thanks very much

Regards,

Dawn3

It is they just show how you can put a panel into a window as a sample, you should execute the code up until and including line:

scriptedPanel -unParent -type sampleScriptedPanelType -label "Sample" sampleScriptedPanel;

this creates the panel as part of something in the panels menu!

Thanks.............. after reading a bit better I understand the code........

Just needed your push Joojaa...........

edit...

Oke, i can execute my scripts from the custom panel now........ but are not able to dock the panel like for example the channelbox is docked to the side?

edit2...

so I did some poking around and found that the children of mayaMainWindowForm, which contain the main Maya UI, are

formLayout1 - statusLine
formLayout2 - shelf
formLayout3 - toolBox, viewPanes, channelbox,TimeSliderForm
formLayout4 - rangeSlider
formLayout5 - commandLine
formLayout6 - helpLine

So i guess the mayaMainWindowForm has to be edited something like:

formLayout -e
-attachControl sampleScriptedPanelType formLayout2
mayaMainWindowForm

But i prefer not to edit the mayaMainWindowForm, is the no more clean way?

Thanks, regards

CODE
//demo to highendn 27.1.06 repeated in 22.1.07
global proc showOut(){
  paneLayout -e -cn "single" ChannelsLayersPaneLayout;
  paneLayout -e -setPane ChannelsLayersOutliner 1 ChannelsLayersPaneLayout;
  updateChannelsLayers();
}

global proc updateChannelsLayers()
//        Update the Channel Box / Layer Editor area.
//
//        Call this method to make sure the state of the Channel Box and
//        Layer Editor buttons are in sync with the actual state of these
//        components. This is only needed for the main (docked) window,
//        NOT for the separate Layer Editor window.
//
{
    global string $gChannelsLayersForm;

    setParent $gChannelsLayersForm;

    string $childArray[], $configuration, $pane;

    //    Determine the current pane layout configuration.
    //
    $configuration = paneLayout -query -configuration ChannelsLayersPaneLayout;

    int $channels = false, $layers = false, $both = false, $outliner= false;
    int $attrEd = false, $tools = false;

    if (isUIComponentVisible("Channel Box / Layer Editor") ){

        if ("horizontal2" == $configuration) {
            //
            //    If the pane layout configuration is split then both
            //    Channel Box and Layer Editor are visible.
            //
            $channels = false;
            $layers = false;
            $both = true;

        } else if ("single" == $configuration) {
            //
            //    If only one pane is visible the determine what is the visible
            //    pane. Not that due to order of creation the first child in the
            //    array is the Channel Box and the second is the Layer Editor.
            //     EDITY: a bit sloppy edit here switch woyuld be better joojaa
                    //
            $pane = paneLayout -query -pane1 ChannelsLayersPaneLayout;
            $childArray = paneLayout -query -childArray ChannelsLayersPaneLayout;

            $both = false;
            if ($pane == $childArray[0]) {
                $channels = true;
                $layers = false;
                           $outliner= false;
            } else if ($pane == $childArray[1]){
                $channels = false;
                $layers = true;
                           $outliner= false;
            } else {
                         $channels = false;
                $layers = false;
                           $outliner= true;
            }

        } else {
            error ("Unexpected pane layout configuration. " +
                "Should be \"single\" or \"horizontal2\"");
            return;
        }

    } else if (isUIComponentVisible("Attribute Editor")) {
        $attrEd = true;
    } else if (isUIComponentVisible("Tool Settings")) {
        $tools = true;
    }

    //    Update the check boxes.
    //
    iconTextCheckBox -edit -value $channels ChannelsLayersChannelsCheckBox;
    iconTextCheckBox -edit -value $layers ChannelsLayersLayersCheckBox;
    iconTextCheckBox -edit -value $both ChannelsLayersBothCheckBox;
    iconTextCheckBox -edit -value $outliner ChannelsLayersOulineCheckBox;

    // Update the enable state of the channel box buttons
    //
    if ($layers) {
        symbolButton -edit -enable false cbManipsButton;
        symbolButton -edit -enable false cbSpeedButton;
        symbolCheckBox -edit -enable false cbHyperbolicButton;
    } else {
        initChannelBoxButtons;
    }
}

global proc jooAddOutlinerToChannelbox()
{
global string $gChannelsLayersForm;
$butline = formLayout -query -childArray $gChannelsLayersForm;
setParent ($gChannelsLayersForm+"|"+$butline[0]);
$array=layout -q -ca ($gChannelsLayersForm+"|"+$butline[0]);
int $topSpacing = 0;
int $botSpacing = 1;
$outliner=iconTextCheckBox -cc "showOut()" -image1 "layers.xpm" -width 23 -height 23 -ann "OUTLINER" ChannelsLayersOulineCheckBox;
formLayout -edit
           -attachNone    $outliner    "top"  
        -attachControl    $outliner    "left"   0 $array[2]
        -attachForm    $outliner    "bottom" $botSpacing
        -attachNone    $outliner    "right"
          ($gChannelsLayersForm+"|"+$butline[0]);

setParent ChannelsLayersPaneLayout;
outlinerPanel -copy outlinerPanel ChannelsLayersOutliner;

}

jooAddOutlinerToChannelbox()

// this uses partly aliases code but thing is i add one more button to the top
// of the channelbox wich is used to activate outliner.
// alternative strategy is to make a panel that accepts 2 more panls