Today i worked a little more on making a ui that could hold multiple smaller ui's. My plan is to be able to convert lots of the shelf items i made in rigging into fewer ones and make the code i wrote more reusable by removing doing things like removing dependencies so can use one file, … maybe writing some of the stuff in Python to shorten it (especially the bigger multi line mel functions i wrote) ….
From today's ui work i think ui writing in MEL is similar to going down a hierarchy in the outliner. That is when we go further in hierarchy the parent of thing we are looking at changes. This is like writing lines of the ui ( i put tabs to better see how we are going down the hiearchy …)
The "setParent" was very important for the ui. Why? because without it the tabs really can't tell MEL that these parts should be grouped together and these parts need to be grouped somewhere else. The "setParent" does this. "setParent" can get a particular layout to collapse while leaving all the others alone.. If removed setParent from the code, collapsing one of the layouts would collapse them all.
-- googling the command interested in seeing example.. for instance
i didn't know how to use setParent so i googled "mel setParent multiple ui" and it gave me a good
document to search in. Then i just used find and searched for "setParent"
-- having MEL/Python/API command reference open just in case need names for an option or something that we would like to search for
-- having a great coding/rigging book can get preliminary knowledge to work from by searching table of contents/ or index
and testing code from today:
window -title "multi window" -widthHeight 200 200 mainWindow; columnLayout -adjustableColumn true; //FIRST UI code in here frameLayout -label "Great Day A" -borderStyle "etchedIn" -collapsable true; columnLayout -columnAttach "both" 5 -rowSpacing 5 -columnWidth 200; button -label "Great Day!" -command "print \"Great Day Today!!!\\n\""; button -label "Hurraay!" -command "print \"It is a Great Day!!\\n\""; setParent ..; // setParent ..; //so we are back in are larger ui // //SECOND UI code in here frameLayout -label "Great Day B" -borderStyle "etchedIn" -collapsable true; columnLayout; button -label "Great Day!" -command "print \"Great Day Today!!!\\n\""; button -label "Hurraay!" -command "print \"It is a Great Day!!\\n\""; setParent ..; setParent ..; showWindow mainWindow;
Inspired by Alan Price's tutorials on GUI Layouts in MEL
Inspired by David Gould's Complete Maya Programming