PDA

View Full Version : light menu problem


h0tice
11-24-2003, 11:42 PM
hi there all,

i got here a menu_light.mel that i made, and it was patterned from menu_Cameras.mel by tchoa from highend3d.com.
so here's the code:


global int $vherSpotLights;

string $spot[];
string $spotNames[];
clear $spot;
clear $spotNames;
string $selection[] = `ls -sl`;
string $vherSpot[] = `ls -type spotLight`;
int $i = 0;

for ($spots in $vherSpot)
{
$spot[$i] = $spots;
select -r $spots;
$spotName = `pickWalk -d up $spots`;
$spotNames[$i++] = $spotName[0];
print ($spots + "\n" + $spotName[0] + "\n");
}

if ($vherSpotLights < 0)
$vherSpotLights = 0;
string $pos[8] = {"N","NE","E","SE","S","SW","W","NW"};
int $j = 0;

for ($i = $vherSpotLights * 8; $i < ($vherSpotLights * 8 + 8); $i++)
{
if ($spotNames[$i] != "")
{
menuItem
-label $spotNames[$i]
-command ("select $spotNames[$i]")
-enable 1
-radialPosition $pos[$j++]
-enableCommandRepeat 1
-image "view.xpm"
-boldFont 1
("menuEditorMenuItem" + $i);
}
}
menuItem
-label "Reload"
-command "reloadLights"
-enable 1
-enableCommandRepeat 1
-image "commandButton.xpm"
-boldFont 0
-italicized 1
("menuEditorMenuItem" + $i);

setParent -m ..;

select -r $selection;

global proc reloadLights ()
{
global int $vherSpotLights;
global string $gMainWindow;
$vherSpotLights = 0;
int $hotbox = 0;
$menus = `window -q -ma $gMainWindow`;
for ($menu in $menus)
{
string $label = `menu -q -label $menu`;
if (match("[Hh]ot[Bb]ox",$label) != "" || match("[Cc]enter",$label) != "" || match("3",$label) != "")
{
menu -e -dai $menu;
$hotbox = 1;
}
}

if ($hotbox != 1)
{
deleteUI tempMM;
popupMenu -button 1 -ctl 1 -alt 0 -aob true -p viewPanes -mm 1 tempMM;
source "/home/oliverm/maya/5.0/prefs/markingMenus/menu_lights.mel";
}
}


igot it work but the only problem is everytime i select one of the spotLight in the menu maya displays an error of "warning: no matches name.

so what am i doing wrong here?

thanx for the help.

CGTalk Moderation
01-16-2006, 06:00 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.