PDA

View Full Version : Need help with current render view menu


Hamburger
08-07-2012, 05:06 AM
Hi there,

I have this code but it doesn't excecute properly (ie it picks up the current render camera, but the menu selection does nothing)!


string $cameras[]= `ls -ca`;
$unwantedCameras = { "sideShape", "topShape", "frontShape"};
$camList = stringArrayRemove($unwantedCameras, $cameras);
stringArrayInsertAtIndex (0, $camList, $camera);
$camListFinal = stringArrayRemoveDuplicates($camList);

$options =`optionMenuGrp -l "Current Render View Camera" -cc ("renderWindowEditor -ex -e crc #1") `;

for($cam in $camListFinal)
{
string $parent[] = `listRelatives -p $cam`;
menuItem -l $parent[0];
}


// Error: line 1: No object name specified. //

It's the $options string, is there a way I can write that better?

NaughtyNathan
08-07-2012, 11:02 AM
I think the issue here is simply that you cannot use the #1 syntax with an optionMenu callback command. you will have to replace the #1 with an actual `optionMenuGrp -q` command.

Hamburger
08-07-2012, 11:28 PM
Haha, cheers - thanks Nathan.

I'm self "taught".........obviously. :beer:

Hamburger
08-10-2012, 02:39 AM
Okay to follow up, I had time to fix this today.

I had to name what I was changing!


string $cameras[]= `ls -ca`;
$unwantedCameras = { "sideShape", "topShape", "frontShape"};
$camList = stringArrayRemove($unwantedCameras, $cameras);
stringArrayInsertAtIndex (0, $camList, $camera);
$camListFinal = stringArrayRemoveDuplicates($camList);

string $editor = "renderWindowPanel1";
$options =`optionMenuGrp -l "Current Render View Camera" -cc ("renderWindowEditor -e crc #1 $editor") `;

for($cam in $camListFinal)
{
string $parent[] = `listRelatives -p $cam`;
menuItem -l $parent[0];
}

CGTalk Moderation
08-10-2012, 02:39 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.