SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Camera set up script

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
18-10-2005, 05:23 PM   #1
Grayth
Subscriber
 
Grayth's Avatar
 
Join Date: Oct 2003
Location: Brantford Ontario Canada
Posts: 43
Camera set up script
Hey everyone, Ok I decided to make my camera setup that I use alot into a script and would like it to do a few things but can't figure out how to add it in...

Right now the script below creates a camera and then I add in 4 nodes...xyz_translate, yRotate, xrotate, zRotate. With all the extra attributes for each group node locked out..

Why do I like this, well makes for a nice easy clean way to animate the camera.

but what I would like to add into the script is the ability to create another camera. Right now if I run it twice, it creates additional groups in the first camera...I think this because it's not looking to see if I have this set up already, and so it can't create another camera with a similiar grouping..not sure how to fix this..

here's the script

camera -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1 -horizontalFilmAperture 1.41732 -horizontalFilmOffset 0 -verticalFilmAperture 0.94488 -verticalFilmOffset 0 -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 144 -nearClipPlane 0.01 -farClipPlane 1000 -orthographic 0 -orthographicWidth 30; objectMoveCommand; cameraMakeNode 3 "";
select -r camera1_group ;
group; xform -os -piv 0 0 0;
group; xform -os -piv 0 0 0;
group; xform -os -piv 0 0 0;
group; xform -os -piv 0 0 0;
rename |group4 "XYZ_Trans";
// Result: XYZ_Trans //
select -r group3 ;
rename |XYZ_Trans|group3 "Yrot_Pan";
// Result: Yrot_Pan //
rename |XYZ_Trans|Yrot_Pan|group2 "Xrot_Tilt";
// Result: Xrot_Tilt //
rename |XYZ_Trans|Yrot_Pan|Xrot_Tilt|group1 "Zrot_Roll";
// Result: Zrot_Roll //
lookThroughModelPanelClipped Yrot_Pan modelPanel4 0.001 1000;
setAttr -lock true "camera1.tx";
setAttr -lock true "camera1_aim.tx";
setAttr -lock true "camera1_up.tx";
setAttr -lock true "camera1.ty";
setAttr -lock true "camera1_aim.ty";
setAttr -lock true "camera1_up.ty";
setAttr -lock true "camera1.tz";
setAttr -lock true "camera1_aim.tz";
setAttr -lock true "camera1_up.tz";
setAttr -lock true "camera1.rx";
setAttr -lock true "camera1_aim.rx";
setAttr -lock true "camera1_up.rx";
setAttr -lock true "camera1.ry";
setAttr -lock true "camera1_aim.ry";
setAttr -lock true "camera1_up.ry";
setAttr -lock true "camera1.rz";
setAttr -lock true "camera1_aim.rz";
setAttr -lock true "camera1_up.rz";
setAttr -lock true "camera1.sx";
setAttr -lock true "camera1_aim.sx";
setAttr -lock true "camera1_up.sx";
setAttr -lock true "camera1.sy";
setAttr -lock true "camera1_aim.sy";
setAttr -lock true "camera1_up.sy";
setAttr -lock true "camera1.sz";
setAttr -lock true "camera1_aim.sz";
setAttr -lock true "camera1_up.sz";
select -cl ;
pickWalk -d up;
// Result: XYZ_Trans //
setAttr -lock true "XYZ_Trans.rx";
setAttr -lock true "XYZ_Trans.ry";
setAttr -lock true "XYZ_Trans.rz";
setAttr -lock true "XYZ_Trans.sx";
setAttr -lock true "XYZ_Trans.sy";
setAttr -lock true "XYZ_Trans.sz";
select -cl ;
pickWalk -d down;
// Result: XYZ_Trans //
pickWalk -d down;
// Result: Yrot_Pan //
setAttr -lock true "Yrot_Pan.tx";
setAttr -lock true "Yrot_Pan.ty";
setAttr -lock true "Yrot_Pan.tz";
setAttr -lock true "Yrot_Pan.rx";
setAttr -lock true "Yrot_Pan.rz";
setAttr -lock true "Yrot_Pan.sx";
setAttr -lock true "Yrot_Pan.sy";
setAttr -lock true "Yrot_Pan.sz";
setAttr -lock true "Yrot_Pan.v";
select -cl ;
pickWalk -d down;
// Result: XYZ_Trans //
pickWalk -d down;
// Result: Yrot_Pan //
pickWalk -d down;
// Result: Xrot_Tilt //
setAttr -lock true "Xrot_Tilt.tx";
setAttr -lock true "Xrot_Tilt.ty";
setAttr -lock true "Xrot_Tilt.tz";
setAttr -lock true "Xrot_Tilt.ry";
setAttr -lock true "Xrot_Tilt.rz";
setAttr -lock true "Xrot_Tilt.sx";
setAttr -lock true "Xrot_Tilt.sy";
setAttr -lock true "Xrot_Tilt.sz";
setAttr -lock true "Xrot_Tilt.v";
select -cl ;
pickWalk -d up;
// Result: XYZ_Trans //
pickWalk -d down;
// Result: Yrot_Pan //
pickWalk -d down;
// Result: Xrot_Tilt //
pickWalk -d down;
// Result: Zrot_Roll //
setAttr -lock true "Zrot_Roll.tx";
setAttr -lock true "Zrot_Roll.ty";
setAttr -lock true "Zrot_Roll.tz";
setAttr -lock true "Zrot_Roll.rx";
setAttr -lock true "Zrot_Roll.ry";
setAttr -lock true "Zrot_Roll.sx";
setAttr -lock true "Zrot_Roll.sy";
setAttr -lock true "Zrot_Roll.sz";
setAttr -lock true "Zrot_Roll.v";
select -cl ;
pickWalk -d up;
// Result: XYZ_Trans //
pickWalk -d up;
// Result: XYZ_Trans //
pickWalk -d down;
// Result: Yrot_Pan //
pickWalk -d down;
// Result: Xrot_Tilt //
pickWalk -d down;
// Result: Zrot_Roll //
pickWalk -d down;
// Result: camera1_group //
pickWalk -d down;
// Result: camera1 //
select -cl ;


Thanks,

Troy
__________________
Think Twice Split Poly Once
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textures not linking to tutorial maya.... dan003 Maya Basics & Newbie Lounge 2 07-03-2015 11:08 PM
changing the "Quick help" window size in the maya 2012 script editor. Jouri Programming 3 27-11-2011 06:15 AM
Changing camera behavior in a large set Mike45450 Maya Basics & Newbie Lounge 1 31-01-2010 07:26 AM
Camera setup script finished..enjoy Grayth Programming 0 25-10-2005 07:41 PM
LW style set keys script PacManiac Programming 0 23-04-2005 01:30 PM