Skip to content

Game and Editor camera#24

Merged
deanblackborough merged 1 commit intomainfrom
editor-and-game-cameras
Apr 19, 2026
Merged

Game and Editor camera#24
deanblackborough merged 1 commit intomainfrom
editor-and-game-cameras

Conversation

@deanblackborough
Copy link
Copy Markdown
Owner

@deanblackborough deanblackborough commented Apr 19, 2026

  • Game and editor camera
  • Follow player
  • Auto switch between cameras
  • Now have a limitless world

Summary by CodeRabbit

  • New Features

    • Introduced dual-camera system with editor and game modes for enhanced control.
    • Game camera now supports automatic player following.
    • Added camera mode selector and follow-player toggle in editor options.
  • Improvements

    • Enhanced property table with improved drag and selection controls.
    • Expanded scene statistics to display camera information.
    • Improved backward compatibility for existing scene files.

- Game and editor camera
- Follow player
- Auto switch between cameras
- Now have a limitless world
@deanblackborough deanblackborough self-assigned this Apr 19, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7275fc23-25ed-4214-b91f-db66fde4cc2b

📥 Commits

Reviewing files that changed from the base of the PR and between 364ee82 and d5c7136.

📒 Files selected for processing (12)
  • src/prune/scene/sandbox_scene.cpp
  • src/prune/scene/sandbox_scene.hpp
  • src/prune/scene/sandbox_scene_editor.cpp
  • src/prune/scene/sandbox_scene_serialization.cpp
  • src/prune/tooling/imgui/property_table.cpp
  • src/prune/tooling/imgui/property_table.hpp
  • src/prune/tooling/inspector.cpp
  • src/prune/tooling/options.cpp
  • src/prune/tooling/options.hpp
  • src/prune/tooling/stats.cpp
  • src/prune/tooling/stats.hpp
  • src/prune/tooling/ui.cpp

📝 Walkthrough

Walkthrough

This PR refactors the scene's camera system from a single m_camera member to a dual-camera architecture. A new CameraState structure now holds separate editor and game cameras, a mode selector, and game-specific options like follow-player behaviour. The public API is rebuilt to replace the old get_camera() method with specific accessors: get_editor_camera(), get_game_camera(), get_active_camera(), and get_camera_state(). The update flow gains automatic camera mode switching (game camera activates when player velocity is non-zero) and dedicated camera update logic. Serialization is extended to support the new cameras YAML section whilst maintaining backward compatibility with legacy single-camera saves.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

  • PR #17: Modifies the scene's camera model and related API surface across sandbox_scene, Options, Stats, and UI tooling—directly overlaps with this refactoring's structural changes.
  • PR #22: Extends sandbox_scene_serialization.cpp with the new cameras YAML format and backward-compatibility logic—shares the serialization implementation changes.
  • PR #21: Updates sandbox_scene's camera initialization and editor camera control flow—related through the camera handling expansion from single to dual-camera design.

Suggested labels

enhancement


A quick note as you review this: The pattern here is quite clean—you'll notice the same architectural shift (from single camera to dual-camera state) propagates consistently through the UI tooling and serialization layers. Pay particular attention to the backward-compatibility path in serialization; that's where subtle bugs can hide if legacy saves don't initialise the new camera state fields properly. Also verify that the automatic camera mode switching (when player velocity becomes non-zero) doesn't conflict with manual mode changes made via the Options UI. Good refactoring!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch editor-and-game-cameras

Comment @coderabbitai help to get the list of available commands and usage tips.

@deanblackborough deanblackborough merged commit 8b85c8e into main Apr 19, 2026
1 of 2 checks passed
@deanblackborough deanblackborough deleted the editor-and-game-cameras branch April 19, 2026 22:49
@coderabbitai coderabbitai Bot added the enhancement New feature or request label Apr 19, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant