PDA

View Full Version : Mel scripts for cameras


IN_A_Fish_bowl
10-04-2005, 03:41 AM
I have several questions first i want to be able to mirror a duplicate of the persp camera so i can have a second camera following the persp camera on the mirrored axis, i set up a expression for mirroring a regular camera but could not get it right and am running out of ideas, if someone knows of a script that does this or can help me out with this thanks.

Second is i want to be able to toggle the orthographic veiwports (top,side,front) so the are linked together such as they are in lightwave.

Robert Bateman
10-04-2005, 11:25 AM
duplicate your camera, then in the hypergraph, connect cam1.translate to cam2.translate; cam1.scale to cam2.scale; cam1.rotate to cam2.rotate.

select the duplicate camera, ctrl+g to group, then change the scale to -1 on the group. ie, scaleZ = -1 to mirror in XY plane, scaleX = -1 to mirror in YZ plane etc.

i guess you could write a script to do that.... or just do it manually....

Robert Bateman
10-04-2005, 11:33 AM
select camera and run. Change the final setAttr command to scale in other axes...., ie ".scaleY", ".scaleZ"


{
$sl = `ls -sl`;
string $cam1 = $sl[0];
string $cam2[] = `duplicate -rr`;
connectAttr -f ($cam1+".translate") ($cam2[0]+".translate");
connectAttr -f ($cam1+".rotate") ($cam2[0]+".rotate");
connectAttr -f ($cam1+".scale") ($cam2[0]+".scale");
select -r $cam2[0];
$g = `group`;
xform -os -piv 0 0 0;
setAttr ($g+".scaleZ") -1;
}

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