CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 04-24-2004, 07:51 PM   #1
kyo
Veteran
 
Join Date: Jul 2002
Posts: 49
Send a message via AIM to kyo
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 .
 
Old 04-25-2004, 01:18 AM   #2
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183
Can you mmb drag them off the shelf and have them delete? I don't remember if that works as well
 
Old 04-25-2004, 11:07 AM   #3
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
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
 
Old 04-25-2004, 09:15 PM   #4
kyo
Veteran
 
Join Date: Jul 2002
Posts: 49
Send a message via AIM to kyo
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 !
 
Old 07-08-2004, 03:10 PM   #5
ewerybody
w°°t
 
ewerybody's Avatar
portfolio
eRiC Werner
pyroTechnical Artist
Berlin, Germany
 
Join Date: Jun 2003
Posts: 613
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.
 
Old 07-08-2004, 03:49 PM   #6
mhovland
MEL Monkey
 
mhovland's Avatar
portfolio
Mike Hovland
Technical Artist
Robomodo
Chicago, USA
 
Join Date: Feb 2002
Posts: 580
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
 
Old 07-08-2004, 04:09 PM   #7
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
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
 
Old 07-08-2004, 09:54 PM   #8
macaroniKazoo
Know-it-All
 
macaroniKazoo's Avatar
animator
 
Join Date: Jul 2003
Posts: 391
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:-
 
Old 07-09-2004, 08:09 AM   #9
dwalden74
Google E. Bear
 
dwalden74's Avatar
David Walden
Rigging, scripting.
NY, USA
 
Join Date: Feb 2002
Posts: 818
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
 
Old 01-18-2006, 03:00 AM   #10
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:52 AM.


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