PDA

View Full Version : Imbedded Shelves Mel Script


Chepri
11-18-2011, 03:02 PM
Hi guys,
Iím trying to make a scene with imbedded shelves so that I can give my scene to anyone and theyíll be able to use my tools that I incorporated onto a custom shelf.

if (`shelfLayout -exists "Project_Avatar_Tool"`)
{
print "You already have this shelf!";
}
else
{
addNewShelfTab "Project_Avatar_Tool";


global proc shelf_Project_Avatar_Tool ()
{
global string $gBuffStr;
global string $gBuffStr0;
global string $gBuffStr1;


shelfButton
-enableCommandRepeat 1
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Sticky_Shelves_Test"
-enableBackground 0
-align "center"
-label "Test For Sticky Shelves"
-labelOffset 0
-font "plainLabelFont"
-imageOverlayLabel "TEST"
-overlayLabelColor 0.8 0.8 0.8
-overlayLabelBackColor 0 0 0 0.2
-image "commandButton.png"
-image1 "commandButton.png"
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-command "polySphere -ch on -o on -r 93.777389 ;"
-sourceType "mel"
-commandRepeatable 1 ;
}
}

So this script Works, perfectly.
(For the people who want to use it: you have to use the expression editor to make it stick to the scene)

However I donít need a sphere but a pop up menu like this:

{
window;
columnLayout;
button -label "button1";
button -label "button2";
showWindow;;
} I get a syntax error with whatever I try. Itís probably really simple but I just continue to but heads with it. If someone can help me, that would be great! T.T

Azrail
11-18-2011, 04:27 PM
Use procedures it's cleaner, more readable and easy to edit, without deleting and recreating the shelf on any test:

if (`shelfLayout -exists "Project_Avatar_Tool"`)
{
print "You already have this shelf!";
}
else
{
addNewShelfTab "Project_Avatar_Tool";
global proc shelf_Project_Avatar_Tool ()
{
global string $gBuffStr;
global string $gBuffStr0;
global string $gBuffStr1;
shelfButton
-enableCommandRepeat 1
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Sticky_Shelves_Test"
-enableBackground 0
-align "center"
-label "Test For Sticky Shelves"
-labelOffset 0
-font "plainLabelFont"
-imageOverlayLabel "TEST"
-overlayLabelColor 0.8 0.8 0.8
-overlayLabelBackColor 0 0 0 0.2
-image "commandButton.png"
-image1 "commandButton.png"
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-command "avatarToolsUI"
-sourceType "mel"
-commandRepeatable 1;
}
}

global proc avatarToolsUI()
{
window;
columnLayout;
button -label "button1";
button -label "button2";
showWindow;;
}

Chepri
11-19-2011, 12:41 AM
Brilliant!!! ^^
Thanks a lot! o//

CGTalk Moderation
11-19-2011, 12:41 AM
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.