layerview.visualization.world.camera module
Camera controllers.
- class layerview.visualization.world.camera.CameraController(camera: NodePath, camera_anchor: NodePath, focal_point, render: NodePath, mouse_watcher_node: MouseWatcher, win: GraphicsBuffer, speed: float)[source]
Bases:
DirectObject,ABCGeneric camera controller.
- _abc_impl = <_abc_data object>
- _addTask(task)
- property _camera_anchor_parent: NodePath
Return camera anchor’s parent.
- _clearTask(task)
- abstract _handle_mouse_pos_delta(delta_px_x: int, delta_px_y: int)[source]
Handle mouse position delta (change).
- abstract property _key_combo_to_direction: Dict[KeyCombo, LVector3d]
Return dict that maps KeyCombo to Direction.
- _on_mouse_button(mouse_button: MouseButton, is_pressed: bool)[source]
Handle mouse button event.
- accept(event, method, extraArgs=[])
- acceptOnce(event, method, extraArgs=[])
- accept_once(event, method, extraArgs=[])
- addTask(*args, **kwargs)
- add_task(*args, **kwargs)
- deactivate()[source]
Deactivate this controller.
Stops any ongoing camera movement. Stops any running tasks.
- detectLeaks()
- detect_leaks()
- doMethodLater(*args, **kwargs)
- do_method_later(*args, **kwargs)
- getAllAccepting()
- get_all_accepting()
- ignore(event)
- ignoreAll()
- ignore_all()
- isAccepting(event)
- isIgnoring(event)
- is_accepting(event)
- is_ignoring(event)
- removeAllTasks()
- removeTask(taskOrName)
- remove_all_tasks()
- remove_task(taskOrName)
- class layerview.visualization.world.camera.Direction(value)[source]
Bases:
EnumRepresents a direction vector.
- BACKWARD = LVector3d(0, -1, 0)
- DOWN = LVector3d(0, 0, -1)
- FORWARD = LVector3d(0, 1, 0)
- LEFT = LVector3d(-1, 0, 0)
- RIGHT = LVector3d(1, 0, 0)
- UP = LVector3d(0, 0, 1)
- class layerview.visualization.world.camera.FreeCameraController(camera: NodePath, camera_anchor: NodePath, focal_point: LVector3d, render: NodePath, mouse_watcher_node: MouseWatcher, win, speed: float | None = 1.0)[source]
Bases:
CameraControllerFree camera controller.
Allows rotation around the camera’s position.
- _KEY_COMBO_TO_DIRECTION: Dict[KeyCombo, LVector3d] = {<KeyCombo.W: 1>: LVector3d(0, 1, 0), <KeyCombo.A: 2>: LVector3d(-1, 0, 0), <KeyCombo.S: 3>: LVector3d(0, -1, 0), <KeyCombo.D: 4>: LVector3d(1, 0, 0), <KeyCombo.SPACE: 5>: LVector3d(0, 0, 1), <KeyCombo.SHIFT_SPACE: 6>: LVector3d(0, 0, -1)}
- _abc_impl = <_abc_data object>
- _addTask(task)
- _camera: NodePath
- _camera_anchor: NodePath
- property _camera_anchor_parent: NodePath
Return camera anchor’s parent.
- _clearTask(task)
- _continue_tasks: bool
- _handle_mouse_pos_delta(delta_px_x: int, delta_px_y: int)[source]
Handle mouse position delta (change).
- property _key_combo_to_direction: Dict[KeyCombo, LVector3d]
Return dict that maps KeyCombo to Direction.
- static _limit_hpr(val: float) float
Sanitize the provided heading/pitch/rotation value.
- _mouse_button_to_is_pressed: Dict[MouseButton, bool]
- _mouse_watcher_node: NodePath
- _on_mouse_button(mouse_button: MouseButton, is_pressed: bool)
Handle mouse button event.
- _print_camera_status()
Print camera (and camera anchor’s) position and HPR.
- _render: NodePath
- _setup_input()
Setup keyboard event listeners.
- _setup_tasks()
Setup this controller’s tasks.
- _task_handle_key(task)
Handle keypress event.
This is a task function.
- _task_handle_mouse(task)
Handle mouse move event.
This is a task function.
- accept(event, method, extraArgs=[])
- acceptOnce(event, method, extraArgs=[])
- accept_once(event, method, extraArgs=[])
- addTask(*args, **kwargs)
- add_task(*args, **kwargs)
- deactivate()
Deactivate this controller.
Stops any ongoing camera movement. Stops any running tasks.
- detectLeaks()
- detect_leaks()
- doMethodLater(*args, **kwargs)
- do_method_later(*args, **kwargs)
- getAllAccepting()
- get_all_accepting()
- ignore(event)
- ignoreAll()
- ignore_all()
- isAccepting(event)
- isIgnoring(event)
- is_accepting(event)
- is_ignoring(event)
- removeAllTasks()
- removeTask(taskOrName)
- remove_all_tasks()
- remove_task(taskOrName)
- stop_movement()
Stop any ongoing camera movement.
- class layerview.visualization.world.camera.KeyCombo(value)[source]
Bases:
EnumRepresents a keyboard key combination (aka key combo).
- A = 2
- D = 4
- S = 3
- SHIFT_SPACE = 6
- SPACE = 5
- W = 1
- class layerview.visualization.world.camera.MouseButton(value)[source]
Bases:
EnumRepresents a mouse button
- LEFT = 1
- MIDDLE = 2
- RIGHT = 3
- class layerview.visualization.world.camera.OrbitCameraController(camera: NodePath, camera_anchor: NodePath, focal_point: LVector3d, render: NodePath, mouse_watcher_node: MouseWatcher, win, speed: float | None = 1.0, distance_min: float | None = 1, distance_max: float | None = 2000)[source]
Bases:
CameraControllerOrbit camera controller (spherical).
Allows for rotation around a distant focal point. The camera is always focused on the focal point.
- _KEY_COMBO_TO_DIRECTION: Dict[KeyCombo, LVector3d] = {<KeyCombo.W: 1>: LVector3d(0, -1, 0), <KeyCombo.A: 2>: LVector3d(1, 0, 0), <KeyCombo.S: 3>: LVector3d(0, 1, 0), <KeyCombo.D: 4>: LVector3d(-1, 0, 0), <KeyCombo.SPACE: 5>: LVector3d(0, 0, 1), <KeyCombo.SHIFT_SPACE: 6>: LVector3d(0, 0, -1)}
- _abc_impl = <_abc_data object>
- _addTask(task)
- _camera: NodePath
- _camera_anchor: NodePath
- property _camera_anchor_parent: NodePath
Return camera anchor’s parent.
- _clearTask(task)
- _continue_tasks: bool
- _handle_mouse_pos_delta(delta_px_x: int, delta_px_y: int)[source]
Handle mouse position delta (change).
- property _key_combo_to_direction: Dict[KeyCombo, LVector3d]
Return dict that maps KeyCombo to Direction.
- static _limit_hpr(val: float) float
Sanitize the provided heading/pitch/rotation value.
- _mouse_button_to_is_pressed: Dict[MouseButton, bool]
- _mouse_watcher_node: NodePath
- _on_mouse_button(mouse_button: MouseButton, is_pressed: bool)
Handle mouse button event.
- _print_camera_status()
Print camera (and camera anchor’s) position and HPR.
- _render: NodePath
- _setup_input()
Setup keyboard event listeners.
- _setup_tasks()
Setup this controller’s tasks.
- _task_handle_key(task)
Handle keypress event.
This is a task function.
- _task_handle_mouse(task)
Handle mouse move event.
This is a task function.
- accept(event, method, extraArgs=[])
- acceptOnce(event, method, extraArgs=[])
- accept_once(event, method, extraArgs=[])
- addTask(*args, **kwargs)
- add_task(*args, **kwargs)
- deactivate()
Deactivate this controller.
Stops any ongoing camera movement. Stops any running tasks.
- detectLeaks()
- detect_leaks()
- doMethodLater(*args, **kwargs)
- do_method_later(*args, **kwargs)
- getAllAccepting()
- get_all_accepting()
- ignore(event)
- ignoreAll()
- ignore_all()
- isAccepting(event)
- isIgnoring(event)
- is_accepting(event)
- is_ignoring(event)
- removeAllTasks()
- removeTask(taskOrName)
- remove_all_tasks()
- remove_task(taskOrName)
- stop_movement()
Stop any ongoing camera movement.