camera filmback mel
hi there,
iam writing a simple script that will change the filmback settings of the camera and the settings of the render globals, so i have a global proc. and here is the mel: global proc cameraSetUp () { select perspShape; setAttr perspShape.horizontalFilmAperture 0.85; setAttr perspShape.verticalFilmAperture 0.466; setAttr perspShape.lensSqueezeRatio 1.0; setAttr defaultResolution.aspectLock true; setAttr defaultResolution.width 2048; setAttr defaultResolution.height 1108; camera -e -displayFilmGate on -displayResolution off -filmFit fill -displaySafeAction on -overscan 1.3 persp; } all of the settings in the render globals works fine, but the filmback of the camera did not change, no error in the script editor. then i checked the AEcameraFilmbackNew.mel and saw that the script is executing the default filmback attribute of the camera. THE QUESTION IS: HOW CAN I MAKE THE DEFAULT FILMBACK SETTING OF THE CAMERA'S FILMGATE TO "35mm 1.85 projection"? IS THERE SOMETHING MISSING IN MY SCRIPT? thanx for the help. :rolleyes: |
If you check the Script Editor when you change this (with Echo All Commands turned on), you'll see that changing the 'Film Gate' only calls AE... functions - (AE functions are for changing things in the Attribute Editor)
In the code that comes up for me, the following variables are mentioned: perspShape.horizontalFilmAperture perspShape.verticalFilmAperture perspShape.lensSqueezeRatio perspShape.focalLength So the variables in here are the only ones that you need to change to set it up - the drop down box itself just tells it to set these variables to a group of presets. |
gotcha hugh, thanx.
one more thing, if an object was declared as string e.g. string $camera [] = `ls -sl`; and we now tha some of the camera attributes has a boolean data type, how should i shift from string to boolean? |
`ls -sl`will return names of all selected objects. In your example you are storing the names in a string array. To get a value of an attribute of some selected object you use the getAttr command. An example:
Let's say we want to find out if a poly object (a mesh) called myObjectShape is in the selection and if it's displayVertices attribute is set. Code:
string $sSel[] = `ls -sl -dag -typ mesh`; // Notice the use of -dag and -typ switches. |
AAAAAAAAA!!!!! MY EYES!!!!
ok I removed the comments just for brevity, but not as a style comment. Once again, a "for-in" loop will clean this puppy right up, and some curly-brackets have been removed: Code:
string $sSel[] = `ls -sl -dag -typ mesh`; |
Mark: what's the difference between:
foreach($currSelection in $sSel) and for($currSelection in $sSel) ? |
Didn't know you can write:
Code:
foreach($foo in $bar) Thanks. |
thanx to you guys, this is a kind of great help for my
first little script. so what is the type for the on and off of the resoution gate of the camera? |
What's the MEL command to turn it off, you mean? Cos the type is a bool....
The command is: camera -e -displayFilmGate $filmGate -displayResolution $resGate -overscan $overscan $camName; where $filmGate and $resGate are booleans (true/on/1 or false/off/0), $overscan is a float and $camName is the name of the camera. |
hahahaha my computer language neurons are screwed up. "foreach" isn't a MEL thing, it's C-shell.
I've edited my earlier post. -- Mark |
what i mean hugh is from mark and kbrown's example:
string $sSel[] = `ls -sl -dag -typ mesh`; i want to be like this for my script: string $camera[] = `ls -sl -dag -typ ?????`; i'm just asking for the type so that i can define the booleans as integer, then i'm done with my script. |
not "-type camera"?
-- Mark |
is this answer ?
string $camera [] = `ls -sl -dag -type camera`; |
Why not try it and find out?
of course you can always use ls -sl -showType to see what type the selected object is, then use that type as an argument to the -type flag... -- Mark |
thanx
|
All times are GMT. The time now is 03:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018