fix: per-item transform in batch export (correct placement across sizes)

QueuePanel reused one pixel TransformState for all non-fine-tuned items,
mis-placing garments/prints of other sizes. Store the ratio-based template
instead and recompute each item from its own garment/print size.

- add core.composer.image_size() and resolve_transform() (pure, tested)
- queue: set_template() replaces set_transform(); per-item resolve + size cache
- template_panel: expose current_template(); main_window pushes it to the queue
- tests: +4 covering fine-tune precedence, per-size recompute, empty inputs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 16:42:20 +08:00
co-authored by Claude Opus 4.8
parent 76f2c6dd5b
commit f2b08fecb3
6 changed files with 155 additions and 11 deletions
+12 -1
View File
@@ -257,8 +257,14 @@ class MainWindow(QMainWindow):
# Template selection updates canvas, param panel, and queue template
self.template_panel.template_applied.connect(self.image_canvas.set_transform)
self.template_panel.template_applied.connect(self.transform_panel.set_transform)
self.template_panel.template_applied.connect(self.queue_panel.set_transform)
self.template_panel.template_applied.connect(self.export_panel.set_transform)
# Give the queue the template itself (ratio-based) so each item is laid
# out from its own garment/print size, not one shared pixel transform.
# template_changed fires on selection even before a garment is loaded;
# template_applied covers re-applies once sizes are known.
self.template_panel.template_changed.connect(self._sync_queue_template)
self.template_panel.template_applied.connect(self._sync_queue_template)
self.queue_panel.set_template(self.template_panel.current_template()) # initial sync
# Output settings (dir/format/quality) flow to the queue for batch export
self.export_panel.export_options_changed.connect(self.queue_panel.set_export_options)
@@ -346,6 +352,11 @@ class MainWindow(QMainWindow):
self._loading_queue_item = False
self._update_reset_availability()
def _sync_queue_template(self, _state=None):
"""Push the currently selected template (ratio-based) to the queue so
batch export recomputes each item from its own garment/print size."""
self.queue_panel.set_template(self.template_panel.current_template())
def _on_transform_changed(self, state):
"""Route transform changes to panels and mark the active queue item fine-tuned."""
# Keep template panel and export panel up to date for save/export actions