Skip to content
Edit this page

Editor Guide

A comprehensive guide to Pite's integrated visual scene editor and code environment.

Pite provides an all-in-one desktop editor that combines an interactive scene tree, a real-time GPU viewport, an inspector for node properties, an asset file manager, and an embedded code editor with full Python language server support.

Editor Window

Launch the editor from your terminal by running:

Terminal
pite

(Or explicitly with pite edit [path/to/scene.ptscn]).


Editor Interface

The workspace is organized into five functional regions:

  • Top Bar: Menu bar containing Scene, Project, and Help menus, alongside Play (▶) and Stop (■) buttons.
  • Viewport (Center): Displays the real-time rendered scene framed at your project's design resolution.
  • Code Tab (Center): Built-in code editor for writing Python scripts with syntax highlighting and LSP completion.
  • Scene Tree (Top-Left): Hierarchical tree showing all nodes in the active scene.
  • Assets Panel (Bottom-Left): Full-featured project file browser and asset manager.
  • Inspector (Right): Contextual property inspector with inheritance-grouped properties.
  • Console (Bottom): Real-time scrolling output for engine logs, print statements, and error traces.

Viewport and Playtesting

The Viewport renders your game using the same camera and rendering pipeline as the standalone game runner:

  • Resolution Scaling: The viewport automatically contain-fits your game's design resolution (configured in pite.toml) into the available panel space, preserving your aspect ratio with clean letterboxing.
  • Pan & Zoom: While editing, pan with middle-mouse drag or Space + left-drag, zoom around the cursor (0.25x–8.0x) with the scroll wheel or trackpad pinch, and press Ctrl+0 (or click Reset in the top-right zoom HUD) to return to 100%. Play mode resets framing to 1:1.
  • Viewport Edit Modes: The top-left viewport toolbar provides four Godot-style edit modes alongside the Snap (16px grid) toggle, with each drag recorded as a single undoable step:
    • Select (Q): Shows a bounding box around the selected node (with 8 resize handles for Control nodes outside Containers; hold Shift to keep aspect ratio). Drag inside a bounding box to move (or click another node to select and drag it), right-click to pick from overlapping nodes under the cursor, or hold Ctrl (Rotate), Alt (Move), or Ctrl+Alt (Resize) for temporary mode overrides.
    • Move (W): Shows 2-axis X/Y move arrows and locks selection to the Scene Tree. Drag anywhere in the viewport to move the selected node, or hold Shift to lock to a single axis.
    • Rotate (E): Shows the bounding box and rotates the selected node on drag. Hold Shift to snap to 15° steps.
    • Resize (S): Shows 2-axis resize gizmos for Control nodes and resizes on drag. Hold Shift to keep aspect ratio.
  • Playtesting: Press the Play (▶) icon or Ctrl+R / F5 to start gameplay simulation directly in the viewport; a fresh run saves the open scene and script first. Press Ctrl+R / F5 again to pause, and Stop (■) or Shift+F5 to reset playback. These shortcuts work with the pointer over the game viewport but are ignored while typing in a text field. Saving a scene during a playtest pauses simulation and shows a warning instead of writing playtest state to disk by default; the warning defaults to Skip, with Save Anyway available when the playtest state is intentional. Script saves still trigger live code reload.

Input Forwarding

Keyboard and mouse events are routed to your running scene whenever the cursor is inside the viewport area. Moving the mouse outside the viewport gives priority back to the code editor and global shortcuts.

Workspace Trust and Safe Mode

When you open a folder that has not been trusted yet (for example, a newly cloned repository), the editor opens it in Safe Mode:

  • Zero-execution inspection: The scene tree, viewport preview, property inspector, assets browser, and code editor (including Pyright diagnostics) work normally, while Python script execution and .py hot reloading stay disabled.
  • Trusting a workspace: Click Trust Workspace in the top Safe Mode banner, or press Play (▶ / Ctrl+R / F5) and choose Trust & Play in the confirmation modal.
  • Persistence: Trust decisions are stored per user in trusted_workspaces.toml inside your Pite config directory (next to recent.json, never inside the project repo). Projects created with pite new are trusted automatically.

Scene Tree

The Scene Tree displays the node hierarchy of your current scene, complete with Phosphor icons and color coding per category (2D in blue, physics in teal, UI in green, and timers in gold).

Adding Nodes

Click the + (Add) button in the Scene Tree header or right-click any node and choose Add Child Node… to open the creation dialog:

  • Inheritance Tree & Search: Browse the Godot-style inheritance tree or use the instant search bar to find node types quickly.
  • Node Descriptions: Selecting a type shows its purpose, inherited capabilities, and typical use cases.
  • Placement: The newly created node is automatically inserted directly under the currently selected node (or root), expanding the parent branch.

Node Instantiation

To instantiate another .ptscn scene as a sub-tree:

  • Press Ctrl+Shift+A or choose Instantiate Child Scene… from the context menu to pick a scene file.
  • Or drag a .ptscn file directly from the Assets panel into the Scene Tree.

Reordering and Parenting

