Skip to content

Camera related George functions

Camera related George functions.

TVPCamera(width: int, height: int, field_order: FieldOrder, frame_rate: float, pixel_aspect_ratio: float, anti_aliasing: int) dataclass

TVPaint camera info values.

TVPCameraPoint(x: float, y: float, angle: float, scale: float) dataclass

camera 2D point info.

tv_camera_info_get() -> TVPCamera

Get the information of the camera.

Source code in pytvpaint/george/grg_camera.py
37
38
39
def tv_camera_info_get() -> TVPCamera:
    """Get the information of the camera."""
    return TVPCamera(**tv_parse_list(send_cmd("tv_CameraInfo"), with_fields=TVPCamera))

tv_camera_info_set(width: int | None = None, height: int | None = None, field_order: FieldOrder | None = None, frame_rate: float | None = None, pixel_aspect_ratio: float | None = None) -> TVPCamera

Set the information of the camera.

Source code in pytvpaint/george/grg_camera.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def tv_camera_info_set(
    width: int | None = None,
    height: int | None = None,
    field_order: FieldOrder | None = None,
    frame_rate: float | None = None,
    pixel_aspect_ratio: float | None = None,
) -> TVPCamera:
    """Set the information of the camera."""
    optional_args = [
        (width, height),
        field_order.value if field_order else None,
        frame_rate,
        pixel_aspect_ratio,
    ]

    args = validate_args_list(optional_args)

    result = send_cmd("tv_CameraInfo", *args)
    return TVPCamera(**tv_parse_list(result, with_fields=TVPCamera))

tv_camera_enum_points(index: int) -> TVPCameraPoint

Get the position/angle/scale values of the n-th point of the camera path.

Source code in pytvpaint/george/grg_camera.py
63
64
65
66
def tv_camera_enum_points(index: int) -> TVPCameraPoint:
    """Get the position/angle/scale values of the n-th point of the camera path."""
    res = send_cmd("tv_CameraEnumPoints", index, error_values=[GrgErrorValue.NONE])
    return TVPCameraPoint(**tv_parse_list(res, with_fields=TVPCameraPoint))

tv_camera_interpolation(position: float) -> TVPCameraPoint

Get the position/angle/scale values at the given position on the camera path (between 0 and 1).

Source code in pytvpaint/george/grg_camera.py
69
70
71
72
73
74
75
def tv_camera_interpolation(position: float) -> TVPCameraPoint:
    """Get the position/angle/scale values at the given position on the camera path (between 0 and 1)."""
    res = tv_parse_list(
        send_cmd("tv_CameraInterpolation", position),
        with_fields=TVPCameraPoint,
    )
    return TVPCameraPoint(**res)

tv_camera_insert_point(index: int, x: float, y: float, angle: float, scale: float) -> None

Add a point to the camera path before the given index.

Source code in pytvpaint/george/grg_camera.py
78
79
80
81
82
83
84
85
86
def tv_camera_insert_point(
    index: int,
    x: float,
    y: float,
    angle: float,
    scale: float,
) -> None:
    """Add a point to the camera path *before* the given index."""
    send_cmd("tv_CameraInsertPoint", index, x, y, angle, scale)

tv_camera_remove_point(index: int) -> None

Remove a point at the given index.

Source code in pytvpaint/george/grg_camera.py
89
90
91
def tv_camera_remove_point(index: int) -> None:
    """Remove a point at the given index."""
    send_cmd("tv_CameraRemovePoint", index)

tv_camera_set_point(index: int, x: float, y: float, angle: float, scale: float) -> None

Set position/angle/scale value of a point at the given index and make it current.

Source code in pytvpaint/george/grg_camera.py
 94
 95
 96
 97
 98
 99
100
101
102
def tv_camera_set_point(
    index: int,
    x: float,
    y: float,
    angle: float,
    scale: float,
) -> None:
    """Set position/angle/scale value of a point at the given index and make it current."""
    send_cmd("tv_CameraSetPoint", index, x, y, angle, scale)