PDA

View Full Version : Noob Problem with mel code


ty666
10-27-2005, 10:12 AM
Hello, i'm a noob to mel.
This program is supposed to open a window with a list of the camera in the scene.
But when we click on a button, this is supposed to select the camerashape of the selected view .... and it send me an error : no match name

string $cam[] = `ls -ca`;
string $selection[] = `ls -sl`;
$nb = size($cam);
string $window = `window -title "Coucou"
-iconName "Pouet"
-widthHeight 200 200`;
columnLayout -adjustableColumn true;
for ($i = 0; $i <= $nb-1; $i++) {
button -label $cam[$i]
-command "select -r $cam[$i]";
string $selection[] = `ls -sl`;
}
button -label "Look Through" -command "lookThru $selection";
button -label "Close" -bgc 1 0 0 -command ("deleteUI -window " + $window);
setParent ..;
showWindow $window;

please, where is the problem ? (sorry for my english)

PaulAtkinson
10-27-2005, 03:31 PM
string $cam[] = `ls -ca`;
$nb = size($cam);
string $window = `window -title "Coucou"
-iconName "Pouet"
-widthHeight 200 200`;
columnLayout -adjustableColumn true;
for ($i = 0; $i <= $nb-1; $i++) {
button -label $cam[$i]
-command ("lookThru " + $cam[$i]);
}
button -label "Close" -bgc 1 0 0 -command ("deleteUI -window " + $window);
setParent ..;
showWindow $window;


I've made a few changes, I think this is what you were after.

Watch out how you compile your command strings

-command "lookThru $selection";

would look for an object called $selection and not the contents of $selection.

Robert Bateman
10-27-2005, 03:36 PM
string $cam[] = `ls -ca`;
string $selection[] = `ls -sl`;
$nb = size($cam);
string $window = `window -title "Coucou"
-iconName "Pouet"
-widthHeight 200 200`;
columnLayout -adjustableColumn true;
for ($i = 0; $i <= $nb-1; $i++) {
button -label $cam[$i]
-command ("select -r "+$cam[$i]);
string $selection[] = `ls -sl`;
}
button -label "Look Through" -command "{$selection=`ls -sl`; lookThru $selection[0]; }";
button -label "Close" -bgc 1 0 0 -command ("deleteUI -window " + $window);
setParent ..;
showWindow $window;

ty666
10-27-2005, 04:29 PM
thank you very much :). I'm stupid :p

CGTalk Moderation
10-27-2005, 04:29 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.