Used for camera operations.
Multiple cameras can be used in a scene. The camera class expresses one of them.
xshade |
↑ |
scene |
↑ |
camera |
load | Loads camera settings from a file |
memorize_as_camera | Creates a camera object from the current camera's field of view |
memorize_as_line_object | Creates a line object from the current camera's line of sight |
memorize_as_metacamera | Creates a meta-camera from the current camera's field of view |
memorize_as_spotlight | Creates a spotlight from the current camera's field of view |
restore_from_default | Restores the camera to the default state |
restore_from_object | Applies the object passed as an argument to the camera settings |
rotate_eye | Rotates the eye about the Y axis |
save | Saves the camera settings to a file |
bank | The camera bank |
camera_mode | The camera mode |
camera_object | The camera object |
correction | Tilt correction |
distant_camera | Parallel projection on/off |
eye | The eye position |
film_rise | Film rise |
film_shift | Film shift |
film_swing | Film swing |
film_tilt | Film tilt |
focus | Depth of field focus |
focus_point | Depth of field focus point |
lens_swing | Lens swing |
lens_tilt | Lens tilt |
rise | Rise |
scale | Scale |
shift | Shift |
target | Target position |
world_to_perspective_matrix | World coordinates to camera perspective coordinates transformation matrix |
world_to_view_matrix | World coordinates to camera view coordinates transformation matrix |
zoom | Focal distance |
load load
Loads camera settings from a file.
Arguments :
file_path
See also :
save
#Load camera settings
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(True, '*.shdcmr|shdcmr')
xshade.scene().camera.load(file_path)
memorize_as_camera
Creates a camera object from the current camera's field of view.
xshade.scene().camera.memorize_as_camera()
memorize_as_line_object
Creates a line object from the current camera's line of sight.
xshade.scene().camera.memorize_as_line_object()
memorize_as_metacamera
Creates a meta-camera from the current camera's field of view.
xshade.scene().camera.memorize_as_metacamera()
memorize_as_spotlight
Creates a spotlight from the current camera's field of view
xshade.scene().camera.memorize_as_spotlight()
restore_from_default
Restores the camera to the default state
xshade.scene().camera.restore_from_default()
restore_from_object
Applies the object passed as an argument to the camera settings.
Arguments :
shape object : line object, spotlight
#Apply the selected object (line object or spotlight) to the camera settings
obj = xshade.scene().active_shape()
xshade.scene().camera.restore_from_object(obj)
rotate_eye
Rotates the eye about the Y axis.
Type :
radian
#Rotate the camera 90 degrees about the Y axis
rad = 3.141592 / 180 * 90
xshade.scene().camera.rotate_eye(rad)
save
Saves the camera settings to a file.
Arguments :
file_path
See also :
load
#Save the camera settings
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(False, '*.shdcmr|shdcmr')
xshade.scene().camera.save(file_path)
bank
The camera bank.
Type :
radian : Displayed in degrees in the Camera Window.
print xshade.scene().camera.bank
camera_mode
The camera mode.
Type :
int : 0 : Normal, 1 : Top, 2 : Free
print xshade.scene().camera.camera_mode
camera_object
The camera object.
The camera object currently selected in the Camera Window, other than a meta-camera.
#Output the name of the selected camera object
print xshade.scene().camera.camera_object.name
correction
Tilt correction.
Type :
float
print xshade.scene().camera.correction
distant_camera
Parallel projection on/off.
Type :
bool
print xshade.scene().camera.distant_camera
eye
The eye position.
Type :
vec3
print xshade.scene().camera.eye
film_rise
Film rise.
Type :
float
print xshade.scene().camera.film_rise
film_shift
Film shift.
Type :
float
print xshade.scene().camera.film_shift
film_swing
Film swing.
Type :
float
print xshade.scene().camera.film_swing
film_tilt
Film tilt.
Type :
float
print xshade.scene().camera.film_tilt
focus
Depth of field focus.
Type :
float
print xshade.scene().camera.focus
focus_point
Depth of field focus point.
Type :
vec3
print xshade.scene().camera.focus_point
lens_swing
Lens swing.
Type :
float
print xshade.scene().camera.lens_swing
lens_tilt
Lens tilt.
Type :
float
print xshade.scene().camera.lens_tilt
rise
Rise.
Type :
float
print xshade.scene().camera.rise
scale
Scale.
Type :
float
print xshade.scene().camera.scale
shift
Shift.
Type :
float
print xshade.scene().camera.shift
target
Target position.
Type :
vec3
print xshade.scene().camera.target
world_to_perspective_matrix
World coordinates to camera perspective coordinates transformation matrix.
Type :
mat4
Applies a matrix with eye at the origin which rotates, translates, and normalizes the world coordinates based on the camera position, direction, and bank, and aligns the line of sight with the Z axis.
Normalizes the coordinates in the field of view to fit within -1.0 and 1.0 vertically and horizontally, and within 0.0 and 1.0 in depth. Because coordinates outside this range are outside the field of view, clipping will be performed on those coordinates.
print xshade.scene().camera.world_to_perspective_matrix
world_to_view_matrix
World coordinates to camera view coordinates transformation matrix.
Type :
mat4
Applies a matrix with eye at the origin which rotates and translates the world coordinates based on the camera position, direction, and bank, and aligns the line of sight with the Z axis.
Perspective transformation is not done.
print xshade.scene().camera.world_to_view_matrix
zoom
Focal distance.
Type :
float
print xshade.scene().camera.zoom