[PR #7813] [MERGED] fix(avatars): use newly generated main faces and let every face be picked #7942

Closed
opened 2026-10-24 04:09:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7813
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/avatar-2d-main-faces


📝 Commits (3)

  • 259a160 fix(avatars): use newly generated main faces and let every face be picked
  • 14e4fbf fix(avatars): offer no face past the 64-face cap
  • 9ab2a6b fix(avatars): offer every sprite face while the setup has room

📊 Changes

8 files changed (+461 additions, -16 deletions)

View changed files

📝 docs/agents/avatars.md (+2 -2)
📝 e2e/avatar-2d.e2e.ts (+85 -0)
📝 e2e/avatar-setup.e2e.ts (+24 -0)
📝 packages/client/src/components/ui/SpriteGenerationModal.tsx (+6 -3)
📝 packages/client/src/features/avatars/generation/AvatarGenerationPanel.tsx (+24 -3)
📝 packages/client/src/features/avatars/renderers/pngtuber/PngtuberSetupPanel.tsx (+14 -5)
📝 packages/client/src/features/avatars/renderers/pngtuber/pngtuber-layers.ts (+70 -3)
➕ scripts/regressions/avatar-2d-main-faces.regression.ts (+236 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

@SpicyMarinara reported this directly from her Docker staging instance, so there is no separate issue. It follows up on the face maker work in #7682, #7690, #7692 and #7696.

Why this change

Mari ran Make faces from the avatar → All faces for a character (Maukie) that already had a saved talking head built from older sprites (smirk, laughing, disgusted, crying, sleepy, scared, …). Her report:

Neutral, Happy, Angry, Sad, Relaxed, Surprised were all replaced by the old expressions I had and I cannot change them. … they don't show up in Faces, I can't select them there in the emotions picker and for generating eyes closed / mouth open variants.

The read-only snapshot of her instance showed all 29 new faces saved as sprites. Her old sprites were untouched. The saved PNGTuber setup still had faces for only the ten old sprites, and the six feelings were still bound to them (neutral → smirk, picked by her, and happy → laughing and the others, detected automatically).

Root cause, two parts:

  1. The face maker never touched a saved talking head. SpriteGenerationModal called onSpritesGenerated() with nothing (SpriteGenerationModal.tsx:1965 on staging). AvatarGenerationPanel only refetched the sprite list (AvatarGenerationPanel.tsx:245). A saved setup is what chats and the preview show (withSpriteAvatar, avatar-stage-logic.ts:90), so the old faces stayed. That is also true for the 23 extra feelings: with no faces of their own in the saved setup, a fearful line still showed scared.
  2. Every face list came from the saved setup. The Faces list and every Face for each feeling select (main feelings and More feelings) use faceKeys = Object.keys(shown.layers) (PngtuberSetupPanel.tsx:166). A sprite added after Use my sprites therefore could not be chosen for any feeling. The only way in was Update from sprites, which a setup that already has saved blink or talk pictures doesn't offer. Blink and talk pictures follows the faces the talking head shows (talkingHeadFaces). It prefers an automatic binding that still names a saved face over a newer sprite named after the feeling (pngtuber-layers.ts:206-207), so it kept listing laughing for Happy and never offered happy.

No filter removes sprites named after a feeling. Talk, blink and full-body sprites are still kept out, as before.

What changed

  • New faces become their feelings' faces. The face maker now reports each saved sprite's label and the face it was drawn as. When the owner already has a saved talking head, each face made in that run becomes the face of its feeling: the six main feelings and the extra feelings. A face made this way replaces the earlier pick, including one the user chose, because making a face is an explicit choice. Only the feelings made in that run change.
    • A face renamed in the last step to keep the old sprite (happy_2, as the docs suggest) is still the face it was drawn as. A face saved under a feeling's name wins over a renamed one.
    • A remade face starts again from its sprite alone. Blink and talk pictures drawn for the older picture would not match it, so they are dropped from that face. Their files stay on disk.
    • Old sprites and their faces are not changed or deleted. A PNGTuber Plus import keeps its own faces. A setup at the 64-face cap gains no new face.
    • An owner without a saved talking head needs no change: its sprites are the faces, and a sprite named after a feeling is already that feeling's face.
  • Every face can be chosen. The Faces list and every Face for each feeling select offer the saved faces first, then every sprite face added since, including ones named after a feeling. Choosing one adds it to the setup with its _talk and _blink sprites. Talk, blink and full-body sprites are still not offered as faces, and a PNGTuber Plus import still offers only its own faces. Once a sprite is a feeling's face, Blink and talk pictures lists it.
  • No migration. Existing setups are not remapped when they load, so deliberate picks stay. See the repair steps below.
  • Docs: docs/agents/avatars.md has two added sentences, in Face for each feeling and Faces from the avatar. The translations are tracked in #7814.
  • Tests:
    • New scripts/regressions/avatar-2d-main-faces.regression.ts, built from Mari's saved setup and sprite list with the owner renamed. It covers the wiring, the face lists, renames, imports and the cap, and checks that a later blink/talk save keeps the new faces.
    • A new panel e2e test in e2e/avatar-2d.e2e.ts.
    • A real-server step in the face maker e2e test (e2e/avatar-setup.e2e.ts): Use my sprites, pick Happy → angry, make the main faces again, and all six bindings must point to the new faces.

Repair for Maukie (existing data, no migration): open Agents → 2D Avatars, pick Maukie, and in PNGTuber sprites select Update from sprites. It adds every new face, binds Happy, Angry, Sad, Relaxed, Surprised and the 23 extra feelings to the new faces by name, and keeps her own Neutral pick. Then set Neutral to neutral under Face for each feeling. Alternatively, with this PR choose each face in its select, or make the six faces again.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by the agent before opening this PR. These are notes for the reviewer, not ticked boxes:

  • pnpm check exited 0.
  • pnpm localization:check reported no new keys (none added).
  • node scripts/run-regressions.mjs --filter avatar: 18/18 passed, including the new avatar-2d-main-faces.
  • --filter sprite and --filter matched-full-body passed.
  • Playwright, desktop-chromium:
    • e2e/avatar-2d.e2e.ts: 14/14.
    • e2e/avatar-setup.e2e.ts, e2e/avatar-generation.e2e.ts and e2e/avatar-preview.e2e.ts: 8/8.
  • Playwright, mobile-chromium and mobile-webkit: the three touched tests passed.

Still to do by hand:

  • Manually verify on the 2D Avatars page for an owner with older sprites: generate all faces → the six main faces show the new pictures in the Faces list and the talking head; each face can be switched to any sprite, including the new ones; the Blink and talk generator lists them
  • Manually verify that the 23 extra feelings use their new faces in a chat after the run (for example, a fearful line shows the fear face, not scared)
  • Manually verify on Maukie, after updating: Update from sprites, then Neutral → neutral, gives the new faces for all feelings, and the old sprites still show in the Faces list
  • Manually verify that renaming a face in the face maker's last step (for example happy → happy_2) keeps the old happy sprite and makes happy_2 the Happy face

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

docs/agents/avatars.md is updated in this PR. The [docs-i18n] follow-up issue is #7814.

UI evidence (if applicable)

No screenshots. The e2e tests above check the face lists and the saved setups directly.

Summary by CodeRabbit

  • New Features
    • Newly available sprites can be selected as faces for PNGTuber feelings without first refreshing the setup. Adding a face preserves existing layers.
    • Generated faces are assigned to their intended feelings even if renamed. Other sprites remain available for selection, and generated faces are saved to the talking-head setup.
  • Bug Fixes
    • Regenerating a face now restores its corresponding sprite while preserving unrelated face mappings and setup details.

🔄 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/7813 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/avatar-2d-main-faces` --- ### 📝 Commits (3) - [`259a160`](https://github.com/Pasta-Devs/Marinara-Engine/commit/259a1606e33ca04ae12a49cdd1c131c828325f7b) fix(avatars): use newly generated main faces and let every face be picked - [`14e4fbf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/14e4fbf8524634fe7bbc1f20085937c4ba0a44d7) fix(avatars): offer no face past the 64-face cap - [`9ab2a6b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9ab2a6b9430fb8b7fe447de9edb0f80d62765979) fix(avatars): offer every sprite face while the setup has room ### 📊 Changes **8 files changed** (+461 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/avatars.md` (+2 -2) 📝 `e2e/avatar-2d.e2e.ts` (+85 -0) 📝 `e2e/avatar-setup.e2e.ts` (+24 -0) 📝 `packages/client/src/components/ui/SpriteGenerationModal.tsx` (+6 -3) 📝 `packages/client/src/features/avatars/generation/AvatarGenerationPanel.tsx` (+24 -3) 📝 `packages/client/src/features/avatars/renderers/pngtuber/PngtuberSetupPanel.tsx` (+14 -5) 📝 `packages/client/src/features/avatars/renderers/pngtuber/pngtuber-layers.ts` (+70 -3) ➕ `scripts/regressions/avatar-2d-main-faces.regression.ts` (+236 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue @SpicyMarinara reported this directly from her Docker staging instance, so there is no separate issue. It follows up on the face maker work in #7682, #7690, #7692 and #7696. ## Why this change Mari ran **Make faces from the avatar → All faces** for a character (Maukie) that already had a saved talking head built from older sprites (`smirk`, `laughing`, `disgusted`, `crying`, `sleepy`, `scared`, …). Her report: > Neutral, Happy, Angry, Sad, Relaxed, Surprised were all replaced by the old expressions I had and I cannot change them. … they don't show up in Faces, I can't select them there in the emotions picker and for generating eyes closed / mouth open variants. The read-only snapshot of her instance showed all 29 new faces saved as sprites. Her old sprites were untouched. The saved PNGTuber setup still had faces for only the ten old sprites, and the six feelings were still bound to them (`neutral → smirk`, picked by her, and `happy → laughing` and the others, detected automatically). **Root cause, two parts:** 1. **The face maker never touched a saved talking head.** `SpriteGenerationModal` called `onSpritesGenerated()` with nothing (`SpriteGenerationModal.tsx:1965` on staging). `AvatarGenerationPanel` only refetched the sprite list (`AvatarGenerationPanel.tsx:245`). A saved setup is what chats and the preview show (`withSpriteAvatar`, `avatar-stage-logic.ts:90`), so the old faces stayed. That is also true for the 23 extra feelings: with no faces of their own in the saved setup, a fearful line still showed `scared`. 2. **Every face list came from the saved setup.** The **Faces** list and every **Face for each feeling** select (main feelings and **More feelings**) use `faceKeys = Object.keys(shown.layers)` (`PngtuberSetupPanel.tsx:166`). A sprite added after **Use my sprites** therefore could not be chosen for any feeling. The only way in was **Update from sprites**, which a setup that already has saved blink or talk pictures doesn't offer. **Blink and talk pictures** follows the faces the talking head shows (`talkingHeadFaces`). It prefers an automatic binding that still names a saved face over a newer sprite named after the feeling (`pngtuber-layers.ts:206-207`), so it kept listing `laughing` for Happy and never offered `happy`. No filter removes sprites named after a feeling. Talk, blink and full-body sprites are still kept out, as before. ## What changed - **New faces become their feelings' faces.** The face maker now reports each saved sprite's label and the face it was drawn as. When the owner already has a saved talking head, each face made in that run becomes the face of its feeling: the six main feelings and the extra feelings. A face made this way replaces the earlier pick, including one the user chose, because making a face is an explicit choice. Only the feelings made in that run change. - A face renamed in the last step to keep the old sprite (`happy_2`, as the docs suggest) is still the face it was drawn as. A face saved under a feeling's name wins over a renamed one. - A remade face starts again from its sprite alone. Blink and talk pictures drawn for the older picture would not match it, so they are dropped from that face. Their files stay on disk. - Old sprites and their faces are not changed or deleted. A PNGTuber Plus import keeps its own faces. A setup at the 64-face cap gains no new face. - An owner without a saved talking head needs no change: its sprites are the faces, and a sprite named after a feeling is already that feeling's face. - **Every face can be chosen.** The **Faces** list and every **Face for each feeling** select offer the saved faces first, then every sprite face added since, including ones named after a feeling. Choosing one adds it to the setup with its `_talk` and `_blink` sprites. Talk, blink and full-body sprites are still not offered as faces, and a PNGTuber Plus import still offers only its own faces. Once a sprite is a feeling's face, **Blink and talk pictures** lists it. - **No migration.** Existing setups are not remapped when they load, so deliberate picks stay. See the repair steps below. - **Docs:** `docs/agents/avatars.md` has two added sentences, in **Face for each feeling** and **Faces from the avatar**. The translations are tracked in #7814. - **Tests:** - New `scripts/regressions/avatar-2d-main-faces.regression.ts`, built from Mari's saved setup and sprite list with the owner renamed. It covers the wiring, the face lists, renames, imports and the cap, and checks that a later blink/talk save keeps the new faces. - A new panel e2e test in `e2e/avatar-2d.e2e.ts`. - A real-server step in the face maker e2e test (`e2e/avatar-setup.e2e.ts`): **Use my sprites**, pick Happy → `angry`, make the main faces again, and all six bindings must point to the new faces. **Repair for Maukie (existing data, no migration):** open **Agents → 2D Avatars**, pick Maukie, and in **PNGTuber sprites** select **Update from sprites**. It adds every new face, binds Happy, Angry, Sad, Relaxed, Surprised and the 23 extra feelings to the new faces by name, and keeps her own Neutral pick. Then set **Neutral** to `neutral` under **Face for each feeling**. Alternatively, with this PR choose each face in its select, or make the six faces again. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by the agent before opening this PR. These are notes for the reviewer, not ticked boxes: - `pnpm check` exited 0. - `pnpm localization:check` reported no new keys (none added). - `node scripts/run-regressions.mjs --filter avatar`: 18/18 passed, including the new `avatar-2d-main-faces`. - `--filter sprite` and `--filter matched-full-body` passed. - Playwright, desktop-chromium: - `e2e/avatar-2d.e2e.ts`: 14/14. - `e2e/avatar-setup.e2e.ts`, `e2e/avatar-generation.e2e.ts` and `e2e/avatar-preview.e2e.ts`: 8/8. - Playwright, mobile-chromium and mobile-webkit: the three touched tests passed. Still to do by hand: - [ ] Manually verify on the 2D Avatars page for an owner with older sprites: generate all faces → the six main faces show the new pictures in the Faces list and the talking head; each face can be switched to any sprite, including the new ones; the Blink and talk generator lists them - [ ] Manually verify that the 23 extra feelings use their new faces in a chat after the run (for example, a fearful line shows the `fear` face, not `scared`) - [ ] Manually verify on Maukie, after updating: **Update from sprites**, then Neutral → `neutral`, gives the new faces for all feelings, and the old sprites still show in the Faces list - [ ] Manually verify that renaming a face in the face maker's last step (for example `happy` → `happy_2`) keeps the old `happy` sprite and makes `happy_2` the Happy face ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `docs/agents/avatars.md` is updated in this PR. The `[docs-i18n]` follow-up issue is #7814. ## UI evidence (if applicable) No screenshots. The e2e tests above check the face lists and the saved setups directly. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Newly available sprites can be selected as faces for PNGTuber feelings without first refreshing the setup. Adding a face preserves existing layers. * Generated faces are assigned to their intended feelings even if renamed. Other sprites remain available for selection, and generated faces are saved to the talking-head setup. * **Bug Fixes** * Regenerating a face now restores its corresponding sprite while preserving unrelated face mappings and setup details. <!-- 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-24 04:09:01 +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#7942
No description provided.