View Full Version : Shelfbutton name


Matte
08 August 2007, 08:48 AM
Hey,

Is there a way to tell maya to keep the shelfbutton name of a created button after maya restart? (so that you can query / edit etc.)

I did found a year or so old post describing the this very issue. The author recommended to edit your shelfbutton .mel file from the userdir by hand, which of course works, at least for that session. But once you close maya again it writes out the shelf, not keeping the shelfname. Meaning that you will have to edit the mel file everytime you start maya, which is kinda counterproductive.

Anyone knows a way to keep the name?

/Matte

shanshore
08 August 2007, 04:47 AM
Hi Matte.
you can specify the name of the shelfButton at the end of the command...
setParent "Custom";
// Custom - ShelfTab name

shelfButton
-enableCommandRepeat 1
-enable 1
-width 34 -height 34
-manage 1
-visible 1
-preventOverride 0
-label "myScript"
-labelOffset 0
-font "tinyBoldLabelFont"
-image "commandButton.xpm"
-style "iconOnly"
-marginWidth 1 -marginHeight 1
-command "myScript"
-actionIsSubstitute 0
slfBtnTest;
// slfBtnTest - shelfButton name
then you can query or edit the shelfButton (even after restarting maya) like...
shelfButton -q -c slfBtnTest
shelfButton -e -image "menuIconWindow.xpm" slfBtnTest
good luck
Shanshore.

Matte
08 August 2007, 02:17 PM
Yeah, i assume then you mean that i should place this in my userSetup.mel!? So that it gets named every time on startup. And it will probably work, but it would mean that the button itself will always end up at the end/front of the row (if i have more commands on any current shelf i mean).

What i want is to have maya remember the name automaticaly to the shelf. So that upon application exit it saves the name of the button to the "shelf_MyShelf.mel" (for example) to the <userdir>\prefs\shelves along with everything else. This is something maya does not do by default. It saves the shelfbutton itself but forgets its name which means you cant query/edit it the next time you start maya.

/Matte

russ_c
08 August 2007, 06:27 PM
Sorry I don't have the time to work out the mel code for this, but why can't you just store the name you're looking for in the shelfButtons Icon Name or Label or even the icon being used? These are three things that Maya will remember and you can define to be unique. Can you not query those?

Hope that helps,

Russell

Matte
08 August 2007, 01:29 PM
russ_c - No, i cant query for an icon/label etc that does not have a known name assigned in memory. The buttons label/icon is part of its own individual settings so, in order to reach a setting, i must first know the buttons name. Guess i will have figure out something else. Thanks anyway.

/Matte

CGTalk Moderation
08 August 2007, 01:29 PM
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.


1