SimplyMaya Forums

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

Home / forum / Animation / Mel Scripts & Programming / Camera set up script
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 18-10-2005, 05:23 PM   #1
Grayth
Subscriber
 
Grayth's Avatar
 
Join Date: Oct 2003
Location: Brantford Ontario Canada
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Grayth is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.