View Full Version : MEL: scriptTable help please!
09-23-2010, 12:58 AM
I'm having a slight problem with figuring out the scriptTable command.
Basically I'm wondering if it's possible to modify the greyed out column on the left.
Is it possible to define it's width and to assign a label to each row?
09-23-2010, 10:40 AM
don't bother Manuel, scriptTable, like treeView, is another one of those half-assed commands that's only designed for a specific single hard-coded use in Maya and not apparently considered as being any use for scripters... At least that's my impression of it as it's practically useless as is.
I've made my own custom "scriptTables" a couple of times in Maya using basic MEL/Python but only to display data, I've never had to make one that takes actual input... There's an idea that ewerybody came up with that involves multiple packed layouts in a huge scrollLayout which would emulate a fully customizeable scriptTable quite nicely, but if you wanted it for more than displaying data it could eat up a hell of a lot of UI control handles (not good in windows!)
09-23-2010, 01:48 PM
the best way is probably to fix this with Qt in Maya 2011!
But If you're not that far like we ;] ... the idea is actually from a co worker (http://www.mentalbase.de).: use a set of textScrolllists in a scrollable tabLayout side by side:
of course this way you'd need to script all functionality like whole line selection, deletion, scalability and sorting by yourself.. but that can be quite some fun :D
to give you a starter:
if (`window -ex testScrollList`)
// this is vital: make the tabLayout scrollable and childResizable!
tabLayout -tabsVisible 0 -scrollable 1 -childResizable 1 testScrollListScroll;
textScrollList -allowMultiSelection 1 -selectCommand ("testScrollList_select 0") testScrollList0;
textScrollList -allowMultiSelection 1 -selectCommand ("testScrollList_select 1") testScrollList1;
-af testScrollList0 left 0 -af testScrollList1 right 0
-af testScrollList0 top 0 -af testScrollList1 top 0
-af testScrollList0 bottom 0 -af testScrollList1 bottom 0
-ac testScrollList0 right 3 testScrollList1
// just fill the lists with scene crap:
string $ls = ls();
int $numItems = size($ls);
for ($obj in $ls)
textScrollList -edit -append $obj testScrollList0;
textScrollList -edit -append (objectType($obj)) testScrollList1;
textScrollList -edit -numberOfRows $numItems testScrollList0;
textScrollList -edit -numberOfRows $numItems testScrollList1;
// a selection proc that selects also the opposite side and things in the scene
global proc testScrollList_select(int $whichList)
int $sel = `textScrollList -q -selectIndexedItem ("testScrollList" + $whichList)`;
textScrollList -edit -deselectAll ("testScrollList" + !$whichList);
for ($s in $sel)
textScrollList -edit -selectIndexedItem $s ("testScrollList" + !$whichList);
select (`textScrollList -q -selectItem testScrollList0`);
09-23-2010, 02:29 PM
don't bother Manuel, scriptTable, like treeView, is another one of those half-assed commands that's only designed for a specific single hard-coded use in Maya...
That's what I thought even though I hoped I'd just not be smart enough to figure it out and that there'd be a way. Thanks for your suggestion Eric but since it's only cosmetic and doesn't really affect functionality I think I'll stick with my scriptTable in it's current form instead of creating a whole bunch of controls.
09-23-2010, 03:19 PM
just as you wish :D
I tryed the scriptTable too some day. Its not nice.
But if you packed stuff up in usefull functions, maybe even in an own class things can be pretty easy this way.
09-24-2010, 08:10 AM
yeah it's not that bad once you figure out how to make an efficient getCellCmd. As I said, my only concerns regarding the scriptTable are that I can't control it's appearance entirely but apart from that it does what it's supposed to do.
thanks for all your suggestions!
09-24-2010, 08:10 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.