Reloading shelf

Become a member of the CGSociety

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

Thread Tools Display Modes
  05 May 2009
Reloading shelf

Hi there.

I have made a custom shelf in text editor that contains a number of scripts, and it works great. However I'm having a hard time trying to figure out how to reload the shelf so I get my updates?

I have been deleting my existing shelf then relload my shelf again.. which is kind of stupid..

Any input is appreciated.
  05 May 2009

I notice that the default shelf editor doesn't allow me to add popup menu on icons.. I can add popup menu by manually hardcoding in shelf .mel.

What is your workaround?
  05 May 2009
Hi efecto,

sorry... not gonna write that much now... tired... just writing a bit to bump this thread... and hopefully remember to come back and post again...

a couple of years a ago I worked on a little project where I wanted to make a production shelf system that should work over a network... where e.g. the user could click on a shelf button to update the shelf to always have the newest version of it... never finished it completely thou and haven't looked at it for a couple of years... will try and see if I can find my old files... to how I got arround the update thingie...

regarding adding popup menu's to shelf buttons you can try this example and just change it to fit your stuff... getDaShelfButtonFor is a function to get the "shelf button id" from the doctag of the button... as I recall there is some info about the use of doctag's in the helpfiles...
in this example I have just called the shelf "DaTest"... and the doctag for the button to attach the popupmenu to for "daTestoButton"...

//function to get the shelf button Id uses the doctac of the shelf button for that
global proc string getDaShelfButtonFor(string $daButtonTag)
	 string $daButtonName = "";
	 string $daShelfButtons[] = `getDaTest_Shelf`;
	 for($daButton in $daShelfButtons)
		 if(`control -exists $daButton`)
			if(`control -q -docTag $daButton` == $daButtonTag)
			   $daButtonName = $daButton;
	 return $daButtonName;
// code for the test shelf stuff...
global proc setupDaTest_Shelf()
global proc makeDaTestShelfPopUp()
		string $daButton = getDaShelfButtonFor("daTestoButton");
 if(`control -exists $daButton`)
			if(!`shelfButton -q -numberOfPopupMenus $daButton`)
			   popupMenu -p $daButton -aob 1 -pmc( "daTestoShelfButtonPopUpMenu "+ $daButton +"Popup" ) ( $daButton +"Popup" );

global proc string[] getDaTest_Shelf()
	   return `shelfLayout -q -ca DaTest`;
global proc daTestoShelfButtonPopUpMenu(string $daButton)
	 setParent -m $daButton;
	 menu -e -dai $daButton;
	 menuItem -d 1;
	 menuItem -l "test item line 1" -c "print(\"This is a test for line 1... :-)\\n\");" ;
	 menuItem -l "test item line 2" -c "print(\"This is a test for line 2... :-)\\n\");";
	 menuItem -l "test item line 3" -c "print(\"This is a test for line 3... :-)\\n\");";
	 menuItem -d 1;
	 menuItem -l "test item line 4" -c "print(\"This is a test for line 4... :-)\\n\");";
//code for test shelf...
global proc shelf_DaTest () {
	global string $gBuffStr;
	global string $gBuffStr0;
	global string $gBuffStr1;

		-enableCommandRepeat 1
		-enable 1
		-width 34
		-height 34
		-manage 1
		-visible 1
		-annotation "this is just a test - right click to get options..."
		-docTag "daTestoButton"   //<------ for setting it up and make the getDaShelfButtonFor get the "shelf button id"... :-)
		-preventOverride 0
		-align "center" 
		-label "da Testo Shelf Button"
		-labelOffset 0
		-font "tinyBoldLabelFont" 
		-image "commandButton.xpm" 
		-image1 "commandButton.xpm" 
		-style "iconOnly" 
		-marginWidth 1
		-marginHeight 1
		-command "print(\"This is a test... :-)\\n\");" 
		-sourceType "mel" 
		-actionIsSubstitute 0

kind regards

Alex V. U. Strarup
Mel script monkey
Facebook LinkedIn

one mistake can ruin it all... :)
  05 May 2009
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
Society of Digital Artists

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

All times are GMT. The time now is 04:59 PM.

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