Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Save shelf buttons to a shelfLayout in a custom UI - Help
  RSS 2.0 ATOM  

Save shelf buttons to a shelfLayout in a custom UI - Help
Rate this thread
 
22237
 
Permlink of this thread   Subscribe to this thread
avatar
  • kawasami
  • Posted: 02 February 2009 09:19 PM
  • Total Posts: 2
  • Joined: 01 January 2007 01:32 PM

I am currently building a custom UI window to aid in the production of a short film, I thought it was a good place to begin learning how to program MEL. However when I try to implement the shelfLayout object, I can’t seem to work out how to save the items that i drag into the shelf , when i close the window.

Can anyone shed any light on this please

Thanks



Replies: 0
avatar
  • lavainia
  • Posted: 03 February 2009 10:08 AM

try the “saveShelf” command;

//    Create a window with a shelf in it.
//
string $window = `window`;
string $tabs = `tabLayout`;
string $shelf = `shelfLayout`;
shelfButton -image1 "commandButton.xpm" -command ("print \"Hello\\n\"");
tabLayout -edit -tabLabel $shelf "Example Shelf" $tabs;
showWindow $window;

//    At this point the example would be made more interesting if you
//    put some additional items on this shelf.

//    Now save the shelf in the temp directory.
//
string $tempDir = `internalVar -userTmpDir`;
saveShelf $shelf ($tempDir "ExampleShelf");

in that example it saves the shelf immediately after creating the window if you run the entire thing, but you can take the saveShelf command and make it work with a button, etc.

hope that helps! :)



Replies: 0
avatar
  • kawasami
  • Posted: 03 February 2009 10:19 AM

Thankyou that worked a treat :)



Replies: 0




   
  Settings Choose Theme color: