Skip to content

Conversation

Copy link

Copilot AI commented Nov 12, 2025

Transforms monolithic script into modular Python package with dual interfaces (UI and CLI) while maintaining backward compatibility.

Changes

Package Structure (blender_updater/)

  • mesh_operations.py: Mesh import/geometry copying with UV preservation
  • updater.py: Configuration parsing and batch orchestration
  • cli.py: Command-line entry point with argument handling
  • Installable via pip: pip install . or from GitHub

Blender Addon (blender_addon/)

  • Self-contained UI panel in 3D View sidebar
  • File browser for config selection, update button with visual feedback
  • All logic embedded, no external dependencies
  • Standard Blender addon installation flow

Example Project (example_project/)

  • Sample mesh files (cube.stl, cylinder.stl) demonstrating the workflow
  • Example configuration file showing both individual parts and path patterns
  • Python script to generate example Blender project
  • Complete README with usage instructions for all three modes

GitHub Actions Workflows (.github/workflows/)

  • build-addon.yml: Automatically creates addon zip on releases and tags
    • Uploads blender_updater_addon-{version}.zip to GitHub Releases
    • Available as artifact for manual download
    • Triggers on tag push (v*), releases, or manual dispatch
  • build-example.yml: Builds example Blender project in CI
    • Validates example creation script
    • Provides downloadable artifact

Build Tools

  • build_addon_zip.sh: Local script for manual addon zip creation
    • Auto-detects version from git tags
    • Excludes build artifacts and unnecessary files

Backward Compatibility

  • Legacy script auto-detects and uses package when available
  • Falls back to inline implementation otherwise
  • Zero breaking changes to existing workflows

Usage

UI (new):

Download blender_updater_addon-*.zip from Releases
Blender → Preferences → Add-ons → Install → select zip
Press N → BlenderUpdater tab → Select config → Update Meshes

CLI (new):

pip install .
blender file.blend --python -m blender_updater -- --config config.json

Legacy (maintained):

blender file.blend --python scripts/do_complete_assembly.py -- --config config.json

Architecture

# Programmatic usage
from blender_updater import BlenderUpdater

updater = BlenderUpdater("config.json")
updater.update_all()

Config format unchanged - works across all interfaces:

{
  "parts": [{"name": "./parts/part.stl"}],
  "paths": ["./parts/*.stl"]
}

Documentation

  • QUICKSTART.md, INSTALL.md, ARCHITECTURE.md for different audiences
  • Platform-specific installation instructions
  • Migration paths from legacy usage
  • Example project with ready-to-use mesh files

Distribution

  • Pre-built addon zips available from GitHub Releases
  • Automated release workflow creates versioned packages
  • Local build script for development and testing

Security: CodeQL scan clean (0 alerts)

Original prompt

Tento repozitář obsahuje skript, který umí zaktualizovat mesh modely uvnitř blenderu tak, že zachová jeho nastavení (textura, barva, vlastnosti, pozice). Potřeboval bych to upravit tak, aby se jeho logika separovala do vlastního python modulu, který půjde do python prostředí blenderu nainstalovat pomocí pip. Díky tomu to půjde použít mezi více projekty a repozitář/složka s blender projektem tak bude obsahovat pouze konfigurační soubor pro BlenderUpdater.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 12, 2025
Copilot AI changed the title [WIP] Refactor mesh model updater into separate Python module Refactor BlenderUpdater into pip-installable package with UI addon Nov 12, 2025
Copilot AI requested a review from roman-dvorak November 12, 2025 14:12
Copilot finished work on behalf of roman-dvorak November 12, 2025 14:12
@roman-dvorak
Copy link
Member

@copilot neuměl bys tam vytvořit i nějaký example, kde by byly nějaké mesh modely a k tomu by byl konfiguračni soubor a základní blender projekt?

Také bych chtěl, aby existovalo nějaké actions, které z toho addonu vytvoří zip.

Copy link
Author

Copilot AI commented Nov 12, 2025

@copilot neuměl bys tam vytvořit i nějaký example, kde by byly nějaké mesh modely a k tomu by byl konfiguračni soubor a základní blender projekt?

Také bych chtěl, aby existovalo nějaké ...

Přidáno v commitu 076fa8d:

1. Example projekt ✅

  • Nový adresář example_project/ s mesh modely (cube.stl, cylinder.stl)
  • Konfigurační soubor config.json
  • Script create_example_blend.py pro vytvoření základního Blender projektu
  • Kompletní README s instrukcemi

2. GitHub Actions pro addon zip ✅

  • Workflow .github/workflows/build-addon.yml automaticky vytváří zip z addonu
  • Spouští se při tagu (v*), release, nebo manuálně
  • Zip se automaticky nahraje do GitHub Releases
  • Bonus: přidán i lokální build script build_addon_zip.sh

Uživatelé teď můžou stáhnout hotový blender_updater_addon-*.zip přímo z Releases stránky a nainstalovat do Blenderu bez clonování repozitáře.

Copilot finished work on behalf of roman-dvorak November 12, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants