[PR #5100] [MERGED] feat(sprites): optional styleProfileId for sprite-sheet bakes #6626

Closed
opened 2026-10-23 04:12:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5100
Author: @kolacheee
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @kolacheee

Base: staging ← Head: feat/5095-sprite-style-profile


📝 Commits (3)

  • 67b86ff feat(sprites): optional styleProfileId for sprite-sheet bakes (#5095)
  • 9cd1b88 Merge branch 'staging' into feat/5095-sprite-style-profile
  • 49bbef9 test(sprites): cover imageDefaults.styleProfileId precedence link

📊 Changes

3 files changed (+90 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/sprites.routes.ts (+19 -1)
📝 scripts/regressions/sprite-background.regression.ts (+70 -0)

📄 Description

Closes #5095

Why

Sprite-sheet bakes always compile against the user's active image style profile (typically anime or photorealistic) with no per-request override — so anyone wanting sprites in a different style (the driving case: pixel-art sprites for a pixel-art Game experience's AI art tier, but equally an anime bake for a photoreal user) gets every sheet in the wrong style. The shared prompt compiler already accepts a styleProfileId override; the sprite path just never passed one.

What changed (server-only, additive)

packages/server/src/routes/sprites.routes.ts:

  • SpriteGenerateSheetBody gains optional styleProfileId (also reaching the preview and full-body expression paths, which share the body type).
  • compileSpritePrompt normalizes it at the single choke point (trim, length-cap, blank → absent) and threads it to compileImagePrompt, whose existing chain — explicit ?? connection image defaults ?? default profile — matches the gallery route's semantics.
  • Absent field: byte-identical to today (regression-pinned). Unknown ids degrade exactly like findImageStyleProfile everywhere else (graceful fallback, never a throw).
  • Layout-contract prompts, sharp slicing, and chroma-matte background removal untouched.

scripts/regressions/sprite-background.regression.ts (in regression:sprites): explicit non-default override changes the compiled prompt; explicit-default equals omitted; unknown-id output equals the findImageStyleProfile fallback's output; blank behaves as omitted. compileSpritePrompt is exported for the regression, matching the file's existing pattern.

No UI change yet — the field is the enabler for tooling and packages (e.g. a pixel Experience's Tier-2 bake calls the route directly); a sprite-panel profile picker is a natural follow-up, and the user-facing doc (docs/characters/sprites.md) is deliberately untouched until a UI exists for it to describe.

Validation

  • pnpm check
  • pnpm regression:sprites (extended)
  • pnpm version:check
  • Manually verify character sprite-sheet generation from the existing UI produces the same style as before this change.
  • Manually verify a request carrying a pixel-leaning styleProfileId compiles a prompt in that profile (the /generate-sheet/preview endpoint shows the exact prompt without spending a generation).

Summary by CodeRabbit

  • New Features

    • Sprite-sheet generation now supports an optional style profile selection across full-body, expression, preview, and sheet outputs.
    • Existing behavior and image resolution remain unchanged when no profile is selected or an unknown profile is provided.
  • Bug Fixes

    • Improved consistency when handling invalid or blank style profile selections.
  • Tests

    • Added regression coverage for style profile selection and fallback behavior.
  • Documentation

    • Documented the new style profile option in the unreleased changelog.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5100 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/15/2026 **Status:** ✅ Merged **Merged:** 8/15/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/5095-sprite-style-profile` --- ### 📝 Commits (3) - [`67b86ff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/67b86ff1ac0212a98000a25e4f3de3d5caecf3ac) feat(sprites): optional styleProfileId for sprite-sheet bakes (#5095) - [`9cd1b88`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9cd1b88933f1039a07c41e8cd77b8cfe4e41f74e) Merge branch 'staging' into feat/5095-sprite-style-profile - [`49bbef9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/49bbef9d252854b094dd11a6c9bc01db4c7f9b83) test(sprites): cover imageDefaults.styleProfileId precedence link ### 📊 Changes **3 files changed** (+90 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/sprites.routes.ts` (+19 -1) 📝 `scripts/regressions/sprite-background.regression.ts` (+70 -0) </details> ### 📄 Description Closes #5095 ## Why Sprite-sheet bakes always compile against the user's *active* image style profile (typically anime or photorealistic) with no per-request override — so anyone wanting sprites in a different style (the driving case: pixel-art sprites for a pixel-art Game experience's AI art tier, but equally an anime bake for a photoreal user) gets every sheet in the wrong style. The shared prompt compiler already accepts a `styleProfileId` override; the sprite path just never passed one. ## What changed (server-only, additive) `packages/server/src/routes/sprites.routes.ts`: - `SpriteGenerateSheetBody` gains optional `styleProfileId` (also reaching the preview and full-body expression paths, which share the body type). - `compileSpritePrompt` normalizes it at the single choke point (trim, length-cap, blank → absent) and threads it to `compileImagePrompt`, whose existing chain — explicit ?? connection image defaults ?? default profile — matches the gallery route's semantics. - Absent field: **byte-identical to today** (regression-pinned). Unknown ids degrade exactly like `findImageStyleProfile` everywhere else (graceful fallback, never a throw). - Layout-contract prompts, `sharp` slicing, and chroma-matte background removal untouched. `scripts/regressions/sprite-background.regression.ts` (in `regression:sprites`): explicit non-default override changes the compiled prompt; explicit-default equals omitted; unknown-id output equals the `findImageStyleProfile` fallback's output; blank behaves as omitted. `compileSpritePrompt` is exported for the regression, matching the file's existing pattern. No UI change yet — the field is the enabler for tooling and packages (e.g. a pixel Experience's Tier-2 bake calls the route directly); a sprite-panel profile picker is a natural follow-up, and the user-facing doc (`docs/characters/sprites.md`) is deliberately untouched until a UI exists for it to describe. ## Validation - [x] `pnpm check` - [x] `pnpm regression:sprites` (extended) - [x] `pnpm version:check` - [x] Manually verify character sprite-sheet generation from the existing UI produces the same style as before this change. - [x] Manually verify a request carrying a pixel-leaning `styleProfileId` compiles a prompt in that profile (the `/generate-sheet/preview` endpoint shows the exact prompt without spending a generation). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Sprite-sheet generation now supports an optional style profile selection across full-body, expression, preview, and sheet outputs. * Existing behavior and image resolution remain unchanged when no profile is selected or an unknown profile is provided. * **Bug Fixes** * Improved consistency when handling invalid or blank style profile selections. * **Tests** * Added regression coverage for style profile selection and fallback behavior. * **Documentation** * Documented the new style profile option in the unreleased changelog. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:12:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6626
No description provided.