The Scene Tree supports drag-and-drop with activation thresholds to prevent accidental drags:

  • 3-2 Drop Zones:
    • Center band: Drop onto the center of a row to reparent as a child (indicated by a teal bounding box).
    • Bottom band: Drop near the bottom edge to insert as a sibling immediately after.
    • Top edge (first child): Drop on the top edge of the first child to insert before it.
  • Drag Preview Badge: A floating preview card follows the cursor, showing the dragged node's icon, name, and destination target.

Node Management

Right-click any node in the tree or use keyboard shortcuts:

  • Duplicate (Ctrl+D): Recursively clones the node, its entire subtree, and all overridden properties.
  • Rename (F2): Opens an in-place rename dialog.
  • Delete (Del): Removes the node and its children (the root node is protected).
  • Move Up / Move Down: Reorders siblings in the tree.
  • Attach Script: Choose Attach Script… or drag any .py file from the Assets panel onto the node.

Property Inspector

Selecting any node in the Scene Tree populates the Inspector on the right with an inheritance-grouped layout reflecting the engine's class hierarchy:

▼ CharacterBody2D
    velocity: [0.0, 0.0]
    up_direction: [0.0, -1.0]
▼ Node2D
    position: [640.0, 360.0]
    rotation: 0.0
    scale: [1.0, 1.0]
▼ Node
    name: "Player"

Inheritance Sections and Revert Buttons

  • Inheritance Grouping: Properties are organized in collapsible groups corresponding to each ancestor class (e.g. CharacterBody2D inherits from Node2D, which inherits from Node).
  • Revert to Default: Overridden properties display a subtle revert button next to their label, allowing you to reset any field back to its engine default with one click.
  • Drag-and-Drop Assignment: Drag images (.png) or atlases (.ptatlas) from the Assets panel directly onto texture and atlas fields in the Inspector.

Editable Property Types

Pite maps engine types directly to interactive controls:

Property Type Editor Control Behavior
Floating point (Num) DragValue Click and drag horizontally to tune; double-click to type
Integer (Int) Integer DragValue Step values or direct integer entry
Text (Str) Text Edit Direct single-line string input
Boolean (Bool) Checkbox Toggle on / off
Vector (Vec2) Dual DragValues Independent x and y coordinate fields
Color (Color) Swatch + Hex Picker Color swatch button with alpha popup and hex edit

Script Attachments

The script attachment section at the bottom displays:

  • Path: The res:// path pointing to the script file (always relative to the project root).
  • Class: The name of the Python class inside the script.
  • Open Script: Switches the central panel to the Code tab and loads the attached file.
  • Remove Script: Detaches the script from the node.

Assets Panel File Manager

The Assets Panel is a full-featured project file browser:

  • Directory Tree: Folders are sorted first alphabetically with empty folders preserved, followed by files alphabetically. Single-click selects an asset with highlight; double-click opens files (or toggles folders).
  • Header Actions: Quick + File and + Folder buttons open modal dialogs with starter templates:
    • Script (.py): Generates a starter script inheriting pite.Node.
    • Scene (.ptscn): Scaffolds a minimal valid scene with a root node.
    • Empty File / Folder: Creates a blank item.
  • Context Menu & Shortcuts:
    • Create New…: Submenu with New File…, New Script, New Scene, New Atlas…, and New Folder….
    • Cut (Ctrl+X), Copy (Ctrl+C), Paste (Ctrl+V)
    • Duplicate (Ctrl+D)
    • Rename (F2): Renames the asset on disk and automatically rewrites references across scenes and scripts via pite_assets::apply_renames.
    • Delete (Del): Deletes the item with a confirmation modal.
    • Copy Relative Path and Copy Absolute Path
    • Show in File Manager: Reveals the item in your operating system's native file explorer.
  • Drag-and-Drop Ingestion: Drag files or folders directly from your operating system into the Assets panel. Pite copies them to the target directory, applies collision suffixes (file (1).ext) if needed, and triggers an asset reimport.
  • Internal Moving: Dragging files or folders onto other directories moves them on disk with cycle protection and automatic reference updates.
  • Cross-Panel Dragging: Drag .py scripts onto Scene Tree nodes to attach them; drag .png or .ptatlas onto Inspector fields to assign properties.

Code Editor and Autocomplete

Clicking any script in the Assets browser or choosing Open Script switches the central view to the Code tab.

Features

  • Syntax Highlighting: Colors Python keywords, strings, function definitions, numbers, and comments.
  • Error Gutter: Line numbers line the left margin. Lines encountering runtime errors or syntax issues display diagnostic badges with hover tooltips.
  • Live Code Reload: Saving a script (Ctrl+S) while the game is playing updates logic in real time via hot reloading.

Language Server Integration

The editor integrates with Pyright using the Language Server Protocol (LSP) to provide intelligent autocomplete and type checking:

Terminal
pip install "pyright==1.1.411"

