Syntax Error, please help
Hello,
I am trying to write a script that will toggle the grid on and off in the current viewport with a hotkey. Unfortunatly, I'm getting a syntax error. Here's the script I have so far:
*******************
int $panelVis;
{
// get active panel
string $currentPanel = `getPanel -underPointer`;
// no panel under pointer --> get panel with focus
if ($currentPanel == "")
$currentPanel = `getPanel -withFocus`;
// get panel display type
string $panelType = `getPanel -typeOf $currentPanel`;
// get panel name
string $currentName = `modelPanel -query -label $currentPanel`;
if ($panelType == "modelPanel")
{
// Toggle grid in correct panel:
if($currentName == "Top View")
{$panelVis = 'modelEditor -q -grid modelPanel1';
if ($panelVis == "0")
modelEditor -e -grid 1 modelPanel1;
if ($panelVis == "1")
modelEditor -e -grid 0 modelPanel1;
}
if($currentName == "Side View")
{$panelVis = 'modelEditor -q -grid modelPanel2';
if ($panelVis == "0")
modelEditor -e -grid 1 modelPanel2;
if ($panelVis == "1")
modelEditor -e -grid 0 modelPanel2;
}
if($currentName == "Front View")
{$panelVis = 'modelEditor -q -grid modelPanel3';
if ($panelVis == "0")
modelEditor -e -grid 1 modelPanel3;
if ($panelVis == "1")
modelEditor -e -grid 0 modelPanel3;
}
if($currentName == "Persp View")
{$panelVis = 'modelEditor -q -grid modelPanel4';
if ($panelVis == "0")
modelEditor -e -grid 1 modelPanel4;
if ($panelVis == "1")
modelEditor -e -grid 0 modelPanel4;
}
}
}
********************
Here is the syntax error:
// Error: {$panelVis = 'modelEditor -q -grid modelPanel1';
//
// Error: Line 20.10: Syntax error //
// Error: {$panelVis = 'modelEditor -q -grid modelPanel2';
//
// Error: Line 28.10: Syntax error //
// Error: {$panelVis = 'modelEditor -q -grid modelPanel3';
//
// Error: Line 36.10: Syntax error //
// Error: {$panelVis = 'modelEditor -q -grid modelPanel4';
//
// Error: Line 44.10: Syntax error //
Any ideas?