From d3e7816e65444c35f1552ba5b78e0e3edfe5a141 Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 19 Oct 2026 12:00:36 +0200 Subject: [PATCH 1/3] fix(gui): taller solid textbox, wider dialogue, check/radio padding, visible save slots, polished art-style picker The textbox image was shorter than the box so the speaker name sat on the bare scene; 5-6 line prose speeches overflowed; check/radio icons overlapped their labels; empty save slots were invisible; the picker showed the quick menu over a black screen. Co-Authored-By: Claude Opus 5.5 --- src/vnpipe/renpy_templates/game/gui.rpy | 14 ++++----- src/vnpipe/renpy_templates/game/screens.rpy | 2 +- src/vnpipe/renpy_templates/game/styles.rpy | 35 +++++++++++++++++---- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/vnpipe/renpy_templates/game/gui.rpy b/src/vnpipe/renpy_templates/game/gui.rpy index 95e08eb..d2c2043 100644 --- a/src/vnpipe/renpy_templates/game/gui.rpy +++ b/src/vnpipe/renpy_templates/game/gui.rpy @@ -97,7 +97,7 @@ define gui.game_menu_background = "@@MENU_BG@@" ## time. ## The height of the textbox containing dialogue. -define gui.textbox_height = 278 +define gui.textbox_height = 310 ## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is ## center, and 1.0 is the bottom. @@ -130,11 +130,11 @@ define gui.namebox_tile = False ## The placement of dialogue relative to the textbox. These can be a whole ## number of pixels relative to the left or top side of the textbox, or 0.5 to ## center. -define gui.dialogue_xpos = 402 -define gui.dialogue_ypos = 75 +define gui.dialogue_xpos = 360 +define gui.dialogue_ypos = 70 ## The maximum width of dialogue text, in pixels. -define gui.dialogue_width = 1116 +define gui.dialogue_width = 1250 ## The horizontal alignment of the dialogue text. This can be 0.0 for left- ## aligned, 0.5 for centered, and 1.0 for right-aligned. @@ -180,9 +180,9 @@ define gui.button_text_xalign = 0.0 ## ## These customizations are used by the default interface: -define gui.radio_button_borders = Borders(27, 6, 6, 6) +define gui.radio_button_borders = Borders(48, 6, 6, 6) -define gui.check_button_borders = Borders(27, 6, 6, 6) +define gui.check_button_borders = Borders(48, 6, 6, 6) define gui.confirm_button_text_xalign = 0.5 @@ -226,7 +226,7 @@ define gui.choice_button_text_insensitive_color = '#8888887f' define gui.slot_button_width = 414 define gui.slot_button_height = 309 define gui.slot_button_borders = Borders(15, 15, 15, 15) -define gui.slot_button_text_size = 21 +define gui.slot_button_text_size = 26 define gui.slot_button_text_xalign = 0.5 define gui.slot_button_text_idle_color = gui.idle_small_color define gui.slot_button_text_selected_idle_color = gui.selected_color diff --git a/src/vnpipe/renpy_templates/game/screens.rpy b/src/vnpipe/renpy_templates/game/screens.rpy index 7705f0c..467db21 100644 --- a/src/vnpipe/renpy_templates/game/screens.rpy +++ b/src/vnpipe/renpy_templates/game/screens.rpy @@ -135,7 +135,7 @@ style window: yalign gui.textbox_yalign ysize gui.textbox_height - background Image("gui/textbox.png", xalign=0.5, yalign=1.0) + background Frame("gui/textbox.png", 0, 0) style namebox: xpos gui.name_xpos diff --git a/src/vnpipe/renpy_templates/game/styles.rpy b/src/vnpipe/renpy_templates/game/styles.rpy index ac3fc0d..b3c51bc 100644 --- a/src/vnpipe/renpy_templates/game/styles.rpy +++ b/src/vnpipe/renpy_templates/game/styles.rpy @@ -13,27 +13,50 @@ screen vn_art_style_picker(): modal True - add Solid("#000000") + add gui.main_menu_background + add Solid("#000000c8") vbox: xalign 0.5 - yalign 0.5 - spacing 30 + yalign 0.45 + spacing 24 - text "@@ART_STYLE_TITLE@@" xalign 0.5 size 60 - text "@@ART_STYLE_HINT@@" xalign 0.5 size 28 + text "@@ART_STYLE_TITLE@@": + xalign 0.5 + size gui.title_text_size + color gui.accent_color - null height 20 + text "@@ART_STYLE_HINT@@": + xalign 0.5 + size 30 + italic True + + null height 40 for style_id, style_label in vn_art_styles: textbutton style_label: + style_prefix "vn_picker" xalign 0.5 action [SetField(persistent, "art_style", style_id), SetField(persistent, "art_style_chosen", True), Return()] +style vn_picker_button is gui_button +style vn_picker_button_text is gui_button_text + +style vn_picker_button: + xminimum 420 + padding (30, 12) + +style vn_picker_button_text: + size 44 + xalign 0.5 + text_align 0.5 + ## Shown once, before the first scene, when there is a choice to make. label vn_pick_art_style: if len(vn_art_styles) > 1 and not persistent.art_style_chosen: scene black + $ quick_menu = False call screen vn_art_style_picker + $ quick_menu = True return From c759374e4d2370d18b71b6cf87ca49a5cd46442c Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 19 Oct 2026 12:00:36 +0200 Subject: [PATCH 2/3] fix(renpy): ship unlabelled placeholders, bigger title cards, translated music credits Placeholders no longer print the internal asset id; title cards get larger spaced headings and a rule above the subtitle; credits.toml tracks may carry attribution_; slot frame images are generated. Co-Authored-By: Claude Opus 5.5 --- docs/work-config.md | 5 +++-- src/vnpipe/assets.py | 16 +++++++++++----- src/vnpipe/renpy_gen.py | 29 ++++++++++++++++++++++------- tests/test_assets.py | 24 ++++++++++++++++++++++++ tests/test_renpy_gen.py | 20 +++++++++++++++----- 5 files changed, 75 insertions(+), 19 deletions(-) diff --git a/docs/work-config.md b/docs/work-config.md index aad436a..b1a7710 100644 --- a/docs/work-config.md +++ b/docs/work-config.md @@ -77,7 +77,8 @@ mood (`ann.music`), unless overridden: the scene's `subtitle` (else its number). - **Credits**: text author/translator/Gutenberg source from `[work]` and `[source]`; the art line from the manifest's renditions (non-placeholder `source`, e.g. "ChatGPT (OpenAI)"); - the music from `/audio/credits.toml` (`[[track]]` with `file`, `attribution`; only - tracks whose file exists). Attributions are printed verbatim. Labels follow `[work].language`. + the music from `/audio/credits.toml` (`[[track]]` with `file`, `attribution`, optional + `attribution_` used instead when it matches `[work].language`; only tracks whose file + exists). Attributions are printed verbatim. Labels follow `[work].language`. - Defaults: `preferences.text_cps = 40`, `afm_time = 15`, `window auto`, a blinking click-to-continue arrow. Verse boxes stay at 4 lines; NVL keeps stanza pages. diff --git a/src/vnpipe/assets.py b/src/vnpipe/assets.py index 4833354..200cb31 100644 --- a/src/vnpipe/assets.py +++ b/src/vnpipe/assets.py @@ -317,8 +317,13 @@ def process_asset(work_root: Path, asset: dict[str, Any], style: str) -> None: rendition["status"] = "processed" -def placeholder(asset: dict[str, Any], label_color: str = "#d8cfc0") -> Image.Image: - """Deterministic stand-in image so the game always runs.""" +def placeholder( + asset: dict[str, Any], label_color: str = "#d8cfc0", label: bool = True +) -> Image.Image: + """Deterministic stand-in image so the game always runs. + + ``label`` draws the asset id (for the art pipeline); the game ships it without, since + the id is an internal name the player should not see.""" if asset["kind"] == "background": img = Image.new("RGB", BG_SIZE, "#1d1a17") draw = ImageDraw.Draw(img) @@ -330,9 +335,10 @@ def placeholder(asset: dict[str, Any], label_color: str = "#d8cfc0") -> Image.Im draw = ImageDraw.Draw(img) draw.ellipse([170, 40, 330, 220], fill=(60, 52, 46, 230)) draw.rounded_rectangle([110, 230, 390, SPRITE_HEIGHT], 60, fill=(60, 52, 46, 230)) - draw = ImageDraw.Draw(img) - font = ImageFont.load_default(size=40) - draw.text((30, 30), asset["id"], fill=label_color, font=font) + if label: + draw = ImageDraw.Draw(img) + font = ImageFont.load_default(size=40) + draw.text((30, 30), asset["id"], fill=label_color, font=font) return img diff --git a/src/vnpipe/renpy_gen.py b/src/vnpipe/renpy_gen.py index d267c0f..c21936b 100644 --- a/src/vnpipe/renpy_gen.py +++ b/src/vnpipe/renpy_gen.py @@ -325,7 +325,8 @@ def collect_images(work: Work, manifest: dict[str, Any] | None) -> list[ImageEnt candidate = work.path("assets") / rel if style == default: # the fallback may also be a placeholder; otherwise one is generated - ok = rendition and rendition["status"] in {"processed", "approved", "placeholder"} + # (a placeholder is always regenerated, without the asset id label) + ok = rendition and rendition["status"] in {"processed", "approved"} variants.append((style, rel, candidate if ok and candidate.is_file() else None)) elif usable_rendition(asset, style) and candidate.is_file(): variants.append((style, rel, candidate)) @@ -671,12 +672,21 @@ def _check_image(selected: bool, round_: bool) -> Image.Image: return img +def _slot_image(border_alpha: int, fill_alpha: int) -> Image.Image: + """Save-slot frame (Ren'Py scales it with gui.slot_button_borders): thin outline plus tint.""" + img = Image.new("RGBA", (48, 48), IVORY + (fill_alpha,)) + ImageDraw.Draw(img).rectangle([0, 0, 47, 47], outline=ACCENT + (border_alpha,), width=2) + return img + + def gui_extra_images() -> dict[str, Image.Image]: """Deterministic simple GUI images, keyed by path relative to ``game/``.""" base: dict[str, Image.Image] = { "button/background.png": _solid((24, 24), (0, 0, 0, 0)), "button/hover_background.png": _solid((24, 24), ACCENT + (60,)), "button/selected_background.png": _solid((24, 24), ACCENT + (35,)), + "button/slot_idle_background.png": _slot_image(110, 14), + "button/slot_hover_background.png": _slot_image(255, 40), "button/check_foreground.png": _check_image(False, False), "button/check_selected_foreground.png": _check_image(True, False), "button/radio_foreground.png": _check_image(False, True), @@ -807,14 +817,15 @@ def title_cards(work: Work, annotated: dict[str, Any]) -> dict[str, tuple[str, s def render_card(heading: str, subtitle: str | None) -> str: - """A heading, plus a smaller italic line below it when the scene has a subtitle.""" - props = "size=60, text_align=0.5" + """A spaced-out heading; with a subtitle, a thin gold rule and a smaller italic line below.""" + props = "size=76, kerning=3, text_align=0.5, xmaximum=1600" if not subtitle: return f'Text("{escape_text(heading)}", {props})' - sub_props = 'size=30, italic=True, color="#c9a25b", text_align=0.5' + sub_props = 'size=34, italic=True, color="#c9a25b", text_align=0.5, xmaximum=1600' return ( f'VBox(Text("{escape_text(heading)}", {props}, xalign=0.5), ' - f'Text("{escape_text(subtitle)}", {sub_props}, xalign=0.5), spacing=28)' + 'Solid("#c9a25b", xsize=200, ysize=2, xalign=0.5), ' + f'Text("{escape_text(subtitle)}", {sub_props}, xalign=0.5), spacing=26)' ) @@ -903,7 +914,11 @@ def credits_sections(work: Work, manifest: dict[str, Any] | None) -> list[tuple[ sections.append((ui["art"], [ui["art_with"].format(", ".join(sources))])) tracks = credit_tracks(work) if tracks: # attributions are printed verbatim (CC BY-SA requires them) - sections.append((ui["music"], [t["attribution"] for t in tracks])) + lang = info.get("language", "es") + # `attribution_` is the same credit translated, used when present + sections.append( + (ui["music"], [t.get(f"attribution_{lang}") or t["attribution"] for t in tracks]) + ) about_tail = ABOUT_LABELS.get(info.get("language", "es"), ABOUT_LABELS["en"])[2] sections.append(("vnpipe", [about_tail])) return [(title, [_markup(e) for e in entries]) for title, entries in sections] @@ -1039,7 +1054,7 @@ def generate( if source: shutil.copyfile(source, dest) else: - placeholder(e.asset).save(dest, "WEBP", quality=90) + placeholder(e.asset, label=False).save(dest, "WEBP", quality=90) return sorted(written) diff --git a/tests/test_assets.py b/tests/test_assets.py index 516d721..5bd14ec 100644 --- a/tests/test_assets.py +++ b/tests/test_assets.py @@ -316,6 +316,7 @@ def test_renpy_condition_switch_and_fallback(work_root, tmp_path): assert 'default persistent.art_style = "paint"' in styles assert "define vn_art_styles = [('paint', 'Paint'), ('ink', 'Ink')]" in styles assert "@@" not in styles + assert "$ quick_menu = False" in styles # the picker hides the in-game quick menu assert "call vn_pick_art_style" in (out / "game/script.rpy").read_text(encoding="utf-8") screens = (out / "game/screens.rpy").read_text(encoding="utf-8") assert "Estilo visual" in screens and 'SetField(persistent, "art_style", style_id)' in screens @@ -353,3 +354,26 @@ def test_two_style_project_lints_and_plays(work_root, tmp_path): report = lint.stdout + lint.stderr assert lint.returncode == 0 and "error" not in report.lower(), report test_renpy_gen.run_e2e(out, home) + + +def test_placeholder_label_only_when_asked(): + from PIL import ImageChops + + from vnpipe.assets import placeholder + + asset = {"id": "bg_x", "kind": "background"} + labelled, plain = placeholder(asset), placeholder(asset, label=False) + assert ImageChops.difference(labelled, plain).getbbox() is not None + # the shipped placeholder is the plain gradient: no pixel brighter than its last row + assert plain.getpixel((0, 0)) != plain.getpixel((0, plain.height - 1)) # a bare gradient + + +def test_renpy_regenerates_placeholders_and_adds_slot_frames(work_root, tmp_path): + assets.ensure_placeholder( + work_root, assets.find_asset(assets.load_manifest(work_root), "bg_theatre"), "paint" + ) + out = gen(work_root, tmp_path) + shipped = Image.open(out / "game/images/bg/paint/theatre.webp").convert("RGB") + assert shipped.getpixel((0, 40)) == shipped.getpixel((300, 40)) # no label on the row + assert (out / "game/gui/button/slot_idle_background.png").is_file() + assert (out / "game/gui/button/slot_hover_background.png").is_file() diff --git a/tests/test_renpy_gen.py b/tests/test_renpy_gen.py index 0f9cc12..4f2ec1e 100644 --- a/tests/test_renpy_gen.py +++ b/tests/test_renpy_gen.py @@ -175,7 +175,10 @@ def test_characters_and_images(project): def test_title_card_images(project): images = (project / "game/images.rpy").read_text(encoding="utf-8") - assert 'image card_talk = Text("CONVERSACIÓN", size=60, text_align=0.5)' in images + assert ( + 'image card_talk = Text("CONVERSACIÓN", size=76, kerning=3, text_align=0.5, xmaximum=1600)' + in images + ) assert 'image card_end = Text("Continuará…"' in images @@ -498,9 +501,12 @@ def test_title_card_subtitle(work, annotated, tmp_path): scenes = [{"heading": "CONVERSACIÓN", "id": "talk", "subtitle": "Escenario · Día"}] out = _project(work, annotated, tmp_path, scenes=scenes) images = (out / "game/images.rpy").read_text(encoding="utf-8") - assert 'image card_talk = VBox(Text("CONVERSACIÓN", size=60' in images - assert 'Text("Escenario · Día", size=30, italic=True' in images - assert 'image card_lyric = Text("LÍRICA", size=60, text_align=0.5)' in images # no subtitle + assert 'image card_talk = VBox(Text("CONVERSACIÓN", size=76' in images + assert 'Text("Escenario · Día", size=34, italic=True' in images + assert ( + 'image card_lyric = Text("LÍRICA", size=76, kerning=3, text_align=0.5, xmaximum=1600)' + in images + ) # no subtitle def test_scene_labels_and_menus(project, script): @@ -528,8 +534,11 @@ def test_credits_from_work_audio_and_manifest(work, tmp_path): root = tmp_path / "w" (root / "audio").mkdir(parents=True) (root / "audio/a.ogg").write_bytes(b"OggS") + (root / "audio/b.ogg").write_bytes(b"OggS") (root / "audio/credits.toml").write_text( '[[track]]\nfile = "audio/a.ogg"\nattribution = "Bach [x]. CC BY-SA 4.0."\n' + '[[track]]\nfile = "audio/b.ogg"\nattribution = "Liszt. Performed by X."\n' + 'attribution_es = "Liszt. Interpretación de X."\n' '[[track]]\nfile = "audio/missing.ogg"\nattribution = "not shipped"\n', encoding="utf-8", ) @@ -547,7 +556,8 @@ def test_credits_from_work_audio_and_manifest(work, tmp_path): assert sections["Texto"][1] == "Traducción: T. Translator" assert "Proyecto Gutenberg, n.º 42" in sections["Texto"][2] assert sections["Ilustraciones"] == ["Ilustraciones generadas con ChatGPT (OpenAI)"] - assert sections["Música"] == ["Bach [[x]. CC BY-SA 4.0."] # verbatim, markup-escaped only + # verbatim (markup-escaped only); a translated `attribution_` wins when present + assert sections["Música"] == ["Bach [[x]. CC BY-SA 4.0.", "Liszt. Interpretación de X."] def test_main_menu_background_from_ui(work, annotated, tmp_path): From a811e0c3c971f3342e5f9a46edf59a8ad2272f1e Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 19 Oct 2026 12:01:18 +0200 Subject: [PATCH 3/3] feat(renpy): fade the music out with the end card Co-Authored-By: Claude Opus 5.5 --- src/vnpipe/renpy_gen.py | 1 + tests/test_renpy_gen.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/vnpipe/renpy_gen.py b/src/vnpipe/renpy_gen.py index c21936b..64e3eb7 100644 --- a/src/vnpipe/renpy_gen.py +++ b/src/vnpipe/renpy_gen.py @@ -637,6 +637,7 @@ def render_script(work: Work, annotated: dict[str, Any], audio: Audio | None = N raise ValueError(f"cues refer to unknown line ids: {sorted(missing)}") out += [ "label the_end:", + *([" stop music fadeout 3.0"] if audio.files else []), " scene black", " with fade", " show card_end at truecenter", diff --git a/tests/test_renpy_gen.py b/tests/test_renpy_gen.py index 4f2ec1e..10ecd98 100644 --- a/tests/test_renpy_gen.py +++ b/tests/test_renpy_gen.py @@ -197,12 +197,16 @@ def test_music_only_when_audio_exists(work, annotated, tmp_path): out = tmp_path / "p" renpy_gen.generate(work, annotated, out) assert "play music" not in (out / "game/script.rpy").read_text(encoding="utf-8") + assert "label the_end:\n scene black" in (out / "game/script.rpy").read_text( + encoding="utf-8" + ) (out / "game/audio").mkdir() (out / "game/audio/sacred.ogg").write_bytes(b"OggS") renpy_gen.generate(work, annotated, out) text = (out / "game/script.rpy").read_text(encoding="utf-8") assert 'play music "audio/sacred.ogg" fadeout 1.0 fadein 1.0 if_changed' in text assert "stop music fadeout 1.0" in text # mood "none" on the Lord's first line + assert "label the_end:\n stop music fadeout 3.0" in text # the music fades with the end card assert (out / "game/audio/sacred.ogg").is_file() # regeneration keeps user audio