Refresh optionMenuGrp - not working

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
  05 May 2012
Refresh optionMenuGrp - not working

I've seen this topic before, but when I use the solution that other people used, my script fails. When I test this by creating another camera and running the procedure to refresh my menu, it deletes everything in the menu (which it should) then it gives me an error:

Menu Item's menu not found. (the line that produces this error is highlighted below).

Can anyone see what I did wrong?

Thanks for your help!

global proc refreshCamList(){
	//get the active camera
	string $getPanel = `getPanel -wf`;
    string $activeCam = `modelPanel -q -camera $getPanel`;                         
    //get all of the cameras in the scene
    string $camSelection[] = `listCameras`;
	//delete everything in the camera menu
	string $oldCamList[] = `optionMenuGrp -q -ill camList`;
	for ($obj in $oldCamList){
		deleteUI -mi $obj;
	//repopulate camera menu
	for ($cams in $camSelection){
	    menuItem -label $cams;
	//make the default menu item the active camera                                            
	optionMenuGrp -e -v $activeCam camList;

  05 May 2012
You should specify where to parent the new menu item:
menuItem -l $cams -p camList;
..aut inveniam viam aut faciam..
::Copy SOP 4 Maya::
  05 May 2012
Thanks. I did what you said, but it's still giving me the same error. Boy, this one is really confusing me.
  05 May 2012
haven't we had this conversation before...?

$camList is not the name of the menu, it's the name of the parent layout (any control named "Grp" is actually a layout, with child controls).

Find out the name of the menu by using `layout -q -ca $camList` to get a list of it's children, then use that name as the -parent.
  05 May 2012
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 09:58 AM.

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