nookie
05-12-2012, 07:20 PM
Hi all,
I was trying to save a button to the current active shelf with python but with not so much luck.
Let's say I want to save a button doing this
print 'hello I am a button'
Which would be the best way?
I was taking a look at the way maya saves a camera bookmark to the shelf
global proc cameraBookmarkShelfCB(string $parent, string $camera)
{
setParent $parent;
string $item = selectedBookmark();
if ($item != "") {
global string $gShelfTopLevel;
if (`tabLayout -exists $gShelfTopLevel`) {
string $currentShelf = `tabLayout -q -selectTab $gShelfTopLevel`;
string $cmdStr =
"cameraView -e -camera "+$camera+" -setCamera "+$item;
shelfButton
-p ($gShelfTopLevel + "|" + $currentShelf)
-image1 "commandButton.png"
-label $item
-style `shelfLayout -q -style $currentShelf`
-width `shelfLayout -q -cellWidth $currentShelf`
-height `shelfLayout -q -cellHeight $currentShelf`
-c $cmdStr;
}
}
}
but I don't really know how to treat that $gShelfTopLevel variable (in python) :)
I was trying to save a button to the current active shelf with python but with not so much luck.
Let's say I want to save a button doing this
print 'hello I am a button'
Which would be the best way?
I was taking a look at the way maya saves a camera bookmark to the shelf
global proc cameraBookmarkShelfCB(string $parent, string $camera)
{
setParent $parent;
string $item = selectedBookmark();
if ($item != "") {
global string $gShelfTopLevel;
if (`tabLayout -exists $gShelfTopLevel`) {
string $currentShelf = `tabLayout -q -selectTab $gShelfTopLevel`;
string $cmdStr =
"cameraView -e -camera "+$camera+" -setCamera "+$item;
shelfButton
-p ($gShelfTopLevel + "|" + $currentShelf)
-image1 "commandButton.png"
-label $item
-style `shelfLayout -q -style $currentShelf`
-width `shelfLayout -q -cellWidth $currentShelf`
-height `shelfLayout -q -cellHeight $currentShelf`
-c $cmdStr;
}
}
}
but I don't really know how to treat that $gShelfTopLevel variable (in python) :)
