mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7639] [MERGED] fix(avatars): 2D avatars get clean faces from sprite generation instead of cutting out existing sprites #7853
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7853
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7639
Author: @SpicyMarinara
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/avatar-sprites-from-pipeline📝 Commits (4)
d2c7c04fix(avatars): 2D avatars get clean faces from sprite generation instead of cutting out existing spritesdacf9f4fix(avatars): offer Make faces from the avatar only when the owner has an avatar87eb50efix(avatars): save a kept blink or talk picture exactly as it was drawnf9e362dMerge branch 'staging' into fix/avatar-sprites-from-pipeline📊 Changes
18 files changed (+483 additions, -493 deletions)
View changed files
📝
docs/agents/avatars.md(+8 -6)📝
e2e/avatar-2d.e2e.ts(+0 -5)📝
e2e/avatar-generation.e2e.ts(+8 -8)📝
e2e/avatar-setup.e2e.ts(+149 -8)📝
packages/client/src/features/avatars/generation/AvatarGenerationPanel.tsx(+97 -3)📝
packages/client/src/features/avatars/stage/avatar-stage-logic.ts(+2 -14)📝
packages/client/src/localization/locales/en.json(+3 -0)📝
packages/server/src/routes/avatar-models.routes.ts(+0 -28)📝
packages/server/src/services/avatars/cutouts.ts(+12 -157)📝
packages/server/src/services/avatars/formats/pngtuber.ts(+17 -29)📝
packages/server/src/services/avatars/generation/generation-context.ts(+6 -8)📝
packages/server/src/services/avatars/generation/mesh-rig.ts(+4 -8)📝
packages/server/src/services/avatars/generation/pngtuber-variants.ts(+12 -35)📝
scripts/regressions/avatar-2d-importers.regression.ts(+1 -5)📝
scripts/regressions/avatar-2d-renderers.regression.ts(+3 -3)📝
scripts/regressions/avatar-backgrounds.regression.ts(+155 -167)📝
scripts/regressions/avatar-generation-cancel.regression.ts(+1 -4)📝
scripts/regressions/avatar-stage-logic.regression.ts(+5 -5)📄 Description
Linked issue
No linked issue: requested by the maintainer on 2026-10-14. Follow-up to #7623.
Why this change
What changed
What works differently for users:
How:
AvatarGenerationPanel.tsxlazy-loadsSpriteGenerationModal(its own 54 kB chunk) and mounts it with the owner's id,initialSpriteType="expressions", the owner's avatar URL and appearance from the loaded card (readImageAppearanceOverride, as the editors seed it), the owner's portrait sprites, andonSpritesGeneratedinvalidatingspriteKeys.list(owner). The button waits for the card to load, so the avatar is the checked reference from the start, and needs an avatar. The modal has no new props, and there is no new route or cleanup code.GET /api/avatar-models/:ownerType/:ownerId/sprite-cutouts/:labeland, inservices/avatars/cutouts.ts, everything only it, the variants, the mesh builder and the PNGTuber Plus import used (avatarSpriteDisplayFile,avatarSpriteCutout,avatarCutoutSet,spriteCutoutPathand their caches).avatarCutoutstays becausegeneration/tripo-vrm.tsuses it for the picture sent to Tripo;tripo-vrm.tsandsprite-background.service.tsare unchanged.pngtuber-variants.tsandmesh-rig.tsread the sprite as it is.pngtuber-variants.tsstill appliesapplyAvatarSourceOutlineonly to a transparent source. The now unusedshownfield of the image edit request is removed.formats/pngtuber.tsstores flattened costumes as they are (its code before #7623). The Cancel work from #7623 is kept.resolveAvatarImagereturns the sprite's own URL again (its code before #7623).docs/agents/avatars.mdreplaces "No backgrounds" and the other cut-out mentions, and adds a "Faces from the avatar" section. Translations: #7638.avatars.generation.facesFromAvatar,avatars.generation.facesFromAvatarHelp,avatars.generation.facesNeedAvatar).Tests changed to pin the new decision (they pinned #7623's cut-outs):
avatar-backgrounds.regression.tsnow pins the new rule. There is no cut-out route (404). Drawing stores nothing, not even a cut-out. A blink or talk picture from a sprite with a background keeps the drawn picture, background and all, and saving stores the sprite itself as their base. A picture from a transparent sprite still takes its outline and its own edge pixels, whether the model fills the background or leaves it see-through. A PNGTuber Plus costume on a background is imported as it is. A mesh avatar keeps the sprite's background. Nocutout-file is ever stored, and the sprites are never changed. Still-valid parts are kept: theavatarCutoutengine checks (AI remover configured, failing or missing) and saved files never rewritten.avatar-generation-cancel.regression.ts: after Cancel the avatar folder is empty (it allowedcutout-files before).avatar-stage-logicandavatar-2d-renderersregressions: expected URLs are the sprite URLs again.avatar-2d-importersgoes back to its solid test body.e2e/avatar-generation.e2e.ts: the blink picture and the saved mesh avatar keep the sprite's white background (they asserted it was gone). Thesprite-cutoutsroute mocks are removed frome2e/avatar-2d.e2e.tsande2e/avatar-setup.e2e.ts.e2e/avatar-setup.e2e.ts. For a character without sprites, the action opens Generate Sprites with the avatar checked and shown as the reference, the Image Appearance Override as the appearance and Transparent sprite background on. Generate Sheet sendsreferenceImages: [avatar]andnoBackground: true(the sheet response is mocked). Save stores the faces as the character's sprites, and the panel lists them at once. For a persona with sprites, it opens with the persona's avatar and appearance. For a persona without an avatar, the button is turned off and says to add one.Saved avatars: nothing is rewritten. Cut-out files that #7623 stored (
pngtuber/cutout-1-….png) are no longer read. They are deleted with the PNGTuber avatar's next import or removal. A face whose blink or talk pictures were saved from a cut-out base gets the sprite as its base the next time pictures are saved for it, which drops that face's older pictures (as for any changed base).Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands run by the agent (results as reported, not a substitute for the boxes above):
pnpm check(ondacf9f40d): passed.pnpm lintshows one warning inHomeProfessorMariChat.tsx, which this PR doesn't touch.pnpm localization:check: passed (part ofpnpm check).node scripts/run-regressions.mjs --filter avatar: 17/17 passed (ondacf9f40d).--filter sprite: 2/2 passed (ond2c7c0433; the review fix touches only the client panel, the English strings and the docs).avatar-backgroundsregression against staging's server code fails onthere is no sprite cut-out route(200, expected 404). With that check skipped, it fails ona eyes-closed picture: the background at 2,2 stays(alpha 0: the cut-out).--project=mobile-chromium --project=desktop-chromium, ond2c7c0433:avatar-setup,avatar-generation,avatar-2d,avatar-previewandavatar-vrm-generation, 44/44 passed (including the new faces test on both projects). Ondacf9f40d:avatar-setupandavatar-generation, 12/12 passed.coderabbit review --agent --committed), 2 findings:dacf9f40d, with an e2e check).savePngtuberVariantskeeps a face's older blink and talk pictures only when they were drawn for the same base (sameBase). Pictures saved under #7623 have the cut-out's outline, and the base is now the sprite with its background. Keeping them would take the background away on every blink or talk, the flicker the outline rule exists to prevent. Dropping them follows the rule for any changed base, and the PR body says so under "Saved avatars". Only avatars saved in the hours #7623 was on staging are affected.Manual verification notes
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs:
docs/agents/avatars.mdupdated in this PR. Translation follow-up: #7638. No CHANGELOG entry (release notes are compiled at release).UI evidence (if applicable)
The new e2e saves screenshots of the action (
avatar-faces-action.png) and the opened generator (avatar-faces-generator.png) in its test output.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.