add plugin system with plugin/layout managers

- plugin_manager: scans res://plugins/*/plugin.cfg, loads tile definitions
- plugin_tile: new base class for plugin tiles, extends ModuleBase
- layout_manager: save/restore tile grid positions per named layout
- migrate existing cpu/memory/testing tiles into system_monitor plugin
- add module_resized signal to DashboardGrid for auto-save
- dashboard reads from PluginManager + LayoutManager instead of hardcoded paths
- project.godot registers PluginManager and LayoutManager autoloads
- AGENTS.md updated with new structure and conventions
This commit is contained in:
Eric Smith 2026-05-21 08:39:15 -04:00
parent 63af41ea61
commit f43676e46c
19 changed files with 528 additions and 39 deletions

View file

@ -61,12 +61,22 @@ V Panel is a Godot Engine project that builds a fancy real-time status monitor.
- All percentage labels get a 3px black outline (`outline_size` / `font_outline_color`) for legibility against the liquid shader background.
- Title labels get a 2px outline.
### Plugin System
- `autoload/plugin_manager.gd` — autoload singleton, scans `res://plugins/*/plugin.cfg` at startup.
- Each plugin folder contains a `plugin.cfg` INI file with `[plugin]` metadata and `[tile_N]` entries defining tiles (id, name, scene path, min/max grid spans).
- Tile IDs are scoped as `{plugin_id}/{tile_id}` to guarantee global uniqueness.
- `PluginManager.instantiate_tile(tile_id)` loads the tile scene, instantiates it, and tags the root node with `tile_id` and `tile_config` metadata.
- `scripts/plugin_tile.gd` — class_name `PluginTile`, extends `ModuleBase`. Plugin tiles extend this instead of ModuleBase directly. Stores `tile_id` and `tile_config` properties, also written to node metadata for grid/layout access.
### Layout System
- `autoload/layout_manager.gd` — autoload singleton for saving/restoring tile grid positions.
- Layout files stored as INI in `res://config/layouts/{name}.cfg`. Each entry maps a `tile_id` to `{col, row, w, h}`.
- `save_layout()` writes the current in-memory layout to disk. `load_layout(name)` reads it back.
- `switch_layout(name)` saves current layout, loads the named one, emits signals.
- Current layout name persisted in `ConfigManager` as `layout_current`.
- Layout auto-saves on every `module_placed` and `module_resized` signal from `DashboardGrid`.
### Config System
- `autoload/config_manager.gd` — autoload singleton using Godot's built-in `ConfigFile` class for INI-style config files.
- Two files: `res://config/default.cfg` (shipped defaults, tracked) and `res://config/config.cfg` (user overrides, gitignored). User overrides are merged on top of defaults per-key.
- Keys are flattened as `{section}_{key}` for simple `get_setting(key, default)` lookups (e.g., `[background]` + `color` => `"background_color"`).
- `get_color(key, default_color)` parses `"r, g, b"` string values from config into `Color`.
- `set_setting(key, value)` diffs against defaults and writes only the diff to `config.cfg` automatically.
### Splash Screen
- `scenes/splash.tscn` + `scenes/splash.gd` — entry point (set in `project.godot` as `main_scene`), handles fullscreen, font-size zoom animation, crossfade to dashboard.
@ -83,16 +93,20 @@ res://
│ ├── icons/
│ └── textures/ # noise_100.png (tileable Perlin noise for shader distortion)
├── autoload/ # Singleton/autoload scripts
│ └── config_manager.gd # INI config via ConfigFile
│ ├── config_manager.gd # INI config via ConfigFile
│ ├── plugin_manager.gd # Plugin scanning, tile instantiation
│ └── layout_manager.gd # Layout save/load/switch
├── config/ # Configuration files (INI format)
│ ├── default.cfg # Shipped defaults, tracked in git
│ └── config.cfg # User overrides, gitignored (auto-generated)
├── panels/ # Individual status panels (modules)
│ ├── cpu/
│ ├── memory/
│ ├── network/
│ ├── disk/
│ └── testing/
│ ├── config.cfg # User overrides, gitignored (auto-generated)
│ └── layouts/ # Saved layout files (*.cfg)
├── plugins/ # Plugin folders
│ └── system_monitor/ # Built-in system monitoring plugin
│ ├── plugin.cfg
│ └── tiles/
│ ├── cpu/
│ ├── memory/
│ └── testing/
├── scenes/ # Root scenes
│ ├── splash.tscn # Animated splash → dashboard transition
│ └── dashboard.tscn # Main dashboard (PanelContainer root)
@ -100,6 +114,7 @@ res://
│ ├── dashboard_grid.gd # Responsive grid with drag, resize, preset popup
│ ├── module_base.gd # Base class for all modules (mouse_filter IGNORE)
│ ├── panel_base.gd # Base class for panels
│ ├── plugin_tile.gd # Base class for plugin tiles (extends ModuleBase)
│ └── shader_presets.gd # Shader preset definitions and apply function
├── themes/ # Theme definitions and style resources
├── shaders/ # Custom shader materials