PDA

View Full Version : help neeeded with script


jaydru
12-21-2007, 05:38 PM
im trying to write a script to toggel the orthagraphic attribute on and off on the defalt perspective cam shape node

i am totaly clueless about mel i assume it would be an if else code but i am having a lot of trouble trying to write it,

these are the atribute values i want to toggel between,

setAttr "perspShape.orthographic" 1;
setAttr "perspShape.orthographic" 0;

if anyone can point me in the right direction i would greatly apprecate it

Norb
12-21-2007, 05:58 PM
global proc toggleOrtho()
{
//this gets the current viewport
string $currentPanel = `getPanel -withFocus`;

//this gets the camera associated with the panel
string $currentCam = `modelPanel -query -cam $currentPanel`;

//this sets the value to be the opposite of whatever it is currently (that's what the '!' is for
setAttr ($currentCam+".orthographic") (!`getAttr ($currentCam+".orthographic")`);
}

jaydru
12-21-2007, 06:04 PM
thank so much for that, i just upgraded to 2008 and the view cube is just not the same as the compass that ive come to use so much, i dont know why they got rid of it, but this should help my work flow thank you.

CGTalk Moderation
12-21-2007, 06:04 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.