script to delete shelf icon quickly .

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2004
script to delete shelf icon quickly .

i have a question .

does anyone out there know of a script that will allow you to ' right click on a shelf icon and delete it off the spot without having to drag it to the trash can all the way in on the top right side, or having to go into the shelf editor and delete it there ? it gets quite redundant and slow .

i'm asking this because i have a script that generates quick selections and puts it on the shelf, which i can conveniently select it but it clutters up the shelf quickly .

it doesnt seem possible that there might be a script for this , but hey , i'm still a newbie . please let me know

ah to make it clearer :

right click and marking menu appear to let you delete off an icon, or holding down a shortcut and click on an icon to delete it .
 
  04 April 2004
Can you mmb drag them off the shelf and have them delete? I don't remember if that works as well
 
  04 April 2004
Quote: does anyone out there know of a script that will allow you to ' right click on a shelf icon and delete it off the spot without having to drag it to the trash can



{
string $shelves[] = `tabLayout -q -ca $gShelfTopLevel`;
for ($shelf in $shelves)
{
string $buttons[] = `shelfLayout -q -ca $shelf`;
for ($b in $buttons)
{
popupMenu -b 3 -p $b;
menuItem -l ("delete " + $b) -c ("deleteUI " + $b);
}
}
}


This will add a RMB menu to every button on every shelf. The RMB menu is added to each button individually, so if you create new buttons, you´ll have to execute the script again to rebuild the menus for the new buttons.

Of course, if you only want to add RMB menus to a *specific* shelf, then you don´t need to cycle through all the other shelves to do it:

string $buttons[] = `shelfLayout -q -ca shelfName`;
for ($b in $buttons)
{
popupMenu -b 3 -p $b;
menuItem -l ("delete " + $b) -c ("deleteUI " + $b);
}

Again, you´ll have to run the script to build new RMB menus for newly created buttons.

You can also check out my dwToolsWindow.mel on my website. It basically creates a UI with a shelflayout and allows you to save out custom MEL tools. Almost identical to Maya´s shelves, except it´s a floating window and it already has a RMB menu for each button to allow deletion.


David
__________________
David Walden
Rigging | MEL Scripting | Animation
www.davidwalden.com
 
  04 April 2004
many many thanks dwalden74, the script works great as i combined it with my other script which is actually very convienient, reapplying the shortcut is processed when a new icon is put on the shelf, so 2 for 1 . many thanks !

i'm also looking at the library of mel script you ahve on yoru site, i will put it to use and see the usefulness of them. well ! thank you so much !
 
  07 July 2004
Hey dwalden74!!!!

Amazing Script!!!
Simple but... just awesome! I wonder why that isn't already integrated into Maya...

@ktpr: You may drag the ShelfButtons with MMB to the recycle-bin to the right. But of course, this one here's much more ergonomic.

Suggestion: I just saved it into my scripts folder. And then I recognized... Maya executes the scripts in there at startup doesn't it?! So at this place with no procedure included: Maya 'd do that automatically!... I gonna check it out when I start next time :]
Another one: there must be a procedure wich creates shelfbuttons, one could integrate the script into in.. so every Button has that Option.
 
  07 July 2004
You can always add the script dwalden74 provided at the end of your UserSetup.mel file, and it will get run everytime you start Maya.

I suggest putting it at the end, incase your UserSetup.mel has stuff that creates/loads custom shelves for you. This way, all the shelves are loaded before the RMB to delete them is added.
__________________
mike hovland
lead technical artist
Robomodo

Life beats down and crushes the soul... art reminds you that you have one. - Stella Adler
 
  07 July 2004
Quote: there must be a procedure wich creates shelfbuttons, one could integrate the script into in.. so every Button has that Option.

Nope. The problem is that Maya prefs do not save shelfButton names , therefore when the shelves/buttons are created on startup, Maya assigns arbitrary numerical names to each button. You need to know the button names in order to assign popup menus to them. I´ve actually complained about this in the past, but apparently Alias has more important issues to deal with. Alias should allow users to specify custom shelfButton names in Maya, which are in turn saved in the userPrefs. There, I said it again.

Until they get around to doing that, I´d recommend following mhovland´s advice and just put it in your userSetup file.


David
__________________
David Walden
Rigging | MEL Scripting | Animation
www.davidwalden.com
 
  07 July 2004
it is a pain in the ass that maya doesn't save ui names in the shelf prefs, BUT it does save docTag info (weird huh). i've written an uber simple script to return the ui name of a button with a given docTag. using this "go-between" script you can get the same functionality as naming shelf buttons explicitly, and having that remembered across maya sessions.

zooTriggered, zooAutoSave and zooCST all make "named" shelf buttons in this fashion, as well as adding rmb menus to those buttons.

but you're right dave, it would be heaps easier if alias just saved ui names in the shelf file.
__________________
-:macaroniKazoo:-
 
  07 July 2004
Oh yeah, I forgot about the -docTag (we talked about this last year or something I think). If you save the shelfButton with a -docTag string, then you can query that and get the name of the UI element. Thanks Hamish!

-d
__________________
David Walden
Rigging | MEL Scripting | Animation
www.davidwalden.com
 
  01 January 2006
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:37 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.