When Pyright is available on your system PATH:

  • Autocomplete: As you type, suggestions appear in a contextual popup. Press Ctrl+Space to trigger completion anywhere, and Enter to accept.
  • Signature Help: Typing an opening parenthesis ( displays function parameters and docstrings.
  • Type Hover: Press Ctrl+H over any variable or method to view type signatures.
  • Engine Stubs: Pite bundles complete type stubs (pite.pyi), enabling autocompletion for all engine classes, properties, and signals without extra configuration.

Typing Outside the Editor

The editor injects the stubs into Pyright automatically. For an external IDE (VS Code with Pylance, or any Pyright-based setup), install the published stub package as a development dependency:

Terminal
pip install pite-stubs

The distribution is stub-only and versions in lockstep with the engine. It installs a pite package containing only __init__.pyi + py.typed, so import pite resolves for the checker and raises a clear error at runtime (the module is native and exists only inside the interpreter Pite embeds). Scripts still run through pite edit / pite run.


Tilemap Editing

When a TileMap2D node is selected in the scene tree:

  • Inspector Tilemap Panel:
    • Active layer switcher and layer toggles (visible, collision_enabled).
    • Tool mode switcher: Brush (paint selected tile) vs Eraser (erase tile).
    • Tile palette displaying all named frames in the referenced atlas.
  • Interactive Viewport Painting:
    • Hovering over the viewport displays a snapped tile preview rectangle at the grid cell.
    • Left-clicking (or dragging) paints the selected tile into the active layer.
    • Right-clicking (or dragging) erases tiles.
    • Edits automatically update the scene, refresh Rapier static physics colliders, and save the .ptmap file.

Visual Atlas Editor

Create and edit .ptatlas sprite sheets directly inside the editor without hand-editing TOML:

  • Create an Atlas: Right-click any .png in the Assets panel and choose Create Atlas…, or click Create Atlas… in the Inspector on a Sprite2D / AnimatedSprite2D.
  • Open the Editor: Double-click any .ptatlas file in Assets, click Edit Atlas… in the Inspector, or create an atlas. The dedicated Atlas Editor tab opens in the bottom dock and can be moved or floated like any other panel.
  • Frame Canvas & Slicing: Zoom and pan the sheet, drag to create, move, or resize frames, rename frames, or run the Grid Slicer (by tile dimensions or column/row counts, with optional offsets, spacing, and transparent-tile skipping).
  • Animation Builder: Create named animations, append frame ranges, configure fps and loop, and preview playback live in the Atlas Editor. Saving updates both the .ptatlas file and the active viewport immediately.

Save Scene and Code

Pressing Ctrl+S (or Cmd+S on macOS), clicking the save icon button in the header toolbar, or selecting Scene > Save saves both the active .ptscn scene and any open code file (script) at once:

  • Scene Serialization: Serializes the live tree (ops::build_doc → pite_scene::save_scene) and writes scene_path. Success and failure both log to the console; saves never panic and never fail silently.
  • Instance Preservation: The scene file on disk stays authoritative: save reads it first and re-attaches its [[instance]] entries instead of flattening them into plain nodes. Prop edits inside an instantiated subtree are written back as overrides, and edits the format cannot express are refused with a console error rather than silently dropped. Props serialize in sorted order, keeping saves byte-identical.
  • Live Script Saving & Hot Reload: If a script is open in the Code tab, it is written to disk simultaneously, triggering script hot-reloading in the running session.

Use Scene > Save Scene As… (Ctrl+Shift+S) to clone the active scene to a new file.


Project Settings Dialog

Open Project > Project Settings… to configure project metadata without editing TOML files manually:

  • Project Metadata: Edit project name, author, main_scene, and icon.
  • Display Resolution: Adjust window_width and window_height. The viewport updates its aspect framing immediately upon saving.
  • Export Inclusions: Add non-code files or assets that must be included in exported bundles.
  • Input Map Tab: Switch to Input Map to add/remove named actions and chord bindings (e.g., Space, Control+S, MouseLeft), saved to res://input.pite.toml and applied immediately.

Clicking Save validates the fields and rewrites pite.toml (and input.pite.toml when modified) cleanly.


Keyboard Shortcuts

Shortcut Action Scope
Ctrl+S Save open scene and script at once Global
Ctrl+Shift+S Save Scene As… Global
Ctrl+Z Undo scene, inspector, tilemap, or atlas edit Non-Code panels
Ctrl+Y / Ctrl+Shift+Z Redo undone edit Non-Code panels
Ctrl+0 Reset viewport pan & zoom Viewport (editing)
Q / W / E / S Viewport mode: Select/Move/Rotate/Resize Viewport (hovered)
Ctrl+O Open Scene file Global
Ctrl+N New Scene Global
Ctrl+R / F5 Play / Pause simulation Outside text fields
Shift+F5 Stop and reset simulation Outside text fields
Ctrl+Q Quit Pite Editor Global
Ctrl+D Duplicate node / Duplicate asset Scene Tree / Assets Panel
F2 Rename node / Rename asset Scene Tree / Assets Panel
Ctrl+Shift+A Instantiate Child Scene… Scene Tree
Del Delete selected node / Delete asset Scene Tree / Assets Panel
Ctrl+X / C / V Cut / Copy / Paste asset Assets Panel
Ctrl+Space Force LSP autocomplete popup Code Tab
Ctrl+H Show type hover info Code Tab
Esc Dismiss autocomplete popup Code Tab