First we need to get the camera object. Here is a quick example of selecting a camera called Main camera. Then we use ToCamera to get the VUECamera Class object so we can manipulate the camera specific settings.
[codesyntax lang=”python”]
DeselectAll()
SelectByName(“Main camera”)
Obj=GetSelectedObjectByIndex(0)
Camera = Obj.ToCamera()
[/codesyntax]
Once we have a VUECamera Class object we can get and set its settings. In this example we’ll get its exposure and increase it by 2.
[codesyntax lang=”python”]
DeselectAll()
SelectByName(“Main camera”)
Obj=GetSelectedObjectByIndex(0)
Camera = Obj.ToCamera()
Exposure=Camera.Exposure()
Exposure=Exposure+2
Camera.SetExposure (Exposure)
[/codesyntax]
Now we aren’t always going to be sure if an object is a camera or not. We can check if it is using isCamera.
[codesyntax lang=”python”]
DeselectAll()
SelectByName(“Main camera”)
Obj=GetSelectedObjectByIndex(0)
if Obj.IsCamera():
print “It’s a camera”
else:
print “It’s not a camera”
DeselectAll()
SelectByName(“Sun light”)
Obj=GetSelectedObjectByIndex(0)
if Obj.IsCamera():
print “It is a camera”
else:
print “It’s not a camera”
[/codesyntax]
If you want to check if the object you got back from ToCamera really is a VUECamera Class object:
[codesyntax lang=”python”]
DeselectAll()
SelectByName(“Main camera”)
Obj=GetSelectedObjectByIndex(0)
Camera = false
Camera = Obj.ToCamera()
if Camera:
print “It is a Camera”
DeselectAll()
SelectByName(“Sun light”)
Obj=GetSelectedObjectByIndex(0)
Camera2 = false
Camera2 = Obj.ToCamera()
if Camera2 is None:
print “It is not a Camera”
[/codesyntax]
Vue has quite a few functions for working just with the Camera object to get and set various Camera specific features:
- DepthOfField
- Exposure
- Focal
- FocusDistance
- HorizontalFilmShift
- LensAberration
- SetDepthOfField
- SetExposure
- SetFocal
- SetFocusDistance
- SetHorizontalFilmShift
- SetLensAberration
- SetVerticalFilmShift
- VerticalFilmShift
Feature | Command | Default | Example |
---|---|---|---|
Get the Camera’s Depth of Field Setting | DepthOfField () |
|
|
Set the Camera’s Depth of Field Setting | SetDepthOfField (float fNewDepthOfField) | 0.0 |
|
Get the Camera’s Exposure Setting | Exposure |
|
|
Set the Camera’s Exposure Setting | SetExposure (float fNewExposure) |
|
|
Get the Camera’s Focal Setting | Focal |
|
|
Set the Camera’s Focal Length | SetFocal (float fNewFocal) | 35.0 |
|
Get the Camera’s Focus Distance | FocusDistance () |
|
|
Set the Camera’s Focus Distance | SetFocusDistance (float fNewFocus) | 100.0 |
|
Get the Camera’s Horizontal Film Shift Setting | HorizontalFilmShift () |
|
|
Set the Camera’s Horizontal Film Shift Setting | Set Horizontal FilmShift (float fShift) |
|
|
Get the Camera’s Vertical Film Shift Setting | VerticalFilmShift () |
|
|
Set the Camera’s Vertical Film Shift Setting | SetVerticalFilmShift (float fShift) |
|
|
Get the Camera’s Lens Aberration Setting | LensAberration (float fAberration) |
|
|
Set the Camera’s Lens Aberration Setting | SetLensAberration (float fAberration) |
|
You can see more of these functions in action in two longer scripts I wrote to load and save camera settings as CSV files.