How lvoxx/lspotato works
Project Type and Purpose
• This is a full-stack (local) Blender add-on written in Python.
• Purpose: provide “potato-style” automation inside Blender (mesh tweaks, material setup, custom utilities, auto-sync LSCherry shaders), plus CLI packaging/install commands.
File Structure Analysis
Top-level:
• package.py + potato.{sh,bat} – CLI entry point for packaging/installing/uninstalling/reloading the add-on.
• assets/ – static images used in README/UI.
• src/ – main Python code.
– constants/ – global configuration and version flags.
– features/ – grouped by functionality:
· autosync/… – auto-sync LSCherry provider & global configuration handlers/operators/ui layers.
· checkfor_update/… – “check-for-update” operators, UI & utils.
· find_lscherry/… – locate and repair LSCherry installations.
· make_local/… – convert remote materials/local copies.
· replace_nodes/… – node-replacement operators/UI.
· panels.py – central registration of UI panels.
– utils/ – helper modules for debugging, drawing UI, Blender/LSCherry introspection.
• .github/ – issue templates.
• venv/ – local Python environment.
Key Architectural Insights from README
• -on is loaded at Blender startup → registers features, UI panels, operators.
• Two subsystems: LSCherry Toon Shader loader and Potato Automation tools.
• Background processes (auto-reload, mesh fairing, UV mapping, validation).
• CLI tools orchestrate packaging/install lifecycle.
Main Components
a. Blender Environment
• Blender Startup → Add-on Manager
b. CLI Tool (“potato”)
• package/install/uninstall/reload
c. Core Add-on Components
1. Initialization Layer
– package.py entry hooks into Blender’s add-on registry
– registers operators, handlers, panels
2. LSCherry Toon Shader System
– src/constants (version, blend modes)
– src/features/find_lscherry (path resolution, download/repair)
– src/features/autosync/cherry_provider (sync handlers, UI)
3. Potato Automation System
– src/features/make_local
– src/features/replace_nodes
– src/features/checkfor_update
– src/utils (common utilities)
d. UI Layer
– src/features/panels.py defines shader editor panel, properties panel, tools panel
– each feature folder has ui.py (panel sub-sections)
e. Background Systems
– auto-reload libraries (dev reload)
– mesh fairing & planar UV (in utils)
– material validation
f. Data Flow & Interactions
– User clicks UI → triggers Operator → uses Utilities → updates Blender data (meshes, materials) → UI updates
– CLI calls package.py → builds .zip into dist/ → Blender sees changed add-on → optional auto-reload
Architectural Patterns & Principles
• Modular feature-based layout: each feature encapsulates operators, handlers, properties, UI, sync logic.
• Blender’s event-driven operator/handler model for UI interactions.
• Separation of concerns: constants vs. features vs. utilities vs. CLI.
• Dev-friendly hot-reload cycle.
Essential Elements
• Component labels (module or feature names)