Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34f2c89740 | ||
|
|
26c5416fc5 | ||
|
|
fbf5bad67e | ||
|
|
70d7e5374a | ||
|
|
c68467f49a | ||
|
|
d809799dc8 | ||
|
|
25b7436911 | ||
|
|
24321e7f6d | ||
|
|
15551de6bd | ||
|
|
29dcb52f68 |
@@ -41,10 +41,10 @@ jobs:
|
||||
# Pinned to the same commit SHA (v7.0.1) the publish workflow uses.
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
# Pinned to an immutable commit SHA (v7.0.0), matching the publish
|
||||
# Pinned to an immutable commit SHA (v7.1.0), matching the publish
|
||||
# workflow's SHA-pinning convention. Re-verify and bump when updating:
|
||||
# git ls-remote https://github.com/actions/setup-python refs/tags/v7
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
|
||||
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Validate data integrity
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
|
||||
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- name: Install ruff
|
||||
@@ -129,9 +129,9 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
- name: Set up Node
|
||||
# Pinned to an immutable commit SHA (v7.0.0). Re-verify and bump when
|
||||
# Pinned to an immutable commit SHA (v7.1.0). Re-verify and bump when
|
||||
# updating: git ls-remote https://github.com/actions/setup-node refs/tags/v7
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
|
||||
with:
|
||||
# registerHooks (tests/frontend/hooks.mjs) needs >=22.15.0 / >=23.5.0.
|
||||
node-version: "24"
|
||||
|
||||
@@ -8,20 +8,21 @@ investigation notes, 1.5.0+ — the reasoning for every item in the release list
|
||||
|
||||
## Current state
|
||||
|
||||
_Last verified: 2026-10-28 (2.2.0)_
|
||||
_Last verified: 2026-11-24_
|
||||
|
||||
- **Status:** in active development; main is v2.2.0 (`pyproject.toml`); 2.0.0 was the seed epoch (every seed resolves differently from 1.x, by design). Published to the Comfy Registry via `.github/workflows/publish_action.yml`, which fires on a `pyproject.toml` version change on `main` - bump the version on every functional commit or the release never ships. CI (`.github/workflows/ci.yml`) is deliberately dependency-free, has a Windows leg, and `publish-node` needs it (1.8.0).
|
||||
- **Works:** the constraint engine resolving dropdowns into coherent prose plus structured JSON, seed-reproducible; the four preset layer nodes (Archetype, Creature, Modifier, Cosplayer); searchable dropdown widgets, live preview, the `franchise_filter`, the `random_pool` scope-composing filter, and the save/load vault in `js/` (an atomic overwrite, a disk-change-aware cache fingerprint, and Windows-reserved-name handling as of 1.5.5); a searchable **in-node roster picker** (`js/identity_forge_picker.js`) on the Cosplayer/Archetype/Creature nodes — trait facets, gender and franchise filters, cross-tab search, opt-in gallery thumbnails, backed by a generated `js/identity_forge_roster.json` search index; Stylebook interop, the composition axis, and the **Turnaround** reference-set node (which emits every camera view of one resolved character as a list, so one queue renders the set) and its face-side sibling the **Expression Sheet** (1.10.0: one view per curated expression/mood/smile triple); a free-text `held_item` on the Modifier node; a jsdom frontend suite alongside the Python one; generated reference docs and JS data, and a committed field-marginals baseline (`scripts/sweep_marginals.py`, 1.5.5 — catches a value drawing far more or less often than intended), plus a reachability gate (`--unreachable`, 1.8.0: every pool value some gender can draw, or a reasoned exception in `tests/fixtures/unreachable_by_design.json`), all with `--check` modes wired into the gate. A cosplay entry may render as a **person in a costume**, as a **mascot suit** (`covers_face` + `covers_body` + `mask`), or — since 0.95.0 — as the **beast itself** (`body_plan: "feral"`, which emits the Creature node's Species & Anatomy payload instead of a costume); see architecture.md → "Animal characters split four ways". `scripts/render_gallery.py` renders a roster entry's gallery image by driving a running ComfyUI over HTTP and publishes it to `gh-pages`, and `gallery/render_manifest.json` + `--check` fail CI when an entry's text changes without a re-render (architecture.md → "The gallery render pipeline"). Since 0.97.0 every roster entry also carries a **release stamp** (`data/versions.py`, written by `scripts/stamp_versions.py`, gated in CI), which is what lets the three sample gallery pages offer **A–Z / Newest first** and a **New in `<version>`** filter. Since 2.0.0: a **`gaze`** field drawn last with `pose` (both with live constraint rules; architecture.md -> "pose and gaze draw last"), opt-in **`costume_back`** for Turnaround back views, **per-garment `{slot}` variation** in the outfit corpus on its own seed stream, and a gallery hash over **resolved prose** so an engine change marks images stale.
|
||||
- **In progress:** roster and coherence curation is the ongoing work, not a milestone - each release adds characters/creatures/archetypes and closes coherence bugs found by rendering them. `docs/suggested-additions.md` is the live backlog (under consideration / decided against / still to consider). Next: more `costume_back` entries (start with caped or back-emblem heroes) and more slotted corpus phrases; both are seed-safe additions now (a slot draws from its own stream; a back text touches only back views).
|
||||
- **Status:** in active development; main is v2.8.0 (`pyproject.toml`); 2.0.0 was the seed epoch (every seed resolves differently from 1.x, by design). Published to the Comfy Registry via `.github/workflows/publish_action.yml`, which fires on a `pyproject.toml` version change on `main` - bump the version on every functional commit or the release never ships. CI (`.github/workflows/ci.yml`) is deliberately dependency-free, has a Windows leg, and `publish-node` needs it (1.8.0).
|
||||
- **Works:** the constraint engine resolving dropdowns into coherent prose plus structured JSON, seed-reproducible; the four preset layer nodes (Archetype, Creature, Modifier, Cosplayer); searchable dropdown widgets, live preview, the `franchise_filter`, the `random_pool` scope-composing filter, and the save/load vault in `js/` (an atomic overwrite, a disk-change-aware cache fingerprint, and Windows-reserved-name handling as of 1.5.5); a searchable **in-node roster picker** (`js/identity_forge_picker.js`) on the Cosplayer/Archetype/Creature nodes - trait facets, gender and franchise filters, cross-tab search, opt-in gallery thumbnails, backed by a generated `js/identity_forge_roster.json` search index; Stylebook interop, the composition axis, and the **Turnaround** reference-set node (which emits every camera view of one resolved character as a list, so one queue renders the set) and its face-side sibling the **Expression Sheet** (1.10.0: one view per curated expression/mood/smile triple); a free-text `held_item` on the Modifier node; a jsdom frontend suite alongside the Python one; generated reference docs and JS data, and a committed field-marginals baseline (`scripts/sweep_marginals.py`, 1.5.5 - catches a value drawing far more or less often than intended), plus a reachability gate (`--unreachable`, 1.8.0: every pool value some gender can draw, or a reasoned exception in `tests/fixtures/unreachable_by_design.json`), all with `--check` modes wired into the gate. A cosplay entry may render as a **person in a costume**, as a **mascot suit** (`covers_face` + `covers_body` + `mask`), or - since 0.95.0 - as the **beast itself** (`body_plan: "feral"`, which emits the Creature node's Species & Anatomy payload instead of a costume); see architecture.md -> "Animal characters split four ways". `scripts/render_gallery.py` renders a roster entry's gallery image by driving a running ComfyUI over HTTP and publishes it to `gh-pages`, and `gallery/render_manifest.json` + `--check` fail CI when an entry's text changes without a re-render (architecture.md -> "The gallery render pipeline"). Since 0.97.0 every roster entry also carries a **release stamp** (`data/versions.py`, written by `scripts/stamp_versions.py`, gated in CI), which is what lets the three sample gallery pages offer **A-Z / Newest first** and a **New in `<version>`** filter. Since 2.0.0: a **`gaze`** field drawn last with `pose` (both with live constraint rules; architecture.md -> "pose and gaze draw last"), opt-in **`costume_back`** for Turnaround back views, **per-garment `{slot}` variation** in the outfit corpus on its own seed stream, and a gallery hash over **resolved prose** so an engine change marks images stale. Since 2.3.0: the **Outfit Sheet** and **Age Progression** sheet nodes (they release the fields a pin refuses via `lock_clash` rather than override them; architecture.md -> "Sheets that change the person"), and picker previews served through a **server-side gallery cache** (`nodes/gallery_cache.py`) so they work under ComfyUI `--offline`. Since 2.6.0: the **Scene Sheet** node (one person in several places, dressed for each), `pin_framing()` for every sheet's framing pin, picker stars, a seeded random pick on Vault Load, example workflows for every sheet, and one `gallery/shared/` copy of the gallery page assets. Since 2.7.0: a fourth gallery, **`gallery/people/`** - fixed seeds on the plain node at its defaults (`PEOPLE` in `scripts/render_gallery.py`, same prose-hash gate), each card showing its seed and full prompt with a copy button (gallery/README.md -> "The people gallery").
|
||||
- **In progress:** roster and coherence curation is the ongoing work, not a milestone - each release adds characters/creatures/archetypes and closes coherence bugs found by rendering them. `docs/suggested-additions.md` is the live backlog (under consideration / decided against / still to consider). Next: more `costume_back` entries (2.3.0 covered the first caped and back-emblem heroes; continue with the rest of the capes) and more slotted corpus phrases; both are seed-safe additions now (a slot draws from its own stream; a back text touches only back views).
|
||||
- **Recent releases** — one line each. **This list is a pointer, not a changelog:** the reasoning for every item is in `docs/history.md` (the sections are named there per release) and the full messages are in `git log`. Keep roughly the last eight and let older ones drop off; do not let an entry grow into a paragraph.
|
||||
- **2.8.0** - Vault Load accepts a name this vault lacks (`validate_inputs`; it passes the upstream through instead of failing the queue), Refresh no longer swaps the pick for another saved character, rename follows the pick; picker plural search ("boots" finds "boot") and a Queue random button. Random characters unchanged. See docs/history.md -> "2.8.0".
|
||||
- **2.7.1** - No more NaN `fingerprint_inputs` (PR #20): it re-ran every downstream node, sampler included, on every queue. Vault Load's random pick fingerprints the entry it lands on. Random characters unchanged. See docs/history.md -> "2.7.1".
|
||||
- **2.7.0** - Roster batch (Sheena Fujibayashi with her three looks, Tales, Hellsing, Final Fantasy, Metal Gear, KOS-MOS, Skullgirls, Kula, Beatrix and others), Pyra/Mythra corrected to canon, a nose prose fix (existing tiles rehashed), and the people gallery (`gallery/people/`). Random characters unchanged (the Cosplayer node's Random pick moves, as with any roster addition). See docs/history.md -> "2.7.0".
|
||||
- **2.6.1** - Trims the `pyproject.toml` description under the Registry's 1000-character limit (2.6.0's publish failed on it) and tests the limit. See docs/history.md -> "2.6.1".
|
||||
- **2.6.0** - Audit fixes: framing pins release what they refuse (`pin_framing`), the Outfit Sheet busts the cache, user archetypes keep lists and variants and user cosplayers keep alternates, back views and `subject`, gallery cache offline back-off and raster-only, roll route ignores non-text values, case-only vault rename, shared gallery page assets, ruff pinned, example workflows and node contracts tested. Adds the Scene Sheet node, picker stars, a random saved character on Vault Load, and Turnaround / Expression / Scene Sheet example workflows. Random characters unchanged. See docs/history.md -> "2.6.0".
|
||||
- **2.5.0** - Picker search: word-start, accent-insensitive matching with quoted phrases and a one-way `SEARCH_ALSO` synonym/compound list, every description field indexed (eyes, alternate costumes, back view, anatomy), a type-to-filter franchise box, cosplayer-only filters hidden on Archetype/Creature, reopening on the current pick, and a Queue each button for a filtered set. Frontend and roster index only; random characters unchanged. See docs/history.md -> "2.5.0".
|
||||
- **2.4.0** - Figure Skater on the ice with standing poses (Hockey Goalie, Roller Derby, Carhop, Scuba Diver and Samurai pose locks too), several archetypes moved to a location that fits them, four new venues (wrestling ring, tennis court, pit lane, racecourse paddock), no leaning or perching in open landscapes, no blank-backdrop composition indoors, Indie Sleaze men's costumes split from the women's, a man keeps a locked eyeliner, 1980s New Wave women draw 80s makeup, a prop in each hand drops one-handed poses, and Yoda, Ahsoka, Piccolo, Bane and the Star Wars guards no longer draw a random human under the costume. Anthropomorphic creatures render as one clothed hybrid (Monsters/Aliens lead "humanoid X", an optional per-creature `anthro` text block, and the optional Krea2T Enhancer in the gallery renderer). Random characters move (marginals re-baselined). See docs/history.md -> "2.4.0".
|
||||
- **2.3.0** - Picker previews through a server-side cache (they now show under `--offline`, with a Clear cached previews button), Outfit Sheet and Age Progression nodes (shared `replay_base` / `release_fields` helpers in the Turnaround module), an Aztec Noble archetype, and `costume_back` for caped and back-emblem heroes. Random characters unchanged (the Archetype node's Random pick moves, as with any archetype addition). See docs/history.md -> "2.3.0".
|
||||
- **2.2.0** - Cyberpunk roster (David Martinez, Panam and Rebecca rebuilt to canon; new Maine, Kiwi, Talia Yang, Adam Smasher, Song So Mi with a weighted netrunner alternate), Volcana, four period court archetypes (Rococo Courtier, Medieval Monarch, Ottoman Court, Heian Court) and a Female variant for Ancient Roman Patrician, a `tattoos` lock kept in Essentials, a costume-named earring or necklace suppressing the random one, a `gilded palace throne room` location, tattoo and piercing locks on eleven period archetypes, a franchise filter in the roster picker, and four punk/pinup outfit-corpus phrases (the location and the outfits move random seeds). See docs/history.md -> "2.2.0".
|
||||
- **2.1.0** - R2-D2, BB-8 and Gonk Droid render as the droid (non-humanoid machines now take `body_plan: "feral"` with a cosplay-only `creature_class: "Machines"`), new machine and object entries (Claptrap, WALL-E, Dalek, Johnny 5, Codsworth, Mrs. Potts, Cogsworth), the sd-character-finder survey batch (first Touhou entries, Snoopy, Doraemon, Hello Kitty, Meta Knight and others), Blue Beetle (Ted Kord) recoloured to canon, a Female/Male filter in the roster picker, an optional cosplay `subject` lead noun (Tellarite, aliens, and mascots that drew a person with a plush now render as the character; single-eye cyclopes remain a model limit), Orion with a weighted alternate look (`costume_weights`), and the survey's second tier (RWBY, Nanoha, BlazBlue, Tiger & Bunny and others). Random characters unchanged (the droids move between the Masked, People-only and Beast scopes). See docs/history.md -> "2.1.0".
|
||||
- **2.0.0** - Seed epoch: a `gaze` field (the old `looking` poses) drawn last with a deferred `pose` (`_repair_pose` retired), women's hair-length and 75/80 age weights, a portrait rig gated out of everyday interiors (`studio_shape` / `studio_mood` split), per-garment `{slot}` variation, opt-in `costume_back` for Turnaround back views, no "Name (Name)" label, an article for noun expressions, and a prose-based gallery hash (existing tiles accepted with `--rehash`, no full re-render). See docs/history.md -> "2.0.0".
|
||||
- **1.11.0** - Roster release: new cosplayers (incl. Birdie, Vecna on the mascot route), retro archetypes (Carhop at a new drive-in location, Zoot Suit men's only), four creatures, a `_GALLERY_SHOT` framing pin, Lola Bunny's paws, Tellarite's canon text (snout still unrendered). Random characters move only through the new location (about 5% of seeds, those drawing an urban outdoor place). Corinthian, Feyd-Rautha, barreleye, vampire squid and the pachuca variant declined on the render bar. See docs/history.md -> "1.11.0".
|
||||
- **1.10.0** - Expression Sheet node, free-text `held_item` on the Modifier, legwear dropped from prose in leg-cropping shots, "a coat of fur" no longer read as a pocketed garment, an overload drift test, and a gallery gate that fails on rendered-but-unpublished images (`--publish-pending`). Random characters unchanged; Bartok (now feral), Lola Bunny and Tasmanian Devil repaired and re-rendered (Tellarite deferred to 1.11.0). See docs/history.md -> "1.10.0".
|
||||
- **1.9.0** - Sandman and independent-comics curation, Savage Dragon likeness repair, a Morris Dancer archetype, deployment-only gallery manifests, and accurate engine/preset typing. See docs/history.md -> "1.9.0".
|
||||
- **1.8.0** — Picker trait facets read structured `traits` (Poison Ivy is no longer "Tiny"); ethnicity and skin tone lock only in Full character / Full preset; a seventh `subject_text` output (person and outfit, no scene); colour and pattern modifiers reach a generated outfit; widgets_values saved in schema order for headless tools; `--unreachable` gate; publish depends on CI with a Windows leg; new cosplayers (incl. The Invisibles), three archetypes and a stegosaurus; the duplicate Julia Carpenter entry folded into one. See docs/history.md → "1.8.0".
|
||||
- **1.7.0** — Engine and UX fixes from the 1.6.0 review: "Roll + lock all" locks one engine roll (a new read-only `POST /identity_forge/roll` route) instead of uniform per-dropdown picks; a framing that crops the feet no longer names the shoes in the prose (the JSON keeps them); hair styles and noun lengths are voiced as prose, not a tag list; a footwear or legwear modifier now reaches a generated outfit; the Modifier help example decorates single fields; `generate_character` is keyword-only from `widget_locked`. See docs/history.md → "1.7.0".
|
||||
- **Known gaps / next steps:** two deliberate, open items — not to be re-litigated without a fresh case (the old pockets-allowlist gap was measured and closed in 1.10.0): (1) the Turnaround node's back view still draws a costume's front-facing detail (e.g. a chest emblem) on the back for any entry without a `costume_back` (opt-in since 2.0.0, so far only a handful of flagship heroes); never parse the front text for back clauses (the regex-over-prose trap), add `costume_back` to the entry instead. (2) Costume text that asserts a body trait against an unpinned random field (e.g. "on a hulking frame" beside a random, unlocked `build`) — the `signature`/`physique` split that causes it is deliberate; measure again from scratch before touching it, a naive regex sweep has reported a wrong count here before. `docs/suggested-additions.md` is the live backlog for roster/field-option candidates.
|
||||
- **Deep docs:** `docs/architecture.md` (deep reference — read before engine or data changes), `docs/history.md` (per-release investigation notes, 1.5.0+), `docs/usage.md`, `docs/cosplayer-notes.md`, `docs/creature-notes.md`, `docs/suggested-additions.md` (backlog), `docs/reference/*.md` (generated).
|
||||
|
||||
@@ -44,6 +45,7 @@ _Last verified: 2026-10-28 (2.2.0)_
|
||||
| `scripts/` | Reference doc generator, JS data sync generator, frontend schema fixture generator, release stamper, gallery renderer + hash gate |
|
||||
| `docs/` | Usage, architecture (deep reference), cosplayer/creature notes |
|
||||
| `gallery/` | Sample render manifests and build scripts (images on `gh-pages` only) |
|
||||
| `example_workflows/` | Ready-made workflows; ComfyUI lists them in its template browser. Build them in the real frontend (an isolated instance), never by hand: `widgets_values` order is positional |
|
||||
|
||||
## Build / test / run
|
||||
|
||||
@@ -63,6 +65,10 @@ python -m unittest discover -s tests -t . -v
|
||||
# NOT the maintainer's denylist checker, which lives outside this repo.
|
||||
python scripts/check_public_safety.py
|
||||
|
||||
# Lint. pyproject.toml pins ruff to the CI version (required-version); another
|
||||
# local ruff refuses to run, so call the pinned one:
|
||||
uvx ruff@0.15.11 check .
|
||||
|
||||
# Frontend jsdom suite (separate toolchain: npm ci once, then this)
|
||||
npm run test:frontend
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ Browse the galleries: [cosplay](https://enragedantelope.github.io/comfyui-identi
|
||||
[archetypes](https://enragedantelope.github.io/comfyui-identity-forge/gallery/archetypes/) ·
|
||||
[creatures](https://enragedantelope.github.io/comfyui-identity-forge/gallery/creatures/) — every roster
|
||||
entry with a sample render, searchable by name and franchise, each linked to the exact workflow it was made with.
|
||||
The [people](https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/) gallery shows random people
|
||||
from the plain node, each card with its seed and the full prompt.
|
||||
|
||||
## Why Identity Forge?
|
||||
|
||||
@@ -27,7 +29,7 @@ The Cosplayer node is where Identity Forge really shines. Most character wildcar
|
||||
|
||||
Ask a plain wildcard for Chun-Li and your prompt says `Chun-Li`. Ask this Cosplayer node and you get: *the blue qipao with gold trim, brown tights, white cross-laced boots, and spiked bracelets.* The look renders even on checkpoints that have never heard of the character.
|
||||
|
||||
**Find one fast:** open the in-node picker to browse and search the whole roster without leaving the node — trait facets (Giant, Masked, Mascot/full-suit, Beast), Female/Male and franchise filters, and optional thumbnail previews. The picker remembers your search, tab and facet while the workflow is open, so you can pick, close and come back to the same filtered view; reloading starts fresh.
|
||||
**Find one fast:** open the in-node picker to browse and search the whole roster without leaving the node - trait facets (Giant, Masked, Mascot/full-suit, Beast), Female/Male and a type-to-filter franchise box, a **Queue each** button that runs every match in turn (or **Queue random** for one of them), starred favourites, and optional thumbnail previews (fetched once by your ComfyUI server and cached on disk, so they still show when ComfyUI runs with `--offline`). The picker remembers your search, tab and facet while the workflow is open, so you can pick, close and come back to the same filtered view, scrolled to your current pick; reloading starts fresh. Search rules are in [docs/usage.md](docs/usage.md#searching-the-picker).
|
||||
|
||||
**Characters from every major franchise:** Marvel, DC, Star Wars, anime, video games, fantasy, sci-fi, horror. Each one with multiple costume variants where applicable (Harley Quinn's three iconic looks, Catwoman's different suits, etc.). Characters rotate between variants by seed, so the same name yields a different signature costume each roll.
|
||||
|
||||
@@ -46,6 +48,14 @@ The **Expression Sheet** node is its face-side sibling: the same resolved charac
|
||||
expression (neutral, smile, laughing, surprised, serious, sad, and more), with only the expression,
|
||||
mood and smile changing. See [docs/usage.md](docs/usage.md#expression-sheets).
|
||||
|
||||
Three more sheets work the same way. The **Outfit Sheet** keeps the person and redresses them once per
|
||||
outfit style (casual, business formal, evening formal and so on) on a plain studio backdrop, the
|
||||
**Scene Sheet** shows them in several places (park, coffee shop, office, beach...), dressed for each,
|
||||
and the **Age Progression** node shows the same person at several ages, greying natural hair as they age.
|
||||
See [docs/usage.md](docs/usage.md#outfit-sheets), [docs/usage.md](docs/usage.md#scene-sheets) and
|
||||
[docs/usage.md](docs/usage.md#age-progression). Ready-made workflows are in
|
||||
[example_workflows/](example_workflows/) and in ComfyUI's template browser under Identity Forge.
|
||||
|
||||
### Additional layers
|
||||
|
||||
- **Archetype:** Themed looks (knight, sorceress, astronaut, surgeon, 1950s homemaker…) that set the *look* while the person randomizes.
|
||||
@@ -77,15 +87,15 @@ randomized identities, so your own results will vary:
|
||||
|
||||
### Sample outputs
|
||||
|
||||
**Identity Forge** — random people:
|
||||
**Identity Forge** - random people ([more, with seeds and prompts](https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/)):
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img width="200" src="https://github.com/user-attachments/assets/5c6d404d-8cb8-4466-9575-21783c6f2287" /></td>
|
||||
<td><img width="200" src="https://github.com/user-attachments/assets/82d0bb40-d3c6-47c9-83f1-6f33aa7e9260" /></td>
|
||||
<td><img width="200" src="https://github.com/user-attachments/assets/9755ef20-0429-4d64-949f-2826a83cc2e7" /></td>
|
||||
<td><img width="200" src="https://github.com/user-attachments/assets/15d61d28-d79a-4ad0-b17f-7346b83ab56c" /></td>
|
||||
<td><img width="200" src="https://github.com/user-attachments/assets/00172e67-12f7-4518-b08f-663afce2a363" /></td>
|
||||
<td><img width="200" src="https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/images/Sample%2003.jpeg" /></td>
|
||||
<td><img width="200" src="https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/images/Sample%2010.jpeg" /></td>
|
||||
<td><img width="200" src="https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/images/Sample%2015.jpeg" /></td>
|
||||
<td><img width="200" src="https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/images/Sample%2018.jpeg" /></td>
|
||||
<td><img width="200" src="https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/images/Sample%2023.jpeg" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -136,9 +146,12 @@ randomized identities, so your own results will vary:
|
||||
| **Cosplayer** | Fictional characters (Spider-Man, 2B, She-Hulk, Zelda…) as a *cosplay look* — the costume on a random, optionally cross-gender person. An in-node picker browses and searches the whole roster with trait facets and thumbnails. |
|
||||
| **Creature** | Render the character as a non-human form (animal, insect, marine, reptile, bird, monster, alien, mythic, plant), across all classes or one, hybridized slot-by-slot. Generic species only — a *named* fictional beast (Appa, Toothless) is a Cosplayer entry. Also has the in-node roster picker. |
|
||||
| **Modifier** | Prepend a custom descriptor to one field (`footwear: sci-fi`) or a whole group (`Clothing: weathered`). An optional `held_item` box sets a free-text prop ("a red paper umbrella"). |
|
||||
| **Vault Save / Load** | Save a generated character (with a thumbnail) to a local vault; recall it later as a chainable preset, with a Manage Vault gallery. |
|
||||
| **Vault Save / Load** | Save a generated character (with a thumbnail) to a local vault; recall it later as a chainable preset (or a seeded random pick of your saves), with a Manage Vault gallery. |
|
||||
| **Turnaround** | A reference-sheet builder: wire Identity Forge's `prompt_json` in and it emits front / three-quarter / profile / back as a **list**, so one queue renders the whole set of the same person. It only moves the camera - the character and the scene stay configured on Identity Forge. |
|
||||
| **Expression Sheet** | The same idea for the face: wire `prompt_json` in and it emits one prompt per expression (Basic 6, Full 10 or Smiles 3) as a **list**. Only expression, mood and smile change (plus the gaze, if you pick one to hold). |
|
||||
| **Outfit Sheet** | Wire `prompt_json` in and it emits one prompt per outfit style (Range 6, Everyday 4, Work to evening 4 or Every style) as a **list**: the same person redressed, on a studio backdrop or in their own scene; `outfit_seed` re-rolls every outfit for the same person. Makeup, jewellery and hair styling follow the outfit; face and body stay. A cosplay or full-suit character gives a single view. |
|
||||
| **Scene Sheet** | Wire `prompt_json` in and it emits the same person in several places (Everyday 6, Indoors 4, Outdoors 4 or Studio backdrops 3) as a **list**, with light and season redrawn for each place. By default each place picks a fitting outfit; "Keep the outfit" keeps the clothes and skips places they do not suit. A cosplay character keeps the costume. |
|
||||
| **Age Progression** | Wire `prompt_json` in and it emits the same person at several ages (Life stages 4, Decades 6 or Young and old 2) as a **list**. Natural hair greys with age; dyed, vivid and costume hair stay as they are. A masked character gives a single view. |
|
||||
|
||||
---
|
||||
|
||||
|
||||
+75
-4
@@ -1,6 +1,6 @@
|
||||
"""comfyui-identity-forge — V3 custom node pack entrypoint.
|
||||
|
||||
Exposes nine nodes:
|
||||
Exposes twelve nodes:
|
||||
|
||||
* ``IdentityForge`` — a multi-field character description randomizer with a
|
||||
constraint engine and dual prose/JSON output.
|
||||
@@ -15,6 +15,12 @@ Exposes nine nodes:
|
||||
view of it as a list, so one queue renders a whole reference set.
|
||||
* ``IdentityForgeExpressionSheet`` - the same idea for the face: one resolved
|
||||
character, several expressions, as a list.
|
||||
* ``IdentityForgeOutfitSheet`` - the same idea for the clothes: one resolved
|
||||
character, several outfit styles, as a list.
|
||||
* ``IdentityForgeAgeProgression`` - one resolved character at several ages, as a
|
||||
list.
|
||||
* ``IdentityForgeSceneSheet`` - one resolved character in several places, as a
|
||||
list.
|
||||
* ``IdentityForgeVaultSave`` — save a generated character to a local vault.
|
||||
* ``IdentityForgeVaultLoad`` — recall a saved character as a chainable preset.
|
||||
|
||||
@@ -43,6 +49,9 @@ try:
|
||||
from .nodes.identity_forge_modifier import IdentityForgeModifier
|
||||
from .nodes.identity_forge_turnaround import IdentityForgeTurnaround
|
||||
from .nodes.identity_forge_expression_sheet import IdentityForgeExpressionSheet
|
||||
from .nodes.identity_forge_outfit_sheet import IdentityForgeOutfitSheet
|
||||
from .nodes.identity_forge_age_progression import IdentityForgeAgeProgression
|
||||
from .nodes.identity_forge_scene_sheet import IdentityForgeSceneSheet
|
||||
from .nodes.identity_forge_vault_save import IdentityForgeVaultSave
|
||||
from .nodes.identity_forge_vault_load import IdentityForgeVaultLoad
|
||||
except ImportError: # pragma: no cover
|
||||
@@ -53,6 +62,9 @@ except ImportError: # pragma: no cover
|
||||
from nodes.identity_forge_modifier import IdentityForgeModifier
|
||||
from nodes.identity_forge_turnaround import IdentityForgeTurnaround
|
||||
from nodes.identity_forge_expression_sheet import IdentityForgeExpressionSheet
|
||||
from nodes.identity_forge_outfit_sheet import IdentityForgeOutfitSheet
|
||||
from nodes.identity_forge_age_progression import IdentityForgeAgeProgression
|
||||
from nodes.identity_forge_scene_sheet import IdentityForgeSceneSheet
|
||||
from nodes.identity_forge_vault_save import IdentityForgeVaultSave
|
||||
from nodes.identity_forge_vault_load import IdentityForgeVaultLoad
|
||||
|
||||
@@ -197,15 +209,73 @@ def _register_roll_route() -> None:
|
||||
if error is not None:
|
||||
return error
|
||||
widgets, seed = body.get("widgets"), body.get("seed")
|
||||
if (not isinstance(widgets, dict) or not isinstance(seed, int)
|
||||
or not all(isinstance(v, (str, int, float)) for v in widgets.values())):
|
||||
if not isinstance(widgets, dict) or not isinstance(seed, int) or isinstance(seed, bool):
|
||||
return web.json_response(
|
||||
{"error": "expected {'widgets': {name: value}, 'seed': int}"}, status=400)
|
||||
return web.json_response({"values": roll_field_values(widgets, seed)})
|
||||
|
||||
|
||||
def _register_gallery_routes() -> None:
|
||||
"""2.3.0: the roster picker's preview images, served from ComfyUI's own origin.
|
||||
|
||||
The server fetches the gh-pages gallery on the browser's behalf and caches it on
|
||||
disk (see ``nodes/gallery_cache.py``), so previews work under ``--offline``'s CSP
|
||||
and survive a later loss of network. Only the picker's opt-in preview toggle calls
|
||||
these. ``clear`` is a POST with a JSON body for the CSRF reason in
|
||||
``_register_vault_routes``.
|
||||
"""
|
||||
try:
|
||||
import asyncio
|
||||
|
||||
from aiohttp import web
|
||||
from server import PromptServer # type: ignore[import-not-found]
|
||||
|
||||
from .nodes import gallery_cache
|
||||
except Exception as exc: # noqa: BLE001 - never block node registration
|
||||
_LOG.warning("Gallery routes not registered: %s", exc)
|
||||
return
|
||||
|
||||
routes = PromptServer.instance.routes
|
||||
|
||||
async def _serve(fetch, *args): # type: ignore[no-untyped-def]
|
||||
try:
|
||||
# urllib blocks; keep it off the event loop.
|
||||
path = await asyncio.to_thread(fetch, *args, gallery_cache.default_root())
|
||||
except gallery_cache.GalleryError as exc:
|
||||
return web.Response(status=404, text=str(exc))
|
||||
return web.FileResponse(path)
|
||||
|
||||
@routes.get("/identity_forge/gallery/{kind}/manifest.json")
|
||||
async def _manifest(request): # type: ignore[no-untyped-def]
|
||||
response = await _serve(gallery_cache.manifest_path, request.match_info["kind"])
|
||||
# Freshness is the cache's job (revalidated every 10 minutes); the browser
|
||||
# must ask again rather than hold its own copy.
|
||||
response.headers["Cache-Control"] = "no-cache"
|
||||
return response
|
||||
|
||||
@routes.get("/identity_forge/gallery/{kind}/{relative:images/.+}")
|
||||
async def _image(request): # type: ignore[no-untyped-def]
|
||||
return await _serve(gallery_cache.image_path, request.match_info["kind"],
|
||||
request.match_info["relative"])
|
||||
|
||||
@routes.get("/identity_forge/gallery/cache")
|
||||
async def _size(_request): # type: ignore[no-untyped-def]
|
||||
root = gallery_cache.default_root()
|
||||
return web.json_response(
|
||||
{"bytes": await asyncio.to_thread(gallery_cache.cache_bytes, root)})
|
||||
|
||||
@routes.post("/identity_forge/gallery/cache/clear")
|
||||
async def _clear(request): # type: ignore[no-untyped-def]
|
||||
_body, error = await _json_body(request)
|
||||
if error is not None:
|
||||
return error
|
||||
await asyncio.to_thread(gallery_cache.clear, gallery_cache.default_root())
|
||||
return web.json_response({"bytes": 0})
|
||||
|
||||
|
||||
_register_vault_routes()
|
||||
_register_roll_route()
|
||||
_register_gallery_routes()
|
||||
|
||||
|
||||
class IdentityForgeExtension(ComfyExtension):
|
||||
@@ -214,7 +284,8 @@ class IdentityForgeExtension(ComfyExtension):
|
||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||
return [IdentityForge, IdentityForgeArchetype, IdentityForgeCosplayer,
|
||||
IdentityForgeCreature, IdentityForgeModifier, IdentityForgeTurnaround,
|
||||
IdentityForgeExpressionSheet,
|
||||
IdentityForgeExpressionSheet, IdentityForgeOutfitSheet,
|
||||
IdentityForgeAgeProgression, IdentityForgeSceneSheet,
|
||||
IdentityForgeVaultSave, IdentityForgeVaultLoad]
|
||||
|
||||
|
||||
|
||||
+44
-3
@@ -1165,6 +1165,18 @@ for _backdrop in _VOID_BACKDROPS:
|
||||
"reason": f"a {_backdrop} is a seamless sweep: no horizon, no sky, and no "
|
||||
f"lines in it to lead the eye"})
|
||||
|
||||
# 2.4.0: "small against open negative space" is the sweep look, so in a furnished interior
|
||||
# the model drops the room for a blank wall (a nightclub rendered as a white backdrop).
|
||||
# The photography studio keeps it: its backdrop is the point.
|
||||
for _loc in _INDOOR_LOCATIONS:
|
||||
if _loc != "photography studio with backdrop":
|
||||
CONSTRAINT_RULES.append({
|
||||
"type": "exclusion", "field": "location", "value": _loc,
|
||||
"excludes_field": "composition",
|
||||
"excludes_values": ["the subject small against open negative space"],
|
||||
"reason": f"'{_loc}' is a furnished interior: open negative space renders "
|
||||
f"as a blank backdrop"})
|
||||
|
||||
|
||||
# --- outfit_style answers to the place (1.5.0) ------------------------------------
|
||||
# Before 1.5.0 `outfit_style` was drawn with no reference to `location` at all:
|
||||
@@ -1232,7 +1244,14 @@ OUTFIT_STYLE_VENUES: dict[str, frozenset[str]] = {
|
||||
"local gym weight room", "yoga studio with wood floors",
|
||||
"climbing gym with colorful holds", "dance studio with mirrors",
|
||||
"martial arts dojo", "boxing gym with hanging heavy bags",
|
||||
"high school gymnasium", "trampoline park with foam pits"], _GYM),
|
||||
"high school gymnasium", "trampoline park with foam pits",
|
||||
"wrestling ring under arena lights"], _GYM),
|
||||
# 2.4.0 venues: players, crews and race-day spectators.
|
||||
"outdoor tennis court with a net": frozenset(["athletic", "casual", "preppy", "streetwear"]),
|
||||
"racetrack pit lane": _SHOP_FLOOR | {"athletic", "smart casual"},
|
||||
"racecourse paddock with a white rail": frozenset([
|
||||
"athletic", "casual", "smart casual", "preppy", "cocktail semi-formal",
|
||||
"vintage retro"]),
|
||||
"indoor swimming pool": frozenset(["athletic", "resort vacation", "casual"]),
|
||||
**dict.fromkeys([
|
||||
"factory floor", "warehouse interior", "auto repair shop service bay",
|
||||
@@ -1657,7 +1676,7 @@ _STUDIO_LIT_INTERIORS = frozenset([
|
||||
"photography studio with backdrop", "empty theater stage with the curtain up",
|
||||
"community theatre auditorium", "backstage dressing room", "art gallery opening night",
|
||||
"natural history museum hall", "luxury retail boutique", "newsroom with desks and monitors",
|
||||
"high school gymnasium",
|
||||
"high school gymnasium", "wrestling ring under arena lights",
|
||||
])
|
||||
_STUDIO_SHAPE_ONLY: list[str] = list(FIELD_FAMILIES["lighting"]["studio_shape"]["variants"])
|
||||
for _loc, _fam in _LOCATION_FAMILY.items():
|
||||
@@ -1683,7 +1702,7 @@ _FLOOR_FREE_PLACES = frozenset([
|
||||
"the parking lot of a retro drive-in diner with classic cars",
|
||||
"construction site with scaffolding", "working harbor dock", "Times Square",
|
||||
"Shibuya Crossing", "the Brooklyn Bridge pedestrian walkway", "Trafalgar Square",
|
||||
"rooftop cocktail bar",
|
||||
"rooftop cocktail bar", "racetrack pit lane", "outdoor tennis court with a net",
|
||||
])
|
||||
for _loc, _fam in _LOCATION_FAMILY.items():
|
||||
if _fam in _FLOOR_FREE_FAMILIES or _loc in _FLOOR_FREE_PLACES:
|
||||
@@ -1692,6 +1711,28 @@ for _loc, _fam in _LOCATION_FAMILY.items():
|
||||
"excludes_field": "pose", "excludes_values": list(_FLOOR_POSES),
|
||||
"reason": f"nobody kneels, crouches or sits on the floor at '{_loc}'"})
|
||||
|
||||
# --- 2.4.0: no wall to lean on, no seat to perch on, in an open landscape -----------
|
||||
# Whole `leaning` + `seated_perch` families, so no other seed moves. Places with rails,
|
||||
# rocks or benches (piers, canyons, parks, the lighthouse) are left out on purpose.
|
||||
_PROPLESS_POSES: list[str] = (list(FIELD_FAMILIES["pose"]["leaning"]["variants"])
|
||||
+ list(FIELD_FAMILIES["pose"]["seated_perch"]["variants"]))
|
||||
_OPEN_LANDSCAPES = frozenset([
|
||||
"wide sandy beach", "rolling desert dune", "open meadow", "misty moor",
|
||||
"flower field in bloom", "lavender field", "alpine meadow with wildflowers",
|
||||
"cracked salt flats", "golden savanna with acacia trees", "frozen lake surface",
|
||||
"rolling wheat field", "terraced rice paddies", "volcanic black sand beach",
|
||||
"tide pools at low tide", "high desert with joshua trees",
|
||||
"the red desert plain below Uluru", "a Yosemite valley meadow", "the Mount Fuji foothills",
|
||||
"the Table Mountain plateau", "mountain overlook", "alpine glacier lake",
|
||||
"geothermal geyser basin",
|
||||
])
|
||||
assert _OPEN_LANDSCAPES <= _LOCATION_FAMILY.keys(), _OPEN_LANDSCAPES - _LOCATION_FAMILY.keys()
|
||||
for _loc in sorted(_OPEN_LANDSCAPES):
|
||||
CONSTRAINT_RULES.append({
|
||||
"type": "exclusion", "field": "location", "value": _loc,
|
||||
"excludes_field": "pose", "excludes_values": _PROPLESS_POSES,
|
||||
"reason": f"nothing to lean on or perch on at '{_loc}'"})
|
||||
|
||||
# --- grey hair comes with age -------------------------------------------------------
|
||||
# The DRAW is age-aware (nodes.identity_forge._GREY_BY_AGE), so a random character never
|
||||
# needs a re-pick. This rule is the other direction, for a LOCKED age-grey: it moves a
|
||||
|
||||
+608
-84
@@ -323,6 +323,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"costume": "a brown Survey Corps jacket with the Wings of Freedom emblem, an "
|
||||
"omni-directional maneuver gear harness, white pants, brown mid-calf "
|
||||
"boots, and a red scarf",
|
||||
"costume_back": "a brown Survey Corps jacket with the large Wings of Freedom emblem across the back, an omni-directional maneuver gear harness, white pants, brown mid-calf boots, and a red scarf",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "chin length bob",
|
||||
"hair_style": "worn down", "eye_color": "dark gray"},
|
||||
"physique": {"body_type": "athletic", "height": "average height", "skin_tone": "light medium"},
|
||||
@@ -985,6 +986,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
|
||||
# --- Star Wars --------------------------------------------------------
|
||||
"Ahsoka Tano": {
|
||||
"bald": True, # 2.4.0: montrals, no hair (random hair drew over them)
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Female",
|
||||
"costume": "a practical grey-and-blue tunic with leggings and armored pieces, a "
|
||||
@@ -1865,6 +1867,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Female",
|
||||
"costume": "a red, blue, and gold Kree flight suit with a gold eight-pointed "
|
||||
"starburst chest emblem, red gloves, and red boots",
|
||||
"costume_back": "a red, blue, and gold Kree flight suit, red gloves, and red boots",
|
||||
"costumes": [
|
||||
# Classic Ms. Marvel identity (black lightning-bolt leotard, red sash, domino mask).
|
||||
{
|
||||
@@ -2012,6 +2015,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Female",
|
||||
"costume": "a blue crop top with the Superman S-shield, a red miniskirt, a red "
|
||||
"cape, and red mid-thigh boots",
|
||||
"costume_back": "a blue crop top, a red cape falling down the back over a red miniskirt, and red mid-thigh boots",
|
||||
"costumes": [
|
||||
# Animated-series look (white crop top, sleek straight hair).
|
||||
{
|
||||
@@ -2236,12 +2240,21 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Bayonetta": {
|
||||
"franchise": "Bayonetta",
|
||||
"gender": "Female",
|
||||
"costume": "a skin-tight black bodysuit embroidered with arcane sigils, chic "
|
||||
"angular glasses, gunmetal gloves, and black heeled boots",
|
||||
# 2.4.0: rendered as a curly bob in a sleeveless leotard; rebuilt from the
|
||||
# Bayonetta 1 look.
|
||||
"costume": "dark glasses with butterfly-wing frames, a skin-tight glossy black "
|
||||
"full-length catsuit woven from living hair covering the arms and "
|
||||
"legs, with rose and thorn motifs, long white gloves, a gold Umbra "
|
||||
"Watch with a red jewel on the chest, golden cat-shaped earrings, a "
|
||||
"small mole below the left corner of the lips, black stiletto heels "
|
||||
"with pistols mounted on the heels, and a towering glossy jet-black "
|
||||
"beehive of hair",
|
||||
"signature": {"hair_color": "raven black", "hair_length": "hip length",
|
||||
"hair_style": "updo", "eye_color": "blue-gray"},
|
||||
"hair_texture": "sleek straight", "hair_style": "updo",
|
||||
"eye_color": "gray"},
|
||||
"physique": {"body_type": "slender", "height": "very tall", "skin_tone": "fair"},
|
||||
"prop": "four ornate long-barreled handguns, one in each hand",
|
||||
# 2.4.0: "four ... one in each hand" drew a fan of guns and extra half-arms.
|
||||
"prop": "a pair of ornate long-barreled pistols, one in each hand",
|
||||
},
|
||||
"Morrigan Aensland": {
|
||||
"franchise": "Darkstalkers",
|
||||
@@ -2278,11 +2291,17 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"X-23": {
|
||||
"franchise": "Marvel",
|
||||
"gender": "Female",
|
||||
"costume": "tight black and gray combat gear, fingerless gloves, reinforced "
|
||||
"boots, and metal claws extending from the knuckles of each hand",
|
||||
"signature": {"hair_color": "dark brown", "hair_length": "long",
|
||||
"hair_texture": "sleek straight", "eye_color": "green"},
|
||||
"physique": {"body_type": "athletic", "height": "very petite", "skin_tone": "tan"},
|
||||
# 2.4.0: canon is jet black hair and alabaster skin, and the claws went unrendered
|
||||
# as a trailing clause; they lead now, two per fist.
|
||||
"costume": "a sleeveless black crop top, dark fitted combat pants, thick black "
|
||||
"combat boots, a studded leather choker, and two long silver "
|
||||
"Wolverine-style metal claw blades popping out from between the "
|
||||
"knuckles of each clenched fist",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "long",
|
||||
"hair_texture": "sleek straight", "hair_style": "worn down",
|
||||
"eye_color": "green", "makeup_style": "gothic dark makeup"},
|
||||
"physique": {"body_type": "lean", "height": "average height",
|
||||
"skin_tone": "porcelain", "age": "20"},
|
||||
},
|
||||
"Emma Frost": {
|
||||
"franchise": "Marvel",
|
||||
@@ -2479,6 +2498,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "sleeveless silver and black armor with rows of circular silver chest "
|
||||
"discs, a flowing red cape, and engraved bracers",
|
||||
"costume_back": "a flowing red cape falling down the back over sleeveless silver and black armor, and engraved bracers",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "long",
|
||||
"facial_hair": "short beard", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair"},
|
||||
@@ -2520,9 +2540,13 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "Marvel",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
# 2.4.0: "a panther mask" rendered as a bare face; the helmet covers the head.
|
||||
"covers_body": True,
|
||||
"costume": "a sleek matte-black vibranium catsuit with a faint raised silver "
|
||||
"triangular weave and a silver vibranium necklace",
|
||||
"mask": "a panther mask with small rounded ears",
|
||||
"triangular weave, black gloves, and a silver vibranium necklace",
|
||||
"mask": "a fully enclosed matte-black panther helmet covering the whole head and "
|
||||
"face, with small pointed cat ears and angular silver-rimmed white eye "
|
||||
"lenses",
|
||||
"physique": {"body_type": "athletic", "height": "tall"},
|
||||
},
|
||||
"Doctor Strange": {
|
||||
@@ -2531,6 +2555,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"costume": "a dark blue tunic with a wide sash and high collar, a flowing red "
|
||||
"Cloak of Levitation with a tall collar, and a golden Eye of Agamotto "
|
||||
"amulet at the throat",
|
||||
"costume_back": "a flowing red Cloak of Levitation with a tall collar falling down the back over a dark blue tunic and wide sash",
|
||||
"signature": {"hair_color": "gray-streaked dark hair", "hair_length": "very short",
|
||||
"facial_hair": "goatee", "eye_color": "gray"},
|
||||
"physique": {"body_type": "lean", "height": "tall", "skin_tone": "fair"},
|
||||
@@ -2723,6 +2748,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"costume": "a black bodysuit with a bright green torso and shoulders, a green "
|
||||
"circular lantern emblem on the chest, a green domino mask, green "
|
||||
"gloves and boots, and a glowing green power ring worn on the finger",
|
||||
"costume_back": "a black bodysuit with a bright green torso and shoulders, and green gloves and boots",
|
||||
"signature": {"hair_color": "dark brown", "hair_length": "very short",
|
||||
"eye_color": "green"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair"},
|
||||
@@ -2820,6 +2846,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a red bodysuit with a golden lightning-bolt emblem on the chest, a "
|
||||
"short white half-cape with gold trim, a golden sash, and golden boots",
|
||||
"costume_back": "a red bodysuit under a short white half-cape with gold trim, a golden sash, and golden boots",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "very short",
|
||||
"eye_color": "bright blue"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair"},
|
||||
@@ -2925,10 +2952,17 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "DC",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
"costume": "a tactical vest, broad bare muscular arms, and a thick green venom "
|
||||
"tube feeding into the back of the skull",
|
||||
"mask": "a black luchador mask covering the whole head",
|
||||
"physique": {"body_type": "athletic", "height": "very tall"},
|
||||
# 2.4.0: "a tactical vest" drew a modern plate carrier on an average man, and
|
||||
# the bare mask a plain hood. Knightfall look: hulking, wrist pump, Venom tubes.
|
||||
# Tubes routed down the front: "into the back of the head" never rendered.
|
||||
"costume": "a black sleeveless bodysuit and black combat trousers on a hulking, "
|
||||
"massively muscular frame, with a chunky metal Venom pump gauntlet on "
|
||||
"one wrist and thick translucent glowing green tubes running from it "
|
||||
"along the bare forearm, over the shoulder and into the side of the "
|
||||
"mask",
|
||||
"mask": "a black luchador wrestling mask covering the whole head, with white "
|
||||
"trim outlining the eye openings and the mouth opening",
|
||||
"physique": {"body_type": "athletic", "height": "very tall", "skin_tone": "warm tan"},
|
||||
},
|
||||
"Deathstroke": {
|
||||
"franchise": "DC",
|
||||
@@ -3007,8 +3041,17 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Yoda": {
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Male",
|
||||
"costume": "a simple brown Jedi robe, with green wrinkled skin, very large pointed "
|
||||
"ears, and sparse white hair, on a diminutive figure barely two feet tall",
|
||||
# 2.4.0: Grogu's treatment. Unmasked, the node drew a random man under the
|
||||
# costume text (curly blond hair, a goatee, human hands).
|
||||
"covers_face": True,
|
||||
"covers_body": True,
|
||||
"subject": "wizened green alien Jedi Master", # else the lead reads "a man"
|
||||
"costume": "a simple brown Jedi robe over a rough cream tunic, on a diminutive "
|
||||
"hunched figure barely two feet tall, over uniform, all-over green "
|
||||
"wrinkled skin",
|
||||
"mask": "a wizened green alien head with deep forehead wrinkles, heavy-lidded "
|
||||
"green eyes, very large pointed ears angled out to the sides, a smooth "
|
||||
"wrinkled chin, and a few sparse wisps of white hair",
|
||||
"signature": {"eye_color": "green"},
|
||||
"size_scale": "tiny",
|
||||
"scale_prose": "diminutive and barely two feet tall",
|
||||
@@ -3391,10 +3434,22 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Baraka": {
|
||||
"franchise": "Mortal Kombat",
|
||||
"gender": "Male",
|
||||
"costume": "leather warrior garb, a bald head, a wide mouth of jagged sharp teeth, "
|
||||
"and long retractable blades extending from both forearms",
|
||||
"signature": {"eye_color": "nearly black"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair"},
|
||||
# 2.4.0: drew a human face and hand-held swords; the blades grow from his arms.
|
||||
"covers_face": True,
|
||||
"subject": "Tarkatan warrior",
|
||||
# 2.4.0 (round 2): blades named at the end drew short knives behind the arms;
|
||||
# they lead now, pointing forward past the fists.
|
||||
"costume": "a long curved steel blade jutting out of each forearm and extending "
|
||||
"forward past the fist like a sword, a shirtless, hyper-muscular "
|
||||
"torso of pale sickly grey skin with bone spikes jutting from the "
|
||||
"shoulders and tribal scars across the chest, studded leather bracers, "
|
||||
"red and black Outworld combat trousers, and a wide leather belt",
|
||||
"mask": "a bald pale grey Tarkatan head with a huge lipless grin of bared serrated "
|
||||
"fangs stretching from ear to ear, pointed animal ears, glowing yellow "
|
||||
"slit-pupil eyes, and a furrowed ridged brow",
|
||||
"body_paint": True,
|
||||
"skin": "pale sickly grey",
|
||||
"physique": {"body_type": "athletic", "height": "very tall"},
|
||||
},
|
||||
|
||||
# --- Anime (male) -----------------------------------------------------
|
||||
@@ -3417,6 +3472,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"physique": {"body_type": "athletic", "height": "short", "skin_tone": "fair"},
|
||||
},
|
||||
"Piccolo": {
|
||||
"bald": True, # 2.4.0: a Namekian is hairless (random hair and stubble drew)
|
||||
"franchise": "Dragon Ball",
|
||||
"gender": "Male",
|
||||
"costume": "a white turban and a white cape over shoulder pads, a purple gi with a "
|
||||
@@ -3465,13 +3521,17 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Roronoa Zoro": {
|
||||
"franchise": "One Piece",
|
||||
"gender": "Male",
|
||||
"costume": "a green haramaki sash holding three sheathed swords at the hip, a "
|
||||
"black bandana, gold earrings, and a long vertical scar over the left eye",
|
||||
# Santoryu: the prop draws one of the three, so the sash keeps the other two
|
||||
# rather than the count reading as six.
|
||||
"prop_costume": "a green haramaki sash holding two sheathed swords at the hip, a "
|
||||
"black bandana, gold earrings, and a long vertical scar over the left eye",
|
||||
"prop": "a drawn katana held ready",
|
||||
"costume": "a plain white short-sleeved T-shirt, a green haramaki sash holding three "
|
||||
"sheathed swords at the hip, black trousers tucked into black boots, a "
|
||||
"black bandana tied around the left upper arm, three gold drop earrings "
|
||||
"on the left ear, and a long vertical scar over the left eye",
|
||||
# 2.4.0: with two sheathed swords beside the drawn one, every render read as a
|
||||
# cluster of three; holding one, the sash is plain.
|
||||
"prop_costume": "a plain white short-sleeved T-shirt, a green haramaki sash at the "
|
||||
"waist, black trousers tucked into black boots, a "
|
||||
"black bandana tied around the left upper arm, three gold drop "
|
||||
"earrings on the left ear, and a long vertical scar over the left eye",
|
||||
"prop": "a drawn katana held ready in one hand",
|
||||
"signature": {"hair_color": "emerald green", "hair_length": "very short",
|
||||
"eye_color": "dark brown"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "tan"},
|
||||
@@ -3517,6 +3577,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a brown Survey Corps jacket with the wings-of-freedom crest, a green "
|
||||
"hooded cloak, and a body harness with handheld blades on ODM gear",
|
||||
"costume_back": "a green hooded cloak with the large Wings of Freedom emblem across the back, over a brown Survey Corps jacket and a body harness with handheld blades on ODM gear",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "very short",
|
||||
"hair_style": "blunt bangs", "eye_color": "dark gray"},
|
||||
"physique": {"body_type": "lean", "height": "short", "skin_tone": "fair"},
|
||||
@@ -3526,6 +3587,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a brown Survey Corps jacket and straps over a white shirt, a green "
|
||||
"hooded cloak, and an ODM-gear harness",
|
||||
"costume_back": "a green hooded cloak with the large Wings of Freedom emblem across the back, over a brown Survey Corps jacket, straps, and an ODM-gear harness",
|
||||
"signature": {"hair_color": "dark brown", "hair_length": "jaw length",
|
||||
"eye_color": "green"},
|
||||
"physique": {"body_type": "athletic", "height": "average height", "skin_tone": "fair"},
|
||||
@@ -3535,6 +3597,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a yellow jumpsuit with a zip collar, a white cape, red gloves, red "
|
||||
"boots, a black belt, and a completely bald shiny head",
|
||||
"costume_back": "a white cape falling down the back over a yellow jumpsuit, red gloves, red boots, a black belt, and a completely bald shiny head",
|
||||
"physique": {"body_type": "lean", "height": "average height", "skin_tone": "fair"},
|
||||
},
|
||||
"Tatsumaki": {
|
||||
@@ -3939,6 +4002,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a black Soul Reaper robe under a white captain's haori, white "
|
||||
"kenseikan hair ornaments, and a white scarf",
|
||||
"costume_back": "a white captain's haori over a black Soul Reaper robe, the black kanji for six inside a diamond on the back of the haori, white kenseikan hair ornaments, and a white scarf",
|
||||
"signature": {"hair_color": "near black", "hair_length": "shoulder length",
|
||||
"hair_texture": "sleek straight", "eye_color": "dark gray"},
|
||||
"physique": {"body_type": "lean", "height": "tall", "skin_tone": "fair"},
|
||||
@@ -6329,6 +6393,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a yellow cape and green-and-gold accents over smooth, flawless deep red "
|
||||
"android skin, with a glowing yellow gem set in the forehead",
|
||||
"costume_back": "a yellow cape falling down the back over smooth deep red android skin with green-and-gold accents",
|
||||
"eyes": "glowing white",
|
||||
"signature": {},
|
||||
"physique": {"body_type": "athletic", "height": "tall"},
|
||||
@@ -6480,9 +6545,15 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "DC",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
"costume": "blue chitinous scarab armor with black accents and a clawed gauntlet",
|
||||
"mask": "a smooth blue beetle-carapace helmet with large round yellow eye-lenses",
|
||||
"physique": {"body_type": "athletic", "height": "average height"},
|
||||
# 2.4.0: was drawing a random muscular man's bare arms and mouth under foam armor.
|
||||
"covers_body": True,
|
||||
"costume": "a sleek full-body insectoid alien armor suit in dark and light blue with "
|
||||
"black segmented plating, covering the arms, hands, legs and neck, a "
|
||||
"beetle-shaped scarab pack on the back with mechanical legs wrapping over "
|
||||
"the shoulders, and two horn-like spines rising behind the shoulders",
|
||||
"mask": "a fully enclosed blue-and-black beetle helmet covering the whole head and "
|
||||
"face, with large glowing yellow eye-lenses and a smooth blue faceplate",
|
||||
"physique": {"body_type": "lean", "height": "average height"},
|
||||
},
|
||||
"Blue Beetle (Ted Kord)": {
|
||||
"franchise": "DC",
|
||||
@@ -8743,8 +8814,15 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
"costume": "flowing deep crimson robes and a hooded cloak over crimson armor",
|
||||
"mask": "a smooth crimson helmet with a narrow vertical visor slit",
|
||||
"covers_body": True, # 2.4.0: fully suited; was drawing a random man's skin and hands
|
||||
# 2.4.0: helmet text alone still showed a man's face under the visor.
|
||||
"subject": "faceless crimson-helmeted guard",
|
||||
"costume": "flowing deep crimson robes and a hooded cloak over crimson armor, "
|
||||
"with crimson gloves covering both hands",
|
||||
# 2.4.0: "a smooth crimson helmet" rendered as an open hood over a man's face.
|
||||
"mask": "a smooth rounded crimson helmet enclosing the whole head down to the neck, "
|
||||
"its front a solid crimson faceplate covering the mouth and chin, with only "
|
||||
"a thin black visor strip across the eyes",
|
||||
"physique": {"body_type": "athletic", "height": "average height"},
|
||||
"prop": "a tall force pike with a slender black shaft and a gleaming metal "
|
||||
"blade tip",
|
||||
@@ -8753,8 +8831,14 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
"costume": "articulated crimson plate armor with a layered crimson fabric skirt",
|
||||
"mask": "a crimson helmet with a fin-like crest and a dark narrow visor",
|
||||
"covers_body": True, # 2.4.0: drew bare human hands under the gauntlets
|
||||
"costume": "articulated crimson plate armor over a full-length padded crimson "
|
||||
"undersuit that covers the arms, torso and legs, with a layered crimson "
|
||||
"fabric skirt, and crimson gloves under crimson armored gauntlets "
|
||||
"covering both hands and fingers, no bare skin",
|
||||
# 2.4.0: still drew an open Roman-style helmet; the faceplate is named outright.
|
||||
"mask": "a fully enclosed, featureless crimson helmet with a solid faceplate hiding "
|
||||
"the whole face, a fin-like crest, and only a dark narrow visor slit",
|
||||
"physique": {"body_type": "athletic", "height": "tall"},
|
||||
"prop": "a vibro-voulge, a long black polearm with a glinting bladed head",
|
||||
},
|
||||
@@ -8762,9 +8846,16 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Male",
|
||||
"covers_face": True,
|
||||
"costume": "a black Imperial flight suit with a ribbed chest control box and a "
|
||||
"costume": "a black Imperial flight suit with black gloves, a ribbed chest control box and a "
|
||||
"harness of cables",
|
||||
"mask": "a black flight helmet with a slotted face mask and ribbed breathing hoses",
|
||||
# 2.4.0: an open helmet showed a random man's face; the canon helmet hides it entirely.
|
||||
"covers_body": True,
|
||||
# 2.4.0 (round 2): the face still showed between lenses and mask, as the Royal
|
||||
# Guard's did until it got a lead noun.
|
||||
"subject": "faceless black-helmeted pilot",
|
||||
"mask": "a fully enclosed glossy black TIE pilot helmet covering the whole face, with "
|
||||
"two large dark round eye lenses, a slotted breathing mask, and ribbed "
|
||||
"breathing hoses running down to the chest box",
|
||||
"physique": {"body_type": "athletic", "height": "average height"},
|
||||
},
|
||||
"Death Trooper": {
|
||||
@@ -8872,14 +8963,19 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"costume": "layered dark robes - a floor-length deep blue inner robe with matching "
|
||||
"deep blue fingerless gloves beneath a tiered, floor-length dark brown "
|
||||
"outer robe - with a weathered grey chest plate and matching grey wrist "
|
||||
"bracer, pale waxy mottled skin, pointed ears, sharp snaggly teeth, long "
|
||||
"pale pointed claws, and two long tapering head-tails coiling over the "
|
||||
"shoulders",
|
||||
"eyes": "sunken and glowing reddish pink",
|
||||
"bracer, chalk-white skin, and long pale fingers tipped with sharp claw-like "
|
||||
"nails",
|
||||
# 2.4.0: with the face visible, a random middle-aged man drew under the robes.
|
||||
"covers_face": True,
|
||||
"subject": "gaunt pale Twi'lek alien",
|
||||
"mask": "a gaunt, angular Twi'lek alien head with deathly chalk-white skin, faint lavender "
|
||||
"undertones, bald and browless, deep-set pinkish-red eyes rimmed with dark "
|
||||
"heavy bags, high cheekbones, a narrow chin, jagged pointed yellow teeth, and "
|
||||
"two thick fleshy head-tails growing from the back of the skull, one draped "
|
||||
"forward and wrapped around the neck like a collar",
|
||||
"signature": {"posture": "slouched"},
|
||||
"covers_hair": True,
|
||||
"body_paint": True,
|
||||
"skin": "pale waxy", # no "coat of" clause for the anchor regex to read
|
||||
"skin": "chalk-white waxy", # no "coat of" clause for the anchor regex to read
|
||||
"physique": {"body_type": "slim", "height": "average height"},
|
||||
},
|
||||
"Greedo": {
|
||||
@@ -9274,9 +9370,20 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Maz Kanata": {
|
||||
"franchise": "Star Wars",
|
||||
"gender": "Female",
|
||||
"costume": "layered earth-toned robes over a tiny deeply wrinkled orange-skinned "
|
||||
"body, with oversized round vision goggles pushed up on the brow",
|
||||
"eyes": "large warm brown behind thick round goggle lenses",
|
||||
# 2.4.0: unmasked, she drew a random human woman; the alien head is a mask now.
|
||||
"covers_face": True,
|
||||
"subject": "tiny ancient orange-skinned alien",
|
||||
"costume": "a dusty teal-blue knit sweater with a wide rolled collar under a padded "
|
||||
"grey quilted vest, high-waisted baggy maroon suede pants tucked into "
|
||||
"dark brown boots, striped multicoloured knit knee socks, a light brown "
|
||||
"leather belt with pouches, a wooden bead necklace, many stacked "
|
||||
"bracelets and rings, and deeply wrinkled orange skin on the hands",
|
||||
"mask": "a wide, rounded, deeply wrinkled orange alien face with age spots, high "
|
||||
"cheekbones, a small pointed chin, two slit nostrils, a thin lipless "
|
||||
"mouth, and small brown eyes hugely magnified behind massive worn silver "
|
||||
"goggles, under a dark charcoal quilted domed cap on a dark blue band",
|
||||
"body_paint": True,
|
||||
"skin": "wrinkled orange",
|
||||
"signature": {},
|
||||
"size_scale": "tiny",
|
||||
"scale_prose": "diminutive and barely three feet tall",
|
||||
@@ -9770,7 +9877,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"a red-and-yellow zigzag belt, and yellow mittens",
|
||||
"mask": "a round blue penguin face with a wide yellow beak and a smug grin, "
|
||||
"under a red tuque with a white pom-pom and a gold crown-like brim",
|
||||
"prop": "a giant wooden mallet",
|
||||
"prop": "a giant wooden mallet held in both hands", # 2.4.0: one hand drew a third
|
||||
"physique": {"body_type": "plus size", "height": "tall"},
|
||||
},
|
||||
"Fox McCloud": {
|
||||
@@ -10673,6 +10780,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"gender": "Male",
|
||||
"costume": "a red tunic with a yellow R chest emblem, green shorts, gloves and "
|
||||
"boots, and a yellow-lined black cape",
|
||||
"costume_back": "a yellow-lined black cape falling down the back over a red tunic, green shorts, gloves and boots",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "very short", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "lean", "height": "average height", "skin_tone": "fair"},
|
||||
},
|
||||
@@ -10866,9 +10974,14 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"The Spectre": {
|
||||
"franchise": "DC",
|
||||
"gender": "Male",
|
||||
"costume": "a deep green hooded cloak clasped at the shoulders, green trunks, green "
|
||||
"gloves, and green boots, over smooth, flawless chalk white skin",
|
||||
"eyes": "solid glowing white pupil-less",
|
||||
# 2.4.0: drew a random grey-bearded man bare-chested in trunks; the white is a bodysuit.
|
||||
"covers_face": True,
|
||||
"covers_body": True,
|
||||
"costume": "a stark white form-fitting bodysuit covering the neck, arms, chest and legs, "
|
||||
"green trunks over it, green gloves, flared green boots, and a flowing "
|
||||
"deep green cloak with a deep hood, wrapped in a faint ghostly green mist",
|
||||
"mask": "a stern, statuesque chalk-white bald face and neck with glowing white "
|
||||
"pupil-less eyes, half in shadow under the deep green hood",
|
||||
"physique": {"body_type": "athletic", "height": "very tall"},
|
||||
},
|
||||
"Sandman (Wesley Dodds)": {
|
||||
@@ -11231,7 +11344,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"signature": {"hair_color": "dirty blonde", "hair_length": "very short",
|
||||
"facial_hair": "stubble", "eye_color": "blue-gray"},
|
||||
"physique": {"body_type": "stocky", "height": "short", "skin_tone": "tan"},
|
||||
"prop": "a corncob pipe",
|
||||
"prop": "an open can of spinach",
|
||||
},
|
||||
"Olive Oyl": {
|
||||
"franchise": "Popeye",
|
||||
@@ -16058,9 +16171,8 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"prop_costume": "the white Yamada Asaemon executioner's uniform -- a white hakama "
|
||||
"and wide-sleeved white top with deep red lining running from the "
|
||||
"collar down the chest, a red corset-like haramaki bound with four "
|
||||
"red ribbon straps, white tabi and straw sandals, an empty black "
|
||||
"lacquered scabbard thrust through the sash at the hip, and a very "
|
||||
"long red ribbon tying back the hair",
|
||||
"red ribbon straps, white tabi and straw sandals, and a very long red "
|
||||
"ribbon tying back the hair",
|
||||
"prop": "a drawn executioner's katana, a slender curved blade held level in both hands",
|
||||
"signature": {"hair_color": "medium brown", "hair_length": "long",
|
||||
"hair_texture": "sleek straight", "hair_style": "low ponytail",
|
||||
@@ -18712,13 +18824,15 @@ COSPLAYERS: dict[str, dict] = {
|
||||
# with covers_face and the leftover skin_tone/ethnicity go with the shell.
|
||||
"covers_face": True,
|
||||
"covers_body": True,
|
||||
"mask": "a rounded brushed-steel robot head with wide painted eyes, a "
|
||||
"hinged mouth grille, and a frilled white lace maid's cap pinned "
|
||||
"on top",
|
||||
"costume": "a rounded brushed-steel robot shell with a segmented barrel "
|
||||
"torso and jointed metal arms, a frilled white maid's apron "
|
||||
"tied at the waist, and a single rolling caster in place of "
|
||||
"legs",
|
||||
# 2.4.0: "in place of legs" drew legs; the base is named as what it is.
|
||||
"mask": "a large metallic blue horizontal cylinder head like a tin drum, with two "
|
||||
"round red light eyes, a small grey rectangular mouth grille, and two red "
|
||||
"pole antennae tipped with small balls on either side",
|
||||
"costume": "a retro-futuristic robot body: a wide light-blue domed upper torso with "
|
||||
"a rigid white frilly maid's collar, ribbed light-grey hose arms ending "
|
||||
"in three-fingered white pincers, a white frilly apron trim at the waist, "
|
||||
"and a heavy black flared cone-shaped skirt base tapering to a single "
|
||||
"black pillar on small blue caster wheels",
|
||||
"physique": {"height": "average height"},
|
||||
},
|
||||
"Mr. Spacely": {
|
||||
@@ -18744,11 +18858,11 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"franchise": "The Simpsons",
|
||||
"gender": "Male",
|
||||
"costume": "a baggy sky blue clown suit with an oversized red bow tie and "
|
||||
"a ruffled white collar, enormous red clown shoes, a bald crown "
|
||||
"flanked by two large flared tufts of mint green hair, white "
|
||||
"greasepaint over the face with a bulbous red nose and a wide "
|
||||
"red painted grin, and bright yellow skin on the neck, body and "
|
||||
"hands",
|
||||
"a ruffled white collar, enormous red clown shoes, a big round "
|
||||
"shiny red clown nose, a bald crown flanked by two large flared "
|
||||
"tufts of mint green hair, white greasepaint over the face with a "
|
||||
"wide red painted grin, and bright yellow skin on the neck, body "
|
||||
"and hands", # 2.4.0: the nose went unrendered as a trailing clause
|
||||
"body_paint": True,
|
||||
"skin": "chalk-white greasepainted",
|
||||
"signature": {"facial_hair": "clean shaven"},
|
||||
@@ -18815,11 +18929,10 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"black shirt and black trousers, black fingerless gloves, "
|
||||
"black boots, and two sword scabbards crossed at the back",
|
||||
"prop": "a pair of drawn one-handed straight swords, one black and one "
|
||||
"blue-white",
|
||||
"blue-white, one in each hand", # 2.4.0: both drew in one hand
|
||||
"prop_costume": "a long black high-collared coat with silver buckles over "
|
||||
"a black shirt and black trousers, black fingerless "
|
||||
"gloves, black boots, and two empty sword scabbards "
|
||||
"crossed at the back",
|
||||
"gloves, and black boots", # 2.4.0: "empty scabbards" drew sheathed swords
|
||||
"signature": {"hair_color": "jet black", "hair_length": "ear length",
|
||||
"eye_color": "nearly black"},
|
||||
"physique": {"body_type": "lean", "height": "average height",
|
||||
@@ -19017,6 +19130,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"sleeveless captain's haori over it, straw sandals, a black "
|
||||
"eyepatch over the right eye, and hair spiked into stiff points "
|
||||
"tipped with small bells",
|
||||
"costume_back": "a white sleeveless captain's haori over a black Shinigami kimono, the black kanji for eleven inside a diamond on the back of the haori, straw sandals, and hair spiked into stiff points tipped with small bells",
|
||||
"prop": "a battered chipped-edged katana",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "shoulder length"},
|
||||
"physique": {"body_type": "athletic", "height": "very tall",
|
||||
@@ -23606,7 +23720,7 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Inverness cape worn over a tweed three-piece suit with a "
|
||||
"waistcoat and watch chain, a high starched collar, and polished "
|
||||
"leather ankle boots",
|
||||
"prop": "a curved calabash pipe held in one hand",
|
||||
"prop": "a brass magnifying glass held in one hand",
|
||||
"signature": {
|
||||
"hair_color": "dark brown",
|
||||
"hair_length": "very short",
|
||||
@@ -23975,23 +24089,30 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Pyra": {
|
||||
"franchise": "Xenoblade Chronicles",
|
||||
"gender": "Female",
|
||||
"costume": "a crimson armored bodysuit with gold filigree across the chest "
|
||||
"and a glowing green crystal set into the sternum, segmented "
|
||||
"red-and-gold pauldrons, a pleated dark skirt over armored hip "
|
||||
"plates, and thigh-high red boots",
|
||||
"signature": {"hair_color": "deep red", "hair_length": "shoulder length",
|
||||
"hair_style": "side ponytail", "eye_color": "amber"},
|
||||
# Re-sourced at 2.7.0 (Danbooru tag co-occurrence): both looks had the wrong hair
|
||||
# (side ponytail / braided ponytail), Pyra a skirt for her red shorts and Mythra a
|
||||
# yellow crystal. Canon: a short bob (Pyra) or very long loose hair (Mythra) with
|
||||
# swept bangs, a slim tiara, gem earrings and the green cross-shaped Core Crystal.
|
||||
"costume": "a glowing green cross-shaped crystal set into the sternum, a fitted "
|
||||
"black-and-red bodysuit top with gold trim, short red shorts, red "
|
||||
"thigh-high stockings, black fingerless gloves, a slim gold tiara and "
|
||||
"gem drop earrings",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "bright red", "hair_length": "chin length bob",
|
||||
"hair_style": "side-swept bangs"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair"},
|
||||
"costumes": [
|
||||
{ # Mythra -- alternate Aegis form
|
||||
"costume": "a white-and-gold armored bodysuit with a glowing yellow crystal "
|
||||
"set into the sternum, blue-and-silver accents along the limbs, "
|
||||
"a short pleated skirt over gilded hip plates, and thigh-high "
|
||||
"white boots",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "long",
|
||||
"hair_style": "braided ponytail", "eye_color": "golden brown"},
|
||||
"costume": "a glowing green cross-shaped crystal set into the chest through "
|
||||
"a diamond-shaped cutout, a short white sleeveless dress with gold "
|
||||
"trim, white elbow-length gloves, a strap around one thigh, white "
|
||||
"thigh-high boots, a slim gold tiara and gem drop earrings",
|
||||
"eyes": "golden",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "hip length",
|
||||
"hair_style": "side-swept bangs"},
|
||||
},
|
||||
],
|
||||
"aliases": ["Mythra"],
|
||||
},
|
||||
"Adam Smasher": {
|
||||
"franchise": "Cyberpunk 2077",
|
||||
@@ -24782,8 +24903,10 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"Sabrina Spellman": {
|
||||
"franchise": "Archie",
|
||||
"gender": "Female",
|
||||
"costume": "a bright headband holding back a chin-length bob, a fitted "
|
||||
"sweater over a pleated skirt, opaque tights, and loafers",
|
||||
# 2.4.0: named colours; with none, a midday render came back black and white.
|
||||
"costume": "a black headband holding back a chin-length bob, a fitted red "
|
||||
"sweater with a white collar over a pleated red plaid skirt, black "
|
||||
"opaque tights, and black loafers",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "chin length bob",
|
||||
"hair_style": "worn down", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slender", "height": "average height", "skin_tone": "fair"},
|
||||
@@ -27408,6 +27531,405 @@ COSPLAYERS: dict[str, dict] = {
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "18"},
|
||||
},
|
||||
# --- 2.7.0: roster batch (iconic, adult, distinct-silhouette names; canon checked
|
||||
# against Danbooru tag co-occurrence and the series wikis). --------------------
|
||||
"Sheena Fujibayashi": {
|
||||
# Her three looks (Default, "Queen of the Beach", "You Look Great"). Danbooru has
|
||||
# 21 purple_kimono posts to 0 blue, so the kimono is purple.
|
||||
"franchise": "Tales series",
|
||||
"gender": "Female",
|
||||
"costume": "a short purple kimono-style ninja top over a white bustier and a black "
|
||||
"undershirt, detached purple sleeves, a wide pink obi sash tied in a "
|
||||
"large bow at the back, black fingerless gloves, close-fitting black "
|
||||
"pants and dark boots, with a pink ribbon tying the ponytail",
|
||||
"costumes": [
|
||||
# "Queen of the Beach" title costume.
|
||||
"a red one-piece swimsuit with criss-cross lacing down the front, a black "
|
||||
"choker, silver crescent-moon earrings, a single silver bracelet, an anklet "
|
||||
"and red sandals, with sunglasses pushed up on the head",
|
||||
{ # "You Look Great" title costume (hair up in a bun).
|
||||
"costume": "a purple harem-dancer outfit with a jewelled cropped top and a "
|
||||
"short skirt trailing long coattails, a gold neck ring, a single "
|
||||
"gold armlet, gold bangles and gold earrings, black thigh-high "
|
||||
"stockings and purple slippers, with a gold clip in the hair",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "shoulder length",
|
||||
"hair_style": "braided bun", "eye_color": "medium brown"},
|
||||
},
|
||||
],
|
||||
"signature": {"hair_color": "jet black", "hair_length": "mid back",
|
||||
"hair_style": "high ponytail", "eye_color": "medium brown"},
|
||||
"physique": {"body_type": "hourglass", "height": "average height",
|
||||
"skin_tone": "fair", "age": "19"},
|
||||
"prop": "a fan of white paper ofuda charm cards inked with red seals",
|
||||
"aliases": ["Shihna Fujibayashi", "Tales of Symphonia"],
|
||||
},
|
||||
"Kula Diamond": {
|
||||
"franchise": "The King of Fighters",
|
||||
"gender": "Female",
|
||||
"costume": "a skintight purple zip-front bodysuit, a cropped red leather jacket, "
|
||||
"leather chaps over the legs, a belt with a gold buckle, red fingerless "
|
||||
"gloves and boots",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "electric blue", "hair_length": "waist length",
|
||||
"hair_texture": "sleek straight", "hair_style": "blunt bangs"},
|
||||
"physique": {"body_type": "petite and slim", "height": "short",
|
||||
"skin_tone": "very pale", "age": "18"},
|
||||
"prop": "a swirled lollipop",
|
||||
},
|
||||
"Parasoul": {
|
||||
"franchise": "Skullgirls",
|
||||
"gender": "Female",
|
||||
"costume": "a short black turtleneck sweater dress with long sleeves, a silver "
|
||||
"cross pendant necklace, white gloves, black thigh-high stockings and "
|
||||
"black heels",
|
||||
"eyes": "golden yellow",
|
||||
"signature": {"hair_color": "bright red", "hair_length": "hip length",
|
||||
"hair_texture": "sleek straight", "hair_style": "side-swept bangs"},
|
||||
"physique": {"body_type": "hourglass", "height": "tall", "skin_tone": "fair",
|
||||
"age": "22"},
|
||||
"prop": "a long closed black umbrella",
|
||||
"aliases": ["Krieg"],
|
||||
},
|
||||
"Cerebella": {
|
||||
"franchise": "Skullgirls",
|
||||
"gender": "Female",
|
||||
# Vice-Versa (the living hat) is the whole read; the arms are a render risk.
|
||||
"costume": "a huge living hat with a skull emblem on the front and two enormous "
|
||||
"muscular arms growing from its sides, a short strapless dress with "
|
||||
"detached sleeves, black-and-white argyle thigh-high stockings, pointed "
|
||||
"thigh-high boots and a small white mark under one eye",
|
||||
"signature": {"hair_color": "teal", "hair_length": "ear length",
|
||||
"eye_color": "emerald"},
|
||||
"physique": {"body_type": "voluptuous", "height": "tall", "skin_tone": "warm brown",
|
||||
"age": "22"},
|
||||
"aliases": ["Vice-Versa"],
|
||||
},
|
||||
"Miriam (Bloodstained)": {
|
||||
"franchise": "Bloodstained",
|
||||
"gender": "Female",
|
||||
"costume": "glowing stained-glass rose tattoos across the chest, one shoulder and "
|
||||
"one thigh, a short dark blue frilled dress with a low neckline and a "
|
||||
"black corset waist, a single long blue detached sleeve on one arm and "
|
||||
"a black armored gauntlet on the other, and black knee boots",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "jaw length",
|
||||
"hair_style": "natural and unstyled", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slim", "height": "average height",
|
||||
"skin_tone": "very pale", "age": "20"},
|
||||
"prop": "a slim longsword",
|
||||
"aliases": ["Miriam", "Bloodstained: Ritual of the Night"],
|
||||
},
|
||||
"Mina Ashido": {
|
||||
"franchise": "My Hero Academia",
|
||||
"gender": "Female",
|
||||
"costume": "smooth, flawless pink skin, two short curved yellow horns, a white "
|
||||
"domino mask, a skintight sleeveless bodysuit in a teal and purple "
|
||||
"camouflage pattern, an open tan vest trimmed with white fur, and "
|
||||
"purple and tan boots",
|
||||
"eyes": "bright yellow irises on black sclera",
|
||||
"signature": {"hair_color": "baby pink", "hair_length": "ear length",
|
||||
"hair_texture": "curly", "hair_style": "natural and unstyled"},
|
||||
"physique": {"body_type": "athletic", "height": "average height", "age": "18"},
|
||||
"aliases": ["Pinky", "Alien Queen"],
|
||||
},
|
||||
"Alisa Bosconovitch": {
|
||||
"franchise": "Tekken",
|
||||
"gender": "Female",
|
||||
"costume": "a fitted purple dress fading to violet with a high white collar and a "
|
||||
"blue rose brooch, an asymmetrical ruffled skirt, detached purple "
|
||||
"sleeves, white gloves, mismatched dark stockings, white heeled boots, "
|
||||
"a white flower hairpiece, and folded metallic mechanical wings at "
|
||||
"the back",
|
||||
"eyes": "bright green",
|
||||
"signature": {"hair_color": "baby pink", "hair_length": "chin length bob",
|
||||
"hair_texture": "sleek straight", "hair_style": "natural and unstyled"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "19"},
|
||||
"aliases": ["Alisa Boskonovich"],
|
||||
},
|
||||
"Beatrix (Final Fantasy)": {
|
||||
"franchise": "Final Fantasy",
|
||||
"gender": "Female",
|
||||
"costume": "an eyepatch over the right eye, a long open red coat over a sleeveless "
|
||||
"white top, silver shoulder armor and plate gauntlets, grey fingerless "
|
||||
"gloves, a loose brown belt with a large gold buckle slung at the hips, "
|
||||
"tights and tall silver armored boots",
|
||||
"signature": {"hair_color": "chestnut", "hair_length": "mid back",
|
||||
"hair_texture": "thick and voluminous", "hair_style": "worn down",
|
||||
"eye_color": "medium brown"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair",
|
||||
"age": "28"},
|
||||
"prop": "Save the Queen, a long ornate broadsword",
|
||||
"aliases": ["Beatrix", "General Beatrix"],
|
||||
},
|
||||
"Evie Frye": {
|
||||
"franchise": "Assassin's Creed",
|
||||
"gender": "Female",
|
||||
"costume": "a fitted charcoal-black Victorian frock coat with a deep hood and "
|
||||
"crimson-lined coat tails, a dark waistcoat over a white collared shirt, "
|
||||
"black trousers, knee-high laced leather boots and a leather bracer on "
|
||||
"the left forearm",
|
||||
"signature": {"hair_color": "chestnut", "hair_length": "mid back",
|
||||
"hair_style": "braided bun", "eye_color": "hazel",
|
||||
"freckles_density": "scattered"},
|
||||
"physique": {"body_type": "lean", "height": "average height", "skin_tone": "fair",
|
||||
"age": "20"},
|
||||
"aliases": ["Assassin's Creed Syndicate"],
|
||||
},
|
||||
"Velvet Crowe": {
|
||||
"franchise": "Tales series",
|
||||
"gender": "Female",
|
||||
# The bandaged daemon arm leads: it is the one thing the rest of the look
|
||||
# (black rags, shorts, torn stockings) cannot carry alone.
|
||||
"costume": "a left arm wrapped from shoulder to fingertips in grimy white "
|
||||
"bandages, a long tattered black coat with a high collar and a ragged "
|
||||
"torn hem, a scrap of red top bound across the chest with black belts "
|
||||
"and straps, a single armored gauntlet on the right forearm, black "
|
||||
"shorts, torn black thigh-high stockings, armored black boots and a "
|
||||
"black choker",
|
||||
"eyes": "golden",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "waist length",
|
||||
"hair_style": "worn down"},
|
||||
"physique": {"body_type": "athletic", "height": "average height",
|
||||
"skin_tone": "fair", "age": "19"},
|
||||
"aliases": ["Tales of Berseria"],
|
||||
},
|
||||
"Judith (Tales)": {
|
||||
"franchise": "Tales series",
|
||||
"gender": "Female",
|
||||
"costume": "two long antenna-like feelers sweeping back from the head and pointed "
|
||||
"elf ears, a blue halter top trimmed in yellow with white detached "
|
||||
"sleeves and a high white collar, a bare midriff, a blue loincloth-style "
|
||||
"front panel over a short white waist cape, white gloves, a strap around "
|
||||
"one thigh and blue knee-high boots",
|
||||
"signature": {"hair_color": "navy blue", "hair_length": "waist length",
|
||||
"hair_style": "low ponytail"},
|
||||
"physique": {"body_type": "hourglass", "height": "tall", "skin_tone": "fair",
|
||||
"age": "19"},
|
||||
"prop": "a long spear with a slender curved blade",
|
||||
"aliases": ["Judith", "Tales of Vesperia"],
|
||||
},
|
||||
"Seras Victoria": {
|
||||
"franchise": "Hellsing",
|
||||
"gender": "Female",
|
||||
"costume": "a mustard-yellow Hellsing military uniform: a fitted short-sleeved "
|
||||
"jacket with breast pockets and a matching short pencil skirt, a black "
|
||||
"belt, brown gloves, white thigh-high stockings and brown fold-down "
|
||||
"ankle boots",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "jaw length",
|
||||
"hair_style": "natural and unstyled"},
|
||||
"physique": {"body_type": "curvy", "height": "average height",
|
||||
"skin_tone": "fair", "age": "19"},
|
||||
"prop": "the Harkonnen, a massive 30mm anti-midian cannon with a long black "
|
||||
"barrel and a boxy receiver, braced on one shoulder",
|
||||
"aliases": ["Police Girl"],
|
||||
},
|
||||
"Integra Hellsing": {
|
||||
"franchise": "Hellsing",
|
||||
"gender": "Female",
|
||||
"costume": "a dark green tailored three-piece suit with a long jacket, a red ascot "
|
||||
"at the throat fastened with a small silver cross, white gloves, black "
|
||||
"dress shoes and round wire-rimmed glasses",
|
||||
"signature": {"hair_color": "platinum blonde", "hair_length": "hip length",
|
||||
"hair_style": "worn down", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slender", "height": "tall", "skin_tone": "tan",
|
||||
"age": "22"},
|
||||
"aliases": ["Sir Integral Fairbrook Wingates Hellsing"],
|
||||
},
|
||||
"Rinoa Heartilly": {
|
||||
"franchise": "Final Fantasy",
|
||||
"gender": "Female",
|
||||
"costume": "a long sleeveless powder-blue knit duster with white angel-wing designs "
|
||||
"on the back, a black sleeveless top, blue arm warmers tied with black "
|
||||
"ribbons, a short navy blue skirt over black bike shorts, dark ankle boots "
|
||||
"and two silver rings worn on a chain necklace",
|
||||
"signature": {"hair_color": "near black", "hair_length": "slightly past shoulders",
|
||||
"hair_style": "worn down", "eye_color": "dark brown"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "18"},
|
||||
},
|
||||
"Y'shtola Rhul": {
|
||||
"franchise": "Final Fantasy",
|
||||
"gender": "Female",
|
||||
"costume": "a pair of white cat ears atop the head and a long white cat tail, dark "
|
||||
"whisker-like markings striped across both cheeks, a long black "
|
||||
"sorceress's dress trimmed with white fur at the collar and cuffs, a "
|
||||
"black choker, a black feather ornament tucked into the hair and black "
|
||||
"boots",
|
||||
"eyes": "pale milky gray",
|
||||
"signature": {"hair_color": "white", "hair_length": "chin length bob",
|
||||
"hair_style": "blunt bangs"},
|
||||
"physique": {"body_type": "petite and slim", "height": "petite",
|
||||
"skin_tone": "warm tan", "age": "25"},
|
||||
"aliases": ["Yshtola", "Final Fantasy XIV"],
|
||||
},
|
||||
"Lunafreya Nox Fleuret": {
|
||||
"franchise": "Final Fantasy",
|
||||
"gender": "Female",
|
||||
"costume": "a long white sleeveless gown with a fitted lace bodice and a softly "
|
||||
"flared floor-length skirt, a delicate silver necklace and white heels, "
|
||||
"with a small blue sylleblossom flower pinned in the hair",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "mid back",
|
||||
"hair_style": "crown braid", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slender", "height": "average height",
|
||||
"skin_tone": "fair", "age": "25"},
|
||||
"prop": "the Trident of the Oracle, a slender silver trident with an ornate "
|
||||
"gilded head",
|
||||
"aliases": ["Luna", "Final Fantasy XV"],
|
||||
},
|
||||
"Cindy Aurum": {
|
||||
"franchise": "Final Fantasy",
|
||||
"gender": "Female",
|
||||
"costume": "a red baseball cap with mechanic's goggles slung around the neck, a "
|
||||
"cropped yellow mechanic's jacket worn open with the sleeves pushed up "
|
||||
"over a black bikini-style crop top, frayed denim short shorts with a "
|
||||
"leather tool belt, black work gloves, black thigh-high stockings, "
|
||||
"brown work boots and smudges of engine grease on the cheeks",
|
||||
"signature": {"hair_color": "light blonde", "hair_length": "jaw length",
|
||||
"hair_texture": "loosely wavy", "eye_color": "green"},
|
||||
"physique": {"body_type": "curvy", "height": "average height", "skin_tone": "fair",
|
||||
"age": "22"},
|
||||
"prop": "a large chrome adjustable wrench",
|
||||
"aliases": ["Final Fantasy XV"],
|
||||
},
|
||||
"The Boss": {
|
||||
"franchise": "Metal Gear",
|
||||
"gender": "Female",
|
||||
"costume": "an off-white skintight sneaking suit zipped up the front, a black "
|
||||
"tactical belt with pouches, black combat gloves and black boots",
|
||||
"signature": {"hair_color": "platinum blonde", "hair_length": "jaw length",
|
||||
"hair_texture": "loosely wavy", "eye_color": "pale blue"},
|
||||
"physique": {"body_type": "athletic", "height": "tall", "skin_tone": "fair",
|
||||
"age": "43"},
|
||||
"prop": "the Patriot, a compact short-barreled assault rifle with a drum "
|
||||
"magazine",
|
||||
"aliases": ["Metal Gear Solid 3"],
|
||||
},
|
||||
"EVA (Metal Gear)": {
|
||||
"franchise": "Metal Gear",
|
||||
"gender": "Female",
|
||||
"costume": "a black leather motorcycle jumpsuit unzipped to the sternum over a "
|
||||
"black bra, motorcycle goggles slung around the neck, black leather "
|
||||
"gloves and black boots",
|
||||
"signature": {"hair_color": "golden blonde", "hair_length": "shoulder length",
|
||||
"hair_style": "worn down", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "curvy", "height": "average height", "skin_tone": "fair",
|
||||
"age": "30"},
|
||||
"prop": "a Mauser C96 broomhandle pistol",
|
||||
"aliases": ["Eva", "Metal Gear Solid 3"],
|
||||
},
|
||||
"KOS-MOS": {
|
||||
"franchise": "Xenosaga",
|
||||
"gender": "Female",
|
||||
"costume": "a sleek white-and-blue android combat body with a high-cut white "
|
||||
"leotard-style chassis, segmented metallic joints at the shoulders and "
|
||||
"hips, white armored elbow-length gloves, white armored thigh-high boots "
|
||||
"with garter-strap fittings, and a slim metallic headband with a forehead "
|
||||
"plate and swept-back side fins",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "electric blue", "hair_length": "hip length",
|
||||
"hair_style": "worn down"},
|
||||
"physique": {"body_type": "slender", "height": "tall", "skin_tone": "porcelain",
|
||||
"age": "22"},
|
||||
},
|
||||
"Perona": {
|
||||
"franchise": "One Piece",
|
||||
"gender": "Female",
|
||||
"costume": "a strapless black gothic-lolita dress with a full frilled skirt and "
|
||||
"lace trim, a short red capelet over the shoulders, black-and-white "
|
||||
"striped stockings, black boots and a small black crown perched atop "
|
||||
"the head",
|
||||
"eyes": "nearly black",
|
||||
"signature": {"hair_color": "hot pink", "hair_length": "hip length",
|
||||
"hair_style": "curled pigtails"},
|
||||
"physique": {"body_type": "petite and slim", "height": "petite",
|
||||
"skin_tone": "fair", "age": "25"},
|
||||
"prop": "a pink frilled parasol",
|
||||
"aliases": ["Ghost Princess"],
|
||||
},
|
||||
"Celestia Ludenberg": {
|
||||
"franchise": "Danganronpa",
|
||||
"gender": "Female",
|
||||
"costume": "a black gothic-lolita outfit: a frilled black jacket over a white "
|
||||
"collared blouse, a red necktie, a layered frilled black skirt, black "
|
||||
"thigh-high stockings and black lace-up shoes, a black lace-trimmed "
|
||||
"bonnet headdress, and a silver claw ring on one index finger",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "jet black", "hair_length": "waist length",
|
||||
"hair_style": "curled pigtails"},
|
||||
"physique": {"body_type": "slim", "height": "average height",
|
||||
"skin_tone": "porcelain", "age": "18"},
|
||||
"prop": "a fanned hand of playing cards",
|
||||
"aliases": ["Celeste", "Taeko Yasuhiro"],
|
||||
},
|
||||
"Hitori Gotoh": {
|
||||
"franchise": "Bocchi the Rock!",
|
||||
"gender": "Female",
|
||||
"costume": "a baggy pink track jacket zipped up with the sleeves pulled over the "
|
||||
"hands, a short black pleated school skirt, and two cube-shaped hair "
|
||||
"clips, one yellow and one blue, on one side of the head",
|
||||
"signature": {"hair_color": "baby pink", "hair_length": "hip length",
|
||||
"hair_style": "worn down", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slim", "height": "short", "skin_tone": "fair",
|
||||
"age": "18"},
|
||||
"prop": "a black Gibson Les Paul Custom electric guitar with gold hardware",
|
||||
"aliases": ["Bocchi"],
|
||||
},
|
||||
"Chisato Nishikigi": {
|
||||
"franchise": "Lycoris Recoil",
|
||||
"gender": "Female",
|
||||
"costume": "a red-and-grey Lycoris uniform: a long-sleeved red pleated dress with "
|
||||
"a pale grey bib panel over a white collared shirt, a red neck ribbon, a "
|
||||
"red belt, black socks and brown loafers, with a red ribbon tied in the "
|
||||
"hair on one side",
|
||||
"eyes": "crimson",
|
||||
"signature": {"hair_color": "light blonde", "hair_length": "chin length bob",
|
||||
"hair_style": "natural and unstyled"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "18"},
|
||||
},
|
||||
"Tira": {
|
||||
"franchise": "Soul Calibur",
|
||||
"gender": "Female",
|
||||
"costume": "a tattered green-and-black outfit of torn rags with feathered fringes "
|
||||
"at the shoulders and hips, a ragged cropped top, black elbow gloves "
|
||||
"under armored gauntlets, crossed belts and suspenders, black thigh-high "
|
||||
"boots, green lipstick and a beauty mark under one eye",
|
||||
"eyes": "violet",
|
||||
"signature": {"hair_color": "teal", "hair_length": "jaw length",
|
||||
"hair_style": "high pigtails"},
|
||||
"physique": {"body_type": "slender", "height": "petite", "skin_tone": "pale",
|
||||
"age": "19"},
|
||||
"prop": "Eiserne Drossel, a large circular ring blade with a bladed outer edge "
|
||||
"and a grip across its center",
|
||||
},
|
||||
"Gwenpool": {
|
||||
"franchise": "Marvel",
|
||||
"gender": "Female",
|
||||
"costume": "a pink-and-white superhero bodysuit styled after Deadpool's with a "
|
||||
"white hood, white gloves and pink shin guards, a brown utility belt "
|
||||
"hung with pouches, wrist straps and a thigh strap, with the tips of the "
|
||||
"hair dyed pink",
|
||||
"signature": {"hair_color": "light blonde", "hair_length": "chin length bob",
|
||||
"hair_style": "natural and unstyled", "eye_color": "bright blue"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "19"},
|
||||
"prop": "a katana in each hand",
|
||||
"aliases": ["Gwen Poole"],
|
||||
},
|
||||
"Heather Mason": {
|
||||
"franchise": "Silent Hill",
|
||||
"gender": "Female",
|
||||
"costume": "a white padded sleeveless vest over an orange sleeveless turtleneck, "
|
||||
"a short olive-green pencil skirt, black wristbands and brown knee-high "
|
||||
"boots",
|
||||
"signature": {"hair_color": "light blonde", "hair_length": "jaw length",
|
||||
"hair_style": "natural and unstyled", "eye_color": "light brown"},
|
||||
"physique": {"body_type": "slim", "height": "average height", "skin_tone": "fair",
|
||||
"age": "18"},
|
||||
"prop": "a rusted steel lead pipe",
|
||||
"aliases": ["Silent Hill 3"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -27441,6 +27963,7 @@ _CATEGORY_FRANCHISES: dict[str, tuple[str, ...]] = {
|
||||
"Hunter x Hunter", "Trigun", "Black Butler", "Yu-Gi-Oh!",
|
||||
"Mobile Suit Gundam", "Solo Leveling",
|
||||
"Inuyasha", "Yu Yu Hakusho", "Ranma 1/2", "Hellsing",
|
||||
"Bocchi the Rock!", "Lycoris Recoil", # 2.7.0
|
||||
"Akira", "Oshi no Ko", # 0.98.0
|
||||
"Urusei Yatsura", "Lupin III", "FLCL",
|
||||
"Durarara!!", "Panty & Stocking with Garterbelt", "Gintama",
|
||||
@@ -27499,6 +28022,7 @@ _CATEGORY_FRANCHISES: dict[str, tuple[str, ...]] = {
|
||||
"Ghost of Tsushima", # 1.11.0
|
||||
"Touhou Project", "Shantae", "BlazBlue", # 2.1.0
|
||||
"Xenoblade Chronicles", "Valkyria Chronicles", "Magic: The Gathering",
|
||||
"Tales series", "Xenosaga", "Skullgirls", "Bloodstained", # 2.7.0
|
||||
"Ace Attorney", "The Rising of the Shield Hero", "A Certain Scientific Railgun",
|
||||
"Destiny", # 1.2.0 -- Mara Sov
|
||||
"Ratchet & Clank", "Spyro",
|
||||
|
||||
+47
-8
@@ -946,7 +946,8 @@ CREATURES: dict[str, dict] = {
|
||||
"head": "a translucent sorrowful face that drifts in and out of focus",
|
||||
"eyes": "hollow glowing eyes",
|
||||
"integument": "a semi-transparent vaporous form",
|
||||
"arms": "trailing wispy arms",
|
||||
# 2.4.0: "trailing wispy arms" drew a third arm; the count anchors it.
|
||||
"arms": "two wispy arms",
|
||||
"hands": "fading translucent hands",
|
||||
"legs_feet": "a dissolving misty trail instead of legs",
|
||||
"extras": "a cold ectoplasmic glow",
|
||||
@@ -1712,10 +1713,19 @@ CREATURES: dict[str, dict] = {
|
||||
"class": "Marine Life", "palette": "cream and russet",
|
||||
"head": "a hooded nautilus head ringed with slender tentacles",
|
||||
"eyes": "simple pinhole eyes",
|
||||
"integument": "a coiled chambered spiral shell over soft flesh",
|
||||
# 2.4.0: placed on the back, or the shell vanished and only a person was left.
|
||||
"integument": "a tiger-striped coiled spiral shell carried on the back like a snail's, over soft pale flesh",
|
||||
"arms": "many small grasping tentacle-arms",
|
||||
"hands": "clusters of fine tentacle tips",
|
||||
"extras": "a gentle jet-propulsion siphon",
|
||||
# 2.4.0: in Anthropomorphic form a whole nautilus rendered beside a person.
|
||||
"anthro": {
|
||||
"head": "a head shaped like a coiled nautilus shell, slender tentacles around the mouth",
|
||||
"integument": "smooth skin banded with tiger stripes",
|
||||
"arms": "two slender arms",
|
||||
"hands": "hands with fine tentacle-tip fingers",
|
||||
"extras": "",
|
||||
},
|
||||
},
|
||||
"djinn": {
|
||||
"class": "Mythic & Fantasy", "palette": "smokeless blue flame",
|
||||
@@ -1733,10 +1743,17 @@ CREATURES: dict[str, dict] = {
|
||||
"head": "a diffuse glowing core suggesting a head within a gas cloud",
|
||||
"eyes": "scattered points of brighter light for eyes",
|
||||
"integument": "a shifting translucent cloud of luminous gas",
|
||||
"arms": "tendrils of condensing vapor for arms",
|
||||
# 2.4.0: "tendrils ... for arms" rendered a third arm.
|
||||
"arms": "two arms of condensing vapor",
|
||||
"hands": "wisps that gather into hand-like shapes",
|
||||
"extras": "a slow internal aurora",
|
||||
"palette_pool": ["luminous cyan", "rose nebula", "amber haze", "violet plasma", "pale green glow"],
|
||||
# 2.4.0: "humanoid gaseous alien" rendered a grey alien beside a gas cloud.
|
||||
"anthro": {
|
||||
"subject": "humanoid figure made entirely of glowing gas",
|
||||
"head": "a head of dense glowing vapor with no solid face",
|
||||
"integument": "a translucent body of swirling luminous gas",
|
||||
},
|
||||
},
|
||||
|
||||
# --- Mammals (0.44 expansion) ------------------------------------------
|
||||
@@ -2222,8 +2239,17 @@ CREATURES: dict[str, dict] = {
|
||||
"arms": "stout clasping forelimbs",
|
||||
"hands": "small clawed grips",
|
||||
"legs_feet": "six clinging clawed legs",
|
||||
"wings": "large clear membranous wings veined and held roof-like",
|
||||
# 2.4.0: "held roof-like" alone rendered the wings across the chest.
|
||||
"wings": "large clear veined membranous wings folded roof-like over the back",
|
||||
"extras": "a loud droning song from the abdomen",
|
||||
# 2.4.0: in Anthropomorphic form a giant cicada rendered behind a shirt.
|
||||
"anthro": {
|
||||
"subject": "insectoid humanoid",
|
||||
"head": "a human-sized cicada head with short bristle antennae",
|
||||
"integument": "a chitinous exoskeleton over the torso",
|
||||
"arms": "two clasping insect arms",
|
||||
"legs_feet": "two jointed insect legs",
|
||||
},
|
||||
},
|
||||
# --- Monsters ---
|
||||
"ogre": {
|
||||
@@ -2395,16 +2421,18 @@ CREATURES: dict[str, dict] = {
|
||||
"jiangshi": {
|
||||
# Stiff-armed Qing-robed hopping undead: not a vampire (aristocratic,
|
||||
# fanged, fluid) and not a zombie (shambling, rotted).
|
||||
"class": "Monsters", "palette": "greyed corpse-blue",
|
||||
"class": "Monsters", "palette": "pale greenish-white",
|
||||
# The palette is prepended to `integument` only, never to `head`, so a
|
||||
# creature's FACE has no colour anchor at all - the creature-layer
|
||||
# equivalent of the green-body/pale-face bug. "corpse face" rendered as
|
||||
# a healthy woman wearing a paper slip. Pallor has to be carried by
|
||||
# colour-FREE words in the head slot itself (bloodless, waxen, sunken);
|
||||
# naming a colour here would break the colour-free slot convention.
|
||||
"head": "a bloodless, waxen corpse face, sunken and hollow-cheeked, the jaw slack and expressionless, a long yellow paper talisman pasted down the brow",
|
||||
"head": "a bloodless, waxen corpse face, sunken and hollow-cheeked, small fangs at the slack lips, a long yellow paper talisman pasted down the brow",
|
||||
"eyes": "clouded milky eyes with no life in them",
|
||||
"integument": "stiff, desiccated corpse skin drawn tight over the bones",
|
||||
# 2.4.0: palette + "stiff, desiccated corpse skin" voiced "greyed
|
||||
# corpse-blue stiff, desiccated corpse skin"; the palette needs "skin" first.
|
||||
"integument": "skin, stiff and desiccated, drawn tight over the bones like a corpse",
|
||||
"arms": "arms locked straight out in front and held rigid",
|
||||
"hands": "hooked stiffened fingers with long dark nails",
|
||||
"legs_feet": "stiff unbending legs that move in short hops",
|
||||
@@ -3296,7 +3324,7 @@ CREATURES: dict[str, dict] = {
|
||||
"stegosaurus": {
|
||||
"class": "Reptiles & Amphibians", "palette": "mottled olive",
|
||||
"palette_pool": ["mottled olive", "earthy brown", "slate grey-green"],
|
||||
"head": "a small low narrow head with a toothless beaked snout",
|
||||
"head": "a small low narrow dinosaur head with a toothless beaked snout",
|
||||
"eyes": "small dark eyes set on the sides of the head",
|
||||
"integument": "a double row of broad upright diamond-shaped bony plates running "
|
||||
"down the back over thick pebbled hide",
|
||||
@@ -3304,6 +3332,17 @@ CREATURES: dict[str, dict] = {
|
||||
"hands": "broad blunt-toed forefeet",
|
||||
"legs_feet": "tall massive hind legs",
|
||||
"tail": "a heavy tail ending in four long horizontal bony spikes",
|
||||
# 2.4.0: in Anthropomorphic form a whole stegosaurus rendered beside a person.
|
||||
"anthro": {
|
||||
"subject": "scaly reptilian humanoid",
|
||||
"head": "a stegosaurus-like dinosaur head with a toothless beaked snout",
|
||||
"integument": "a double row of broad upright diamond-shaped bony plates running "
|
||||
"down the spine over thick pebbled hide",
|
||||
"arms": "thick scaly arms",
|
||||
"hands": "broad blunt-clawed hands",
|
||||
"legs_feet": "sturdy scaly legs",
|
||||
"tail": "a short tail ending in four bony spikes",
|
||||
},
|
||||
},
|
||||
|
||||
# ======================================================================
|
||||
|
||||
+17
-6
File diff suppressed because one or more lines are too long
+104
-29
@@ -163,7 +163,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"outfit_style": "edgy alternative",
|
||||
"accessories": "no accessories",
|
||||
"expression": "confident",
|
||||
"location": "factory floor",
|
||||
"location": "blacksmith forge with an anvil",
|
||||
"lighting": "warm incandescent lamp glow",
|
||||
"shot_type": "low angle looking up",
|
||||
"mood": "self-assured",
|
||||
@@ -486,7 +486,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"outfit_style": "casual",
|
||||
"accessories": "no accessories",
|
||||
"expression": "confident",
|
||||
"location": "sleek modern kitchen with marble countertops",
|
||||
"location": "commercial kitchen",
|
||||
"lighting": "warm incandescent lamp glow",
|
||||
"shot_type": "medium shot from waist up",
|
||||
"mood": "self-assured",
|
||||
@@ -810,8 +810,8 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"complexion": "ruddy", "outfit_style": "edgy alternative",
|
||||
"outfit_description": "weathered brown leather coat over a loose linen shirt, a wide red sash, and a tricorn hat",
|
||||
"bag": "no bag", "accessories": "no accessories",
|
||||
"expression": "smirking", "location": "dimly lit cocktail lounge",
|
||||
"lighting": "warm candlelight",
|
||||
"expression": "smirking", "location": "harbor with moored boats",
|
||||
"lighting": "golden hour sunlight",
|
||||
"shot_type": "cowboy shot from mid-thigh up", "mood": "carefree",
|
||||
# 1.5.1 (maintainer): a gender-neutral role coin-flips; the Male look
|
||||
# is the old lean, unchanged.
|
||||
@@ -1059,7 +1059,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"Gladiator": {
|
||||
"accessories": "no accessories",
|
||||
"gender": "Any", "body_type": "athletic", "fitness_level": "muscular", "hair_color": ["dark brown", "medium brown", "near black"], "outfit_style": "athletic", "expression": "determined",
|
||||
"location": "museum gallery with white walls", "lighting": "dramatic chiaroscuro side lighting",
|
||||
"location": "the Colosseum exterior", "lighting": "harsh overhead midday sun",
|
||||
"shot_type": "cowboy shot from mid-thigh up", "mood": "intense",
|
||||
# 1.5.1 (maintainer): a gender-neutral role coin-flips; the Male look
|
||||
# is the old lean, unchanged.
|
||||
@@ -1102,8 +1102,12 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"accessories": "no accessories",
|
||||
"gender": "Any", "ethnicity": "Japanese", "hair_color": ["jet black", "raven black", "near black"],
|
||||
"outfit_style": "edgy alternative", "expression": "stern",
|
||||
"location": "photography studio with backdrop", "lighting": "soft studio three-point lighting",
|
||||
# 2.4.0: out of the photo studio and into the landscape the look belongs to.
|
||||
"location": "the Mount Fuji foothills", "lighting": "overcast diffused daylight",
|
||||
"shot_type": "full body shot", "mood": "tense",
|
||||
# Armour and a horned helm: a warrior's stance or seiza, not a lounge or a hair touch.
|
||||
"pose": ["standing with feet planted wide", "standing tall with shoulders back",
|
||||
"standing with arms crossed", "kneeling seiza-style"],
|
||||
# 1.5.1 (maintainer): a gender-neutral role coin-flips; the Male look
|
||||
# is the old lean, unchanged.
|
||||
"variants": {
|
||||
@@ -1335,7 +1339,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"Veterinarian": {
|
||||
"hair_length": ["shoulder length", "long"], "hair_style": "low ponytail",
|
||||
"outfit_style": "business casual",
|
||||
"expression": "warm smile", "location": "doctor's examination room",
|
||||
"expression": "warm smile", "location": "veterinary clinic exam room",
|
||||
"lighting": "cool LED overhead lighting",
|
||||
"shot_type": "medium shot from waist up", "mood": "cheerful",
|
||||
},
|
||||
@@ -1348,7 +1352,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
"Glassblower": {
|
||||
"outfit_style": "casual", "expression": "determined",
|
||||
"location": "factory floor", "lighting": "fire and flame warm flicker",
|
||||
"location": "glassblowing studio with a furnace", "lighting": "fire and flame warm flicker",
|
||||
"shot_type": "medium shot from waist up", "mood": "intense",
|
||||
},
|
||||
|
||||
@@ -1642,7 +1646,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"gender": "Any", "ethnicity": "Cuban", "body_type": "athletic", "height": "tall",
|
||||
"fitness_level": "muscular", "hair_color": ["jet black", "raven black", "near black"],
|
||||
"skin_tone": "warm brown", "outfit_style": "athletic",
|
||||
"expression": "intense gaze", "location": "local gym weight room",
|
||||
"expression": "intense gaze", "location": "boxing gym with hanging heavy bags",
|
||||
"lighting": "dramatic chiaroscuro side lighting", "shot_type": "cowboy shot from mid-thigh up",
|
||||
"mood": "intense",
|
||||
"variants": {
|
||||
@@ -1838,7 +1842,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"fitness_level": "muscular",
|
||||
"hair_color": ["jet black", "raven black", "near black"], "hair_length": "shoulder length", "hair_texture": "wavy",
|
||||
"skin_tone": "warm tan", "outfit_style": "athletic",
|
||||
"expression": "intense gaze", "location": "high school gymnasium",
|
||||
"expression": "intense gaze", "location": "wrestling ring under arena lights",
|
||||
"lighting": "dramatic single overhead spotlight", "shot_type": "cowboy shot from mid-thigh up",
|
||||
"mood": "intense",
|
||||
"variants": {
|
||||
@@ -1863,7 +1867,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"gender": "Any", "ethnicity": "Mexican", "body_type": "athletic", "height": "average height",
|
||||
"fitness_level": "very fit",
|
||||
"hair_color": ["jet black", "raven black", "near black"], "skin_tone": "tan", "outfit_style": "athletic", "expression": "confident",
|
||||
"location": "high school gymnasium", "lighting": "dramatic single overhead spotlight",
|
||||
"location": "wrestling ring under arena lights", "lighting": "dramatic single overhead spotlight",
|
||||
"shot_type": "full body shot", "mood": "self-assured",
|
||||
# 1.5.1 (maintainer): a gender-neutral role coin-flips; the Male look
|
||||
# is the old lean, unchanged.
|
||||
@@ -1889,7 +1893,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"accessories": "no accessories",
|
||||
"gender": "Any", "ethnicity": "Brazilian", "body_type": "fit", "height": "average height",
|
||||
"hair_color": ["dark brown", "medium brown", "near black"], "skin_tone": "tan", "outfit_style": "athletic", "expression": "confident",
|
||||
"location": "parking garage", "lighting": "harsh fluorescent lighting",
|
||||
"location": "racetrack pit lane", "lighting": "harsh overhead midday sun",
|
||||
"shot_type": "medium shot from waist up", "mood": "self-assured",
|
||||
# 1.5.1 (maintainer): a gender-neutral role coin-flips; the Male look
|
||||
# is the old lean, unchanged.
|
||||
@@ -2142,6 +2146,8 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
"Female": {
|
||||
"hair_length": "short pixie",
|
||||
# 2.4.0: an 80s look, not a random 1950s pin-up face.
|
||||
"makeup_style": ["bold glam", "editorial makeup"],
|
||||
"outfit_description": [
|
||||
"an oversized {jewel_tone} blazer with sharply padded shoulders and pushed-up sleeves over a graphic tee, slim trousers, and pointed boots",
|
||||
"a boxy {jewel_tone} cropped jacket with padded shoulders over a black mesh-panel top, a high-waisted pencil skirt, and pointed ankle boots",
|
||||
@@ -2210,7 +2216,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"fitness_level": "very fit",
|
||||
"hair_color": ["dark brown", "medium brown", "near black"], "hair_length": "shoulder length", "hair_style": "high ponytail",
|
||||
"skin_tone": "warm tan", "outfit_style": "athletic", "accessories": "no accessories",
|
||||
"expression": "determined", "location": "sunny city park",
|
||||
"expression": "determined", "location": "outdoor tennis court with a net",
|
||||
"lighting": "harsh overhead midday sun", "shot_type": "full body shot", "mood": "self-assured",
|
||||
},
|
||||
"Gymnast": {
|
||||
@@ -2234,7 +2240,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"hair_color": ["chestnut", "light chestnut", "warm brown"], "hair_length": "shoulder length", "hair_texture": "wavy",
|
||||
"hair_style": "half up half down", "skin_tone": "fair", "outfit_style": "casual",
|
||||
"accessories": "no accessories", "expression": "warm smile",
|
||||
"location": "farmers market indoor stall", "lighting": "soft window light from the side",
|
||||
"location": "flower shop interior", "lighting": "soft window light from the side",
|
||||
"shot_type": "medium shot from waist up", "mood": "cheerful",
|
||||
},
|
||||
"Plumber": {
|
||||
@@ -2345,12 +2351,12 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
"Potter": {
|
||||
"outfit_style": "casual", "expression": "at ease",
|
||||
"location": "artist's painting studio", "lighting": "soft window light from the side",
|
||||
"location": "ceramics studio with pottery wheels", "lighting": "soft window light from the side",
|
||||
"shot_type": "medium shot from waist up", "mood": "peaceful",
|
||||
},
|
||||
"Tailor": {
|
||||
"outfit_style": "smart casual", "expression": "subtle soft smile",
|
||||
"location": "luxury retail boutique", "lighting": "soft window light from the side",
|
||||
"location": "tailor's workroom with dress forms", "lighting": "soft window light from the side",
|
||||
"shot_type": "medium shot from waist up", "mood": "tranquil",
|
||||
},
|
||||
"Calligrapher": {
|
||||
@@ -2630,7 +2636,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"a heavyweight white cotton martial-arts gi with a wrapped black belt knotted at the waist, worn barefoot",
|
||||
"a sleeveless {dark_color} training top with loose black kung-fu trousers, wrapped hand wraps, and bare feet",
|
||||
],
|
||||
"expression": "determined", "location": "yoga studio with wood floors",
|
||||
"expression": "determined", "location": "martial arts dojo",
|
||||
"lighting": "soft window light from the side", "shot_type": "full body shot", "mood": "intense",
|
||||
},
|
||||
"Kendo Practitioner": {
|
||||
@@ -2650,7 +2656,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"a dark navy kendogi jacket under a white do chest plate with red accents, a tare waist guard with a name tag, thick padded kote gauntlets, a men grille mask with a padded fukin head covering, and a dark hakama with suneate shin guards",
|
||||
"a white keikogi under a dark blue do with white trim, padded kote gloves, a men face grille with a tenugui head cloth, a tare waist protector, and dark blue hakama trousers with shin guards",
|
||||
],
|
||||
"expression": "focused", "location": "yoga studio with wood floors",
|
||||
"expression": "focused", "location": "martial arts dojo",
|
||||
"lighting": "soft window light from the side",
|
||||
"shot_type": "full body shot", "mood": "intense",
|
||||
"held_item": "a bamboo shinai",
|
||||
@@ -2696,11 +2702,30 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"Indie Sleaze": {
|
||||
"body_type": "lean", "hair_color": ["near black", "jet black", "dark brown"], "hair_length": "shoulder length",
|
||||
"hair_texture": "slightly wavy", "hair_style": "natural and unstyled", "skin_tone": "pale",
|
||||
"eye_makeup": "smoky black", "eyeliner": "smudged kohl", "outfit_style": "edgy alternative",
|
||||
"eyeliner": "smudged kohl", "outfit_style": "edgy alternative",
|
||||
"accessories": "no accessories",
|
||||
"outfit_description": "a rumpled vintage graphic tee under a worn leather jacket, tight shiny disco pants, and scuffed ankle boots, styled with a careless thrifted look",
|
||||
"expression": "smirking", "location": "neon-lit nightclub", "lighting": "club strobe lighting",
|
||||
"shot_type": "medium shot from waist up", "mood": "moody",
|
||||
# 2.4.0: a man drew the disco bodysuit with tights and smoky shadow and read as
|
||||
# drag; the scene's men wore skinny jeans and just the smudged liner.
|
||||
"variants": {
|
||||
"Male": {
|
||||
"outfit_description": [
|
||||
"a rumpled vintage graphic tee under a worn leather jacket, skinny black jeans, and scuffed ankle boots, styled with a careless thrifted look",
|
||||
"a rumpled vintage graphic tee under a {dark_color} moto jacket with skinny jeans and battered canvas sneakers, styled with a careless thrifted look",
|
||||
"an oversized thrifted blazer over a slogan tee with tight {color} jeans and scuffed loafers, layered with a haphazard second-hand look",
|
||||
],
|
||||
},
|
||||
"Female": {
|
||||
"eye_makeup": "smoky black",
|
||||
"outfit_description": [
|
||||
"a rumpled vintage graphic tee under a worn leather jacket, tight shiny disco pants, and scuffed ankle boots, styled with a careless thrifted look",
|
||||
"a rumpled vintage graphic tee under a {dark_color} moto jacket with skinny jeans and battered canvas sneakers, styled with a careless thrifted look",
|
||||
"an oversized thrifted blazer over a slogan tee with tight {color} jeans and scuffed loafers, layered with a haphazard second-hand look",
|
||||
"a metallic {color} disco bodysuit under a cropped denim jacket with opaque tights and beat-up ankle boots",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"Y2K Mall Casual": {
|
||||
"gender": "Any",
|
||||
@@ -3290,6 +3315,10 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
"Figure Skater": {
|
||||
"gender": "Any",
|
||||
# 2.4.0: on blades a skater stands and strikes a pose; never walks or kneels.
|
||||
# A pose lock is Setting & Shot, so it holds in Essentials too.
|
||||
"pose": ["standing tall with shoulders back", "in a confident power pose",
|
||||
"standing with weight on one leg", "stretching both arms overhead"],
|
||||
"variants": {
|
||||
"Female": {
|
||||
"body_type": ["athletic", "petite and slim", "toned"], "fitness_level": "very fit",
|
||||
@@ -3303,7 +3332,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"a {pastel} competition skating dress with cascading rhinestones, sheer mesh sleeves, and white figure skates",
|
||||
],
|
||||
"expression": ["determined", "bright smile"],
|
||||
"location": ["roller skating rink", "dance studio with mirrors"],
|
||||
"location": "indoor ice rink",
|
||||
"lighting": ["high key bright even lighting", "stage spotlight from above"],
|
||||
"shot_type": "full body shot", "mood": ["triumphant", "radiant"],
|
||||
},
|
||||
@@ -3317,7 +3346,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"a sleek {jewel_tone} competition skating shirt with an asymmetric beaded seam, black stretch trousers, and black figure skates",
|
||||
],
|
||||
"expression": ["determined", "bright smile"],
|
||||
"location": ["roller skating rink", "dance studio with mirrors"],
|
||||
"location": "indoor ice rink",
|
||||
"lighting": ["high key bright even lighting", "stage spotlight from above"],
|
||||
"shot_type": "full body shot", "mood": ["triumphant", "radiant"],
|
||||
},
|
||||
@@ -3892,14 +3921,18 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"height": "average height",
|
||||
"fitness_level": "athletic",
|
||||
"outfit_style": "athletic",
|
||||
"outfit_description": "bulky {color} goaltender pads strapped over the legs, a heavily "
|
||||
"padded chest protector under a loose team jersey, an oversized "
|
||||
# 2.4.0: team colours on pads and jersey; a charcoal draw on white ice rendered
|
||||
# the whole frame black and white.
|
||||
"outfit_description": "bulky {team_color} goaltender pads strapped over the legs, a heavily "
|
||||
"padded chest protector under a loose {team_color} team jersey, an oversized "
|
||||
"blocker on one hand and a deep catching glove on the other, and "
|
||||
"a painted cage-fronted goalie mask",
|
||||
"accessories": "no accessories",
|
||||
"bag": "no bag",
|
||||
"expression": "determined",
|
||||
"location": "indoor ice rink",
|
||||
# 2.4.0: on blades, a set stance rather than a walk.
|
||||
"pose": ["standing with feet planted wide", "standing tall with shoulders back"],
|
||||
"lighting": "cool LED overhead lighting",
|
||||
"shot_type": "full body shot",
|
||||
"mood": "intense",
|
||||
@@ -5011,7 +5044,7 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"necklace": "no necklace",
|
||||
"earrings": "no earrings",
|
||||
"expression": "determined",
|
||||
"location": ["open meadow", "country dirt road"],
|
||||
"location": "racecourse paddock with a white rail",
|
||||
"lighting": ["golden hour sunlight", "overcast diffused daylight"],
|
||||
"shot_type": "full body shot",
|
||||
"mood": "intense",
|
||||
@@ -5507,6 +5540,9 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"expression": "confident",
|
||||
"location": ["wide sandy beach", "working harbor dock", "harbor with moored boats",
|
||||
"lakeside pier"],
|
||||
# 2.4.0: fins on the feet: a diver stands, never strides.
|
||||
"pose": ["standing with feet planted wide", "standing tall with shoulders back",
|
||||
"standing with arms relaxed at the sides", "posing with a hand on one hip"],
|
||||
"lighting": "golden hour sunlight",
|
||||
"shot_type": "full body shot",
|
||||
"mood": "self-assured",
|
||||
@@ -5600,6 +5636,9 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"expression": "bright smile",
|
||||
# Skating the order out to the cars is the job.
|
||||
"location": "the parking lot of a retro drive-in diner with classic cars",
|
||||
# 2.4.0: rolling or posing on skates; never sat or kneeling on the tarmac.
|
||||
"pose": ["posing with a hand on one hip", "standing with weight on one leg",
|
||||
"pausing mid-step", "turning toward the viewer mid-stride"],
|
||||
"lighting": ["golden hour sunlight", "neon sign glow in multiple colors"],
|
||||
"shot_type": "full body shot",
|
||||
"mood": "cheerful",
|
||||
@@ -5691,6 +5730,9 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
"earrings": "no earrings",
|
||||
"expression": "defiant",
|
||||
"location": "roller skating rink",
|
||||
# 2.4.0: on wheels, a set stance rather than a walk.
|
||||
"pose": ["standing with feet planted wide", "in a confident power pose",
|
||||
"standing with arms crossed"],
|
||||
"lighting": "cool LED overhead lighting",
|
||||
"shot_type": "full body shot",
|
||||
"mood": "fierce",
|
||||
@@ -6006,6 +6048,42 @@ ARCHETYPES: dict[str, dict[str, Any]] = {
|
||||
},
|
||||
},
|
||||
},
|
||||
# 2.3.0: Mexica (Aztec) nobility, after the Codex Mendoza and Florentine Codex: the
|
||||
# knotted tilmatli cloak and maxtlatl for men, the huipil and cueitl for women, jade
|
||||
# ear spools for both (not matched as earrings, so the random pair is locked off).
|
||||
"Aztec Noble": {
|
||||
"gender": "Any",
|
||||
"tattoos": "no tattoos",
|
||||
"piercings": "no piercings beyond ears",
|
||||
"bracelet": "none",
|
||||
"rings": "none",
|
||||
"ethnicity": "Mexican",
|
||||
"outfit_style": "evening formal",
|
||||
"accessories": "no accessories",
|
||||
"bag": "no bag",
|
||||
"necklace": "no necklace",
|
||||
"earrings": "no earrings",
|
||||
"hair_color": "jet black",
|
||||
"hair_highlights": "none",
|
||||
"nails": "natural short nails",
|
||||
"expression": "confident",
|
||||
"location": "crumbling stone ruin",
|
||||
"lighting": "late afternoon warm sunlight",
|
||||
"shot_type": "full body shot",
|
||||
"mood": "commanding",
|
||||
"variants": {
|
||||
"Female": {
|
||||
"hair_length": "waist length", "hair_texture": "sleek straight",
|
||||
"hair_style": ["worn down", "loose braids"], "makeup_style": "no makeup",
|
||||
"outfit_description": "a white cotton huipil tunic woven with bands of {jewel_tone} and gold geometric pattern at the neck and hem, worn over a long wrapped cueitl skirt with an embroidered border, a collar of polished jade beads, jade ear spools, gold arm cuffs, and simple leather sandals",
|
||||
},
|
||||
"Male": {
|
||||
"hair_length": "shoulder length", "hair_style": "worn down",
|
||||
"makeup_style": "no makeup", "facial_hair": "clean shaven",
|
||||
"outfit_description": "a white cotton tilmatli cloak edged with a woven {jewel_tone} and gold geometric border and knotted at one shoulder, a maxtlatl loincloth with long embroidered hanging ends, a tall headdress of long green quetzal feathers rising from a gold band, jade ear spools, gold arm cuffs, and leather sandals with high heel guards",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -6275,10 +6353,7 @@ _COSTUMES: dict[str, str | list[str]] = {
|
||||
"a black band tee under an unzipped {dark_color} hoodie with tight black skinny jeans, a studded belt, fingerless gloves, and worn high-tops",
|
||||
"a black-and-{jewel_tone} striped long-sleeve under a graphic band tee, black skinny jeans with a chain wallet, and scuffed skate shoes",
|
||||
"a snug {dark_color} zip hoodie over a studded belt and drainpipe jeans, with checkerboard slip-ons and rubber wristbands stacked up one forearm"],
|
||||
"Indie Sleaze": ["a rumpled vintage graphic tee under a worn leather jacket, tight shiny disco pants, and scuffed ankle boots, styled with a careless thrifted look",
|
||||
"a rumpled vintage graphic tee under a {dark_color} moto jacket with skinny jeans and battered canvas sneakers, styled with a careless thrifted look",
|
||||
"an oversized thrifted blazer over a slogan tee with tight {color} jeans and scuffed loafers, layered with a haphazard second-hand look",
|
||||
"a metallic {color} disco bodysuit under a cropped denim jacket with opaque tights and beat-up ankle boots"],
|
||||
# Indie Sleaze: costume moved into its variants (2.4.0).
|
||||
# --- 0.67.0 additions (lean unisex archetypes) ---
|
||||
"Butler": "a formal black tailcoat over a white wing-collar shirt with a {dark_color} waistcoat, a black bow tie, pressed trousers, and white cotton gloves",
|
||||
"Coal Miner": "grimy {earth_tone} coveralls streaked with coal dust, a battered hard hat with a headlamp, heavy canvas gloves, and steel-toe boots, the face smudged with soot",
|
||||
|
||||
+85
-12
@@ -67,8 +67,8 @@ Reload the node / restart ComfyUI to apply. Notes:
|
||||
* For the three gender-specific fields (``bust``, ``facial_hair``,
|
||||
``makeup_style``) custom options may not survive a live gender switch in the UI.
|
||||
* ``archetypes`` adds presets to the Archetype node (same ``{field: value}``
|
||||
shape as the built-ins; ``outfit_description`` may use ``{slot}`` costume
|
||||
placeholders). ``cosplayers`` adds characters to the Cosplayer node (keys:
|
||||
shape as the built-ins, list values and a ``variants`` block included;
|
||||
``outfit_description`` may use ``{slot}`` costume placeholders). ``cosplayers`` adds characters to the Cosplayer node (keys:
|
||||
``franchise``, ``gender`` Female/Male, ``costume`` text, optional ``prop`` (a
|
||||
signature held item, voiced as "holding …" when the node's prop toggle is on),
|
||||
optional ``signature`` / ``physique`` ``{field: value}`` maps). A user entry whose name matches a
|
||||
@@ -98,9 +98,14 @@ The file is parsed as plain JSON — no code is executed.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
#: 2.6.0: messages go to the logger like the rest of the pack (ComfyUI owns the
|
||||
#: handlers); the logger name replaces the old '[IdentityForge]' prefix.
|
||||
_LOG = logging.getLogger(__name__)
|
||||
|
||||
#: Default location of the user file: the pack root, next to __init__.py.
|
||||
USER_OPTIONS_PATH = Path(__file__).resolve().parents[1] / "user_options.json"
|
||||
|
||||
@@ -214,7 +219,7 @@ def apply_user_options(
|
||||
try:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
except (ValueError, OSError) as exc: # malformed JSON or unreadable
|
||||
print(f"[IdentityForge] Ignoring {path.name}: {exc}")
|
||||
_LOG.warning(f"Ignoring {path.name}: {exc}")
|
||||
return 0
|
||||
if not isinstance(data, dict):
|
||||
return 0
|
||||
@@ -229,7 +234,7 @@ def apply_user_options(
|
||||
added += _apply_outfits(outfits, field_definitions, outfit_descriptions)
|
||||
|
||||
if added:
|
||||
print(f"[IdentityForge] Loaded {added} custom option(s) from {path.name}.")
|
||||
_LOG.info(f"Loaded {added} custom option(s) from {path.name}.")
|
||||
return added
|
||||
|
||||
|
||||
@@ -244,7 +249,7 @@ def _load_user_section(path: Path, section: str) -> dict[str, Any]:
|
||||
try:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
except (ValueError, OSError) as exc:
|
||||
print(f"[IdentityForge] Ignoring {path.name}: {exc}")
|
||||
_LOG.warning(f"Ignoring {path.name}: {exc}")
|
||||
return {}
|
||||
block = data.get(section) if isinstance(data, dict) else None
|
||||
return block if isinstance(block, dict) else {}
|
||||
@@ -257,6 +262,24 @@ def _clean_field_map(value: Any) -> dict[str, str]:
|
||||
return {f: v for f, v in value.items() if isinstance(f, str) and isinstance(v, str) and v}
|
||||
|
||||
|
||||
def _clean_preset(value: Any) -> dict[str, Any]:
|
||||
"""An archetype field map: ``{field: text}`` or ``{field: [text, ...]}`` (2.6.0).
|
||||
|
||||
A list is a seed-picked choice, as in the built-ins; non-text entries are dropped.
|
||||
"""
|
||||
if not isinstance(value, dict):
|
||||
return {}
|
||||
out: dict[str, Any] = {}
|
||||
for field, v in value.items():
|
||||
if not isinstance(field, str):
|
||||
continue
|
||||
if isinstance(v, str) and v:
|
||||
out[field] = v
|
||||
elif isinstance(v, list) and (items := [x for x in v if isinstance(x, str) and x]):
|
||||
out[field] = items
|
||||
return out
|
||||
|
||||
|
||||
def apply_user_archetypes(archetypes: dict[str, dict], path: Path | None = None) -> int:
|
||||
"""Merge the ``archetypes`` section of ``user_options.json`` in place.
|
||||
|
||||
@@ -269,15 +292,24 @@ def apply_user_archetypes(archetypes: dict[str, dict], path: Path | None = None)
|
||||
path = path or USER_OPTIONS_PATH
|
||||
added = 0
|
||||
for name, preset in _load_user_section(path, "archetypes").items():
|
||||
if not isinstance(name, str) or not name:
|
||||
if not isinstance(name, str) or not name or not isinstance(preset, dict):
|
||||
continue
|
||||
cleaned = _clean_field_map(preset)
|
||||
cleaned: dict[str, Any] = _clean_preset(preset)
|
||||
variants = preset.get("variants")
|
||||
if isinstance(variants, dict):
|
||||
kept = {g: v for g in ("Female", "Male") if (v := _clean_preset(variants.get(g)))}
|
||||
if kept:
|
||||
cleaned["variants"] = kept
|
||||
if not cleaned:
|
||||
continue
|
||||
dropped = sorted(set(preset) - set(cleaned))
|
||||
if dropped:
|
||||
_LOG.warning("Archetype %r: ignored %s (values must be text, a list of text, "
|
||||
"or a variants block).", name, ", ".join(dropped))
|
||||
archetypes[name] = cleaned
|
||||
added += 1
|
||||
if added:
|
||||
print(f"[IdentityForge] Loaded {added} custom archetype(s) from {path.name}.")
|
||||
_LOG.info(f"Loaded {added} custom archetype(s) from {path.name}.")
|
||||
return added
|
||||
|
||||
|
||||
@@ -320,13 +352,34 @@ def apply_user_creatures(creatures: dict[str, dict], path: Path | None = None) -
|
||||
creatures[name] = record
|
||||
added += 1
|
||||
continue
|
||||
print(f"[IdentityForge] Skipping creature {name!r}: needs class, palette, "
|
||||
_LOG.warning(f"Skipping creature {name!r}: needs class, palette, "
|
||||
f"head, eyes and integument.")
|
||||
if added:
|
||||
print(f"[IdentityForge] Loaded {added} custom creature(s) from {path.name}.")
|
||||
_LOG.info(f"Loaded {added} custom creature(s) from {path.name}.")
|
||||
return added
|
||||
|
||||
|
||||
def _clean_looks(value: Any) -> list[Any]:
|
||||
"""Alternate looks (2.6.0): plain costume strings, or overlay dicts with a costume.
|
||||
|
||||
An overlay may also set the per-look keys the built-ins use (``mask``,
|
||||
``signature``, ``covers_face`` and so on); ``tests/validate_data.py`` reports a
|
||||
key the node does not read.
|
||||
"""
|
||||
if not isinstance(value, list):
|
||||
return []
|
||||
looks: list[Any] = []
|
||||
for look in value:
|
||||
if isinstance(look, str) and look:
|
||||
looks.append(look)
|
||||
elif isinstance(look, dict) and isinstance(look.get("costume"), str) and look["costume"]:
|
||||
overlay = {k: v for k, v in look.items() if isinstance(k, str)}
|
||||
if "signature" in overlay:
|
||||
overlay["signature"] = _clean_field_map(overlay["signature"])
|
||||
looks.append(overlay)
|
||||
return looks
|
||||
|
||||
|
||||
def apply_user_cosplayers(cosplayers: dict[str, dict], path: Path | None = None) -> int:
|
||||
"""Merge the ``cosplayers`` section of ``user_options.json`` in place.
|
||||
|
||||
@@ -366,10 +419,30 @@ def apply_user_cosplayers(cosplayers: dict[str, dict], path: Path | None = None)
|
||||
# Optional free-text keys follow the built-in schema: OMITTED when unused,
|
||||
# never stored as "" (validate_data treats an empty string as an error and
|
||||
# a present-but-empty 'mask' as a mask/covers_face mismatch).
|
||||
for optional_key in ("mask", "prop", "eyes", "skin"):
|
||||
for optional_key in ("mask", "prop", "eyes", "skin", "costume_back"):
|
||||
value = entry.get(optional_key)
|
||||
if isinstance(value, str) and value:
|
||||
record[optional_key] = value
|
||||
# 2.6.0: the lead noun for a non-human head, voiced "a short <subject>", so an
|
||||
# article or trailing full stop the user typed would be doubled; drop them.
|
||||
subject = entry.get("subject")
|
||||
if isinstance(subject, str):
|
||||
words = subject.strip().rstrip(".,").split()
|
||||
if words and words[0].lower() in ("a", "an", "the"):
|
||||
words = words[1:]
|
||||
if words:
|
||||
record["subject"] = " ".join(words)
|
||||
looks = _clean_looks(entry.get("costumes"))
|
||||
if looks:
|
||||
record["costumes"] = looks
|
||||
weights = entry.get("costume_weights")
|
||||
if (isinstance(weights, list) and len(weights) == 1 + len(looks)
|
||||
and all(isinstance(w, (int, float)) and not isinstance(w, bool)
|
||||
and w > 0 for w in weights)):
|
||||
record["costume_weights"] = weights
|
||||
elif weights is not None:
|
||||
_LOG.warning("Cosplayer %r: ignored costume_weights (needs one positive "
|
||||
"number per look: the costume, then each alternate).", name)
|
||||
# Advanced bool flags, likewise omitted unless explicitly true so user
|
||||
# records mirror the built-in shape (built-ins never carry a False flag).
|
||||
for flag in ("covers_body", "covers_hair", "bald", "body_paint"):
|
||||
@@ -378,5 +451,5 @@ def apply_user_cosplayers(cosplayers: dict[str, dict], path: Path | None = None)
|
||||
cosplayers[name] = record
|
||||
added += 1
|
||||
if added:
|
||||
print(f"[IdentityForge] Loaded {added} custom cosplayer(s) from {path.name}.")
|
||||
_LOG.info(f"Loaded {added} custom cosplayer(s) from {path.name}.")
|
||||
return added
|
||||
|
||||
@@ -148,6 +148,8 @@ RELEASES: tuple[str, ...] = (
|
||||
"1.11.0",
|
||||
"2.1.0",
|
||||
"2.2.0",
|
||||
"2.3.0",
|
||||
"2.7.0",
|
||||
)
|
||||
|
||||
#: Entry name -> the release it first shipped in.
|
||||
@@ -197,6 +199,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Aleta Ogord': "0.69.0",
|
||||
'Alice': "0.6.0",
|
||||
'Alice Nakiri': "0.79.0",
|
||||
'Alisa Bosconovitch': "2.7.0",
|
||||
'Alita': "1.8.0",
|
||||
'All Might': "0.7.0",
|
||||
'Allen the Alien': "0.59.0",
|
||||
@@ -330,6 +333,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Beast (X-Men)': "0.71.1",
|
||||
'Beast Boy': "0.17.0",
|
||||
'Beast Man': "0.17.0",
|
||||
'Beatrix (Final Fantasy)': "2.7.0",
|
||||
'Beerus': "0.16.0",
|
||||
'Beetlejuice': "0.76.0",
|
||||
'Bellatrix Lestrange': "0.16.0",
|
||||
@@ -468,8 +472,10 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Catwoman': "0.6.0",
|
||||
'Cecil Harvey': "0.60.0",
|
||||
'Celes Chere': "0.60.0",
|
||||
'Celestia Ludenberg': "2.7.0",
|
||||
'Cell': "0.16.0",
|
||||
'Celty Sturluson': "1.0.0",
|
||||
'Cerebella': "2.7.0",
|
||||
'Cersei Lannister': "0.90.0",
|
||||
'Cervantes de Leon': "0.58.0",
|
||||
'Cetrion': "0.18.0",
|
||||
@@ -495,6 +501,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Chiaki Nanami': "2.1.0",
|
||||
'Chiana': "0.79.0",
|
||||
'Chief Chirpa': "0.20.0",
|
||||
'Chisato Nishikigi': "2.7.0",
|
||||
'Chizuru Mizuhara': "0.77.0",
|
||||
'Chocobo': "0.95.0",
|
||||
'Chopper': "0.21.0",
|
||||
@@ -507,6 +514,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Ciel Phantomhive': "0.87.0",
|
||||
'Cinder': "1.3.0",
|
||||
'Cinderella': "0.6.0",
|
||||
'Cindy Aurum': "2.7.0",
|
||||
'Circe': "0.18.0",
|
||||
'Ciri': "0.6.0",
|
||||
'Claire Redfield': "0.6.0",
|
||||
@@ -662,6 +670,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Dupli-Kate': "0.59.0",
|
||||
'Duros': "0.21.0",
|
||||
'E. Honda': "0.58.0",
|
||||
'EVA (Metal Gear)': "2.7.0",
|
||||
'EVE (Stellar Blade)': "1.4.0",
|
||||
'Eda Clawthorne': "1.0.0",
|
||||
'Edelgard': "2.1.0",
|
||||
@@ -720,6 +729,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Etrigan the Demon': "0.19.0",
|
||||
'Eureka': "1.0.0",
|
||||
'Evelynn': "0.18.0",
|
||||
'Evie Frye': "2.7.0",
|
||||
'Evil Queen': "0.77.0",
|
||||
'Evil-Lyn': "0.71.0",
|
||||
'Eyedol': "1.3.0",
|
||||
@@ -869,6 +879,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Guy Gardner': "0.22.0",
|
||||
'Gwen (League of Legends)': "0.81.0",
|
||||
'Gwen Tennyson': "0.73.1",
|
||||
'Gwenpool': "2.7.0",
|
||||
'Gyarados': "0.95.0",
|
||||
'Gypsy': "0.18.0",
|
||||
'Hades': "0.16.0",
|
||||
@@ -893,6 +904,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Hawks': "0.77.0",
|
||||
'Hayate': "0.69.0",
|
||||
'He-Man': "0.16.0",
|
||||
'Heather Mason': "2.7.0",
|
||||
'Heavy (Team Fortress 2)': "0.88.0",
|
||||
'Hector Barbossa': "0.77.0",
|
||||
'Hector Rivera': "0.87.0",
|
||||
@@ -920,6 +932,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Hit-Girl': "1.0.0",
|
||||
'Hitagi Senjougahara': "0.77.0",
|
||||
'Hitomi': "0.69.0",
|
||||
'Hitori Gotoh': "2.7.0",
|
||||
'Hoggish Greedly': "0.69.0",
|
||||
'Holli Would': "0.69.0",
|
||||
'Holo': "0.76.0",
|
||||
@@ -962,6 +975,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Ino Yamanaka': "0.74.0",
|
||||
'Inosuke Hashibira': "0.16.0",
|
||||
'Inspector Gadget': "0.76.0",
|
||||
'Integra Hellsing': "2.7.0",
|
||||
'Inuyasha': "0.88.0",
|
||||
'Invincible': "0.16.0",
|
||||
'Invisible Woman': "0.6.0",
|
||||
@@ -1056,6 +1070,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Jubilee': "0.7.0",
|
||||
'Judge Anderson': "0.74.0",
|
||||
'Judge Dredd': "0.16.0",
|
||||
'Judith (Tales)': "2.7.0",
|
||||
'Judy Alvarez': "0.88.0",
|
||||
'Judy Hopps': "0.18.0",
|
||||
'Judy Jetson': "0.18.0",
|
||||
@@ -1072,6 +1087,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Jyn Erso': "0.69.0",
|
||||
"K'": "0.61.0",
|
||||
'K-2SO': "0.21.0",
|
||||
'KOS-MOS': "2.7.0",
|
||||
"Ka D'Argo": "0.79.0",
|
||||
'Kabal': "0.74.0",
|
||||
'Kabuki': "1.0.0",
|
||||
@@ -1161,6 +1177,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Krusty the Clown': "0.77.0",
|
||||
'Krystalin': "0.18.0",
|
||||
'Kuiil': "0.21.0",
|
||||
'Kula Diamond': "2.7.0",
|
||||
'Kung Lao': "0.7.0",
|
||||
'Kurapika': "0.87.0",
|
||||
'Kuromi': "2.1.0",
|
||||
@@ -1277,6 +1294,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Lumine': "1.4.0",
|
||||
'Luna (Sailor Moon)': "0.95.0",
|
||||
'Luna Lovegood': "0.16.0",
|
||||
'Lunafreya Nox Fleuret': "2.7.0",
|
||||
'Lune': "1.0.0",
|
||||
'Lurch': "0.59.0",
|
||||
'Lust': "0.18.0",
|
||||
@@ -1411,6 +1429,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Miles Morales': "1.11.0",
|
||||
'Milim Nava': "0.74.0",
|
||||
'Millia Rage': "0.88.0",
|
||||
'Mina Ashido': "2.7.0",
|
||||
'Minato Namikaze': "0.77.0",
|
||||
'Minerva McGonagall': "0.74.0",
|
||||
'Ming the Merciless': "1.1.0",
|
||||
@@ -1422,6 +1441,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Mirabel Madrigal': "0.88.0",
|
||||
'Mirajane Strauss': "0.77.0",
|
||||
'Miranda Lawson': "0.18.0",
|
||||
'Miriam (Bloodstained)': "2.7.0",
|
||||
'Mirko': "1.0.0",
|
||||
'Misa Amane': "0.16.0",
|
||||
'Misaka Mikoto': "1.0.0",
|
||||
@@ -1590,6 +1610,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Panty Anarchy': "1.0.0",
|
||||
'Papa Smurf': "0.55.0",
|
||||
'Papyrus': "0.98.0",
|
||||
'Parasoul': "2.7.0",
|
||||
'Patrick Star': "0.19.0",
|
||||
'Paul Atreides': "0.87.0",
|
||||
'Paul Bunyan': "0.63.0",
|
||||
@@ -1602,6 +1623,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Peggy Carter': "0.76.0",
|
||||
'Pennywise': "0.16.0",
|
||||
'Peridot': "0.76.0",
|
||||
'Perona': "2.7.0",
|
||||
'Peter Griffin': "0.77.0",
|
||||
'Peter Pan': "0.19.0",
|
||||
'Phantom Lady (Dee Tyler)': "0.45.0",
|
||||
@@ -1741,6 +1763,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Rikuo': "0.59.0",
|
||||
'Rin Tohsaka': "0.16.0",
|
||||
'Rindou Kobayashi': "0.79.0",
|
||||
'Rinoa Heartilly': "2.7.0",
|
||||
'Riptide': "0.57.0",
|
||||
'River Tam': "1.0.0",
|
||||
'Rivet': "1.0.0",
|
||||
@@ -1865,6 +1888,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Seong Mi-na': "0.58.0",
|
||||
'Sephiroth': "0.7.0",
|
||||
'Seraphine': "0.77.0",
|
||||
'Seras Victoria': "2.7.0",
|
||||
'Serena': "0.69.0",
|
||||
'Sersi': "0.69.0",
|
||||
'Serval (Kemono Friends)': "2.1.0",
|
||||
@@ -1886,6 +1910,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'She-Hulk': "0.6.0",
|
||||
'She-Ra': "0.16.0",
|
||||
'Sheena': "0.71.0",
|
||||
'Sheena Fujibayashi': "2.7.0",
|
||||
'Sheeva': "0.18.0",
|
||||
'Shego': "0.69.0",
|
||||
'Sheik': "0.16.0",
|
||||
@@ -2058,6 +2083,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'The 50 Foot Woman': "0.18.0",
|
||||
'The Atom': "0.17.0",
|
||||
'The BFG': "0.53.0",
|
||||
'The Boss': "2.7.0",
|
||||
'The Bride (Beatrix Kiddo)': "0.76.0",
|
||||
'The Cat in the Hat': "0.77.0",
|
||||
'The Comedian': "0.43.0",
|
||||
@@ -2116,6 +2142,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Tina Belcher': "0.76.0",
|
||||
'Tinker Bell': "0.6.0",
|
||||
'Tiny Tina': "0.77.0",
|
||||
'Tira': "2.7.0",
|
||||
'Titania': "0.16.0",
|
||||
'Toad': "0.19.0",
|
||||
'Tohka Yatogami': "0.69.0",
|
||||
@@ -2180,6 +2207,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Vegeta': "0.7.0",
|
||||
'Velma Dinkley': "0.6.0",
|
||||
'Velocity': "0.69.0",
|
||||
'Velvet Crowe': "2.7.0",
|
||||
'Venom': "0.7.0",
|
||||
'Venti': "0.16.0",
|
||||
'Venus (Marvel)': "0.77.0",
|
||||
@@ -2251,6 +2279,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Xena': "0.6.0",
|
||||
'Xenomorph': "0.16.0",
|
||||
'Xianghua': "0.58.0",
|
||||
"Y'shtola Rhul": "2.7.0",
|
||||
'Yae Miko': "0.74.0",
|
||||
'Yamada Asaemon Sagiri': "0.73.0",
|
||||
'Yamato (One Piece)': "1.5.0",
|
||||
@@ -2352,6 +2381,7 @@ ADDED_IN: dict[str, dict[str, str]] = {
|
||||
'Astronaut': "0.5.0",
|
||||
'Astronomer': "0.29.0",
|
||||
'Athlete': "0.5.0",
|
||||
'Aztec Noble': "2.3.0",
|
||||
'B-Boy / B-Girl': "0.42.0",
|
||||
'Babushka': "0.42.0",
|
||||
'Backyard Country Casual': "0.35.0",
|
||||
|
||||
+117
-32
@@ -70,7 +70,10 @@ committed docs are stale (suitable for CI / a pre-commit guard).
|
||||
### Sample galleries (`gallery/`)
|
||||
|
||||
Three sibling galleries — `cosplay/`, `archetypes/`, `creatures/` — each publishing a
|
||||
sample render per roster entry to GitHub Pages. Full detail in
|
||||
sample render per roster entry to GitHub Pages, plus `people/` (2.7.0): fixed seeds on the
|
||||
plain node at its defaults, each card showing its seed and prompt. The people samples take
|
||||
no gallery pins (not even the front-facing shot), because a card's seed and gender must
|
||||
reproduce its prompt on a fresh node; pick a seed that draws a usable shot instead. Full detail in
|
||||
[gallery/README.md](../gallery/README.md); the parts that constrain future work:
|
||||
|
||||
- **Images live only on `gh-pages`.** `gallery/.gitignore` blocks `images/` on `main`, so
|
||||
@@ -84,13 +87,16 @@ sample render per roster entry to GitHub Pages. Full detail in
|
||||
- **Publishing uses `git worktree`, not `stash` + `checkout`.** The current working tree
|
||||
is never touched. Deletion requires an explicit `--prune-orphans`, and even then only
|
||||
removes images matching no roster entry at all.
|
||||
- **The three copies are byte-identical outside their docstring and `GALLERY CONFIG`
|
||||
block.** This is copy-and-adapt by design (three independently-published sites, no
|
||||
shared package), so **an improvement to one script must be ported to the other two** —
|
||||
- **The four copies are byte-identical outside their docstring and `GALLERY CONFIG`
|
||||
block.** This is copy-and-adapt by design (independently-published sites, no
|
||||
shared package), so **an improvement to one script must be ported to the others** -
|
||||
`tests/test_gallery.py::CopiesStayInSyncTests` fails until it is. `BatchLauncherTests`
|
||||
guards the `.bat` launchers (every exit pauses, no parenthesised `if` blocks, ASCII
|
||||
only, CRLF via `.gitattributes`).
|
||||
- Adding a fourth gallery is a folder copy plus one config block per file; the checklist
|
||||
- **The page assets are not copies (2.6.0).** `style.css` and `gallery.js` live once in
|
||||
`gallery/shared/`; each page links `../shared/` and every `publish.py` stages that folder
|
||||
to `gh-pages`. Details in gallery/README.md -> "Editing the page files".
|
||||
- Adding another gallery is a folder copy plus one config block per file; the checklist
|
||||
is at the bottom of `gallery/README.md`.
|
||||
|
||||
Pack is **V3 API** (`comfy_api.latest`), category `conditioning/character`, **zero deps**,
|
||||
@@ -217,7 +223,6 @@ and only the first was visible:
|
||||
2. **The identity was not actually fixed.** `index` advances between queues, so a complete set
|
||||
took N queues — and any upstream preset left on `control_after_generate="randomize"`
|
||||
re-rolled the character between them. A "turnaround" of six different people.
|
||||
3. It needed the ComfyUI#11905 NaN signature purely to work around its own `index` widget.
|
||||
|
||||
The rewrite deletes the questions rather than documenting answers, on one line:
|
||||
**Identity Forge owns the character and the scene; the Turnaround owns only the camera.**
|
||||
@@ -233,9 +238,6 @@ The rewrite deletes the questions rather than documenting answers, on one line:
|
||||
negative prompt, model, latent — broadcast off their last element (`slice_dict`). One queue,
|
||||
the whole set, from a single upstream resolution. Which also means an upstream node left on
|
||||
`randomize` is now a *feature*: each queue is one new character × N coherent views.
|
||||
- **No `fingerprint_inputs`.** With no auto-advancing widget and no RNG the node is a pure
|
||||
function of its inputs, so ComfyUI's normal caching is correct — see the counter-example
|
||||
note under "Seeded nodes re-roll every queue".
|
||||
- **`shot_type` is composed, not picked.** That field mixes distance ("full body shot"),
|
||||
orientation ("side profile") and lens in one pool, so a turnaround cannot express both halves
|
||||
by choosing a value. `compose_shot()` emits `"<distance>, <rotation>"`. The free text survives
|
||||
@@ -289,6 +291,55 @@ Two engine-facing traps this rewrite hit, both silent, both now pinned by tests:
|
||||
by the "Auto (preset)" sentinel on the two widgets (see "Vault recall and the control
|
||||
sentinels"); the Turnaround did not wait, because it has no widget to add one to.
|
||||
|
||||
### Sheets that change the person: release, don't override (2.3.0)
|
||||
|
||||
The Turnaround and Expression Sheet override a few fields and replay the rest unchanged. The
|
||||
Outfit Sheet and Age Progression nodes change things other fields depend on (an outfit style
|
||||
gates makeup, jewellery and hair styling; an age gates hair colour, skin detail and some
|
||||
outfits), so overriding alone would replay a value a live rule now excludes, and the engine
|
||||
would log a "keeping lock" conflict. They use **release** instead. The shared helpers live in
|
||||
`nodes/identity_forge_turnaround.py`: `replay_base()` builds the common replay kwargs,
|
||||
`document_fields()` flattens a document, and `release_fields()` drops named fields from the
|
||||
document (and from `_meta.omitted`), so the engine redraws them under the new pin from its
|
||||
fixed replay seed.
|
||||
|
||||
- **What to release is asked, not hard-coded.** For each pin (`outfit_style`, `age`, a framing,
|
||||
a grey hair colour) the node asks `lock_clash(field, value, context)` which kept fields the
|
||||
pin refuses, and releases those. Face and body never clash, so the person stays.
|
||||
- **Outfit Sheet:** releases the whole Clothing group, and with a studio backdrop the scene
|
||||
fields (location, lighting, composition, season; a locked season otherwise clashes with a
|
||||
studio). Makeup, jewellery and hair styling are released per style when that style refuses
|
||||
them (`_RESTYLED`). A style that would refuse anything else is skipped and logged; with the
|
||||
default backdrop that never happened over the test sweep, while "Keep the character's scene"
|
||||
usually keeps 3 to 4 of 6 styles because many places refuse formal or athletic wear.
|
||||
- **Released fields need a per-character seed.** The fixed `_REPLAY_SEED` is right when a
|
||||
replay redraws nothing, but a released field redrawn from a fixed seed lands on the same
|
||||
value for every character: the first draft's per-style seeds gave 40 characters four casual
|
||||
outfits, most of them grey. `character_seed()` hashes the document (plus a salt: the style
|
||||
and the user's `outfit_seed`, or "age"), so a redraw differs between characters and repeats
|
||||
for the same one. Age Progression uses it for the fields an age refuses. A cosplay, a full-body suit or a suppressed
|
||||
Clothing group gives one view, unchanged.
|
||||
- **Age Progression:** only `age` is pinned, so face shape, eye colour, build and the rest stay.
|
||||
Hair greys only for a natural-scope, non-cosplay, uncovered head: a stage past 55 and older
|
||||
than the character turns dark hair salt and pepper (silver from 70), any other colour silver;
|
||||
a grey-haired character shown younger gets a natural colour drawn once at age 20 with hair
|
||||
colour released. A face-covering character, or one with no numeric age, gives one view.
|
||||
- **Every framing pin goes through `pin_framing()` (2.6.0).** It sets `shot_type` and
|
||||
releases what that framing refuses (a standing pose in a close-up), with a per-character
|
||||
`character_seed(..., "framing")`. Before 2.6.0 the Expression Sheet pinned a close-up and
|
||||
released nothing, and the one-view paths of Age Progression and the Outfit Sheet returned
|
||||
before their release step, so a masked or suited character kept a pose its framing
|
||||
excludes. `tests/test_sheet_framing.py` holds all three paths.
|
||||
- **Scene Sheet (2.6.0):** pins `location` per view and releases the scene drawn against the
|
||||
old place (`location_setting`, lighting, composition, season). By default it also releases
|
||||
the Clothing group so each place dresses the person again; "Keep the outfit" keeps it and
|
||||
skips any place that refuses it. A place that refuses pose, gaze, framing or the
|
||||
`_RESTYLED` styling redraws that field for the view (`_RESTAGED`); refusing anything else
|
||||
(age, body, a held item, a pinned framing) skips the place. A cosplay or a full-body suit
|
||||
never has its clothing released. The view seed is `character_seed(doc, "scene|<place>")`.
|
||||
Measured over 60 characters per sheet: dress mode kept every place with no clash; keep
|
||||
mode skipped about 30% of everyday places, mostly the beach and the trail.
|
||||
|
||||
### Vault recall and the control sentinels (1.0.0)
|
||||
|
||||
`wardrobe` and `hair_color_scope` are control fields — they live only in `_meta`, never in
|
||||
@@ -321,12 +372,14 @@ each of these. The Turnaround shipped its first draft missing the last two.
|
||||
3. `scripts/dump_frontend_fixtures.py` — `_NODE_CLASSES`. The fixture is what the jsdom
|
||||
suite builds fake nodes from, so a node absent from that map has **no** frontend
|
||||
coverage and its `--check` gate silently passes forever.
|
||||
4. `fingerprint_inputs` returning NaN **if** any widget sets `control_after_generate` —
|
||||
see "Seeded nodes re-roll every queue" below. The trigger is the auto-advancing
|
||||
widget, not the presence of a seed.
|
||||
5. A tooltip on **every** input. There is no lint for this; the frontend fixture records
|
||||
widget names and defaults, not help text, so only `tests/test_*.py` can hold the line
|
||||
(`test_every_widget_carries_a_tooltip`).
|
||||
4. A tooltip on **every** input and output. There is no lint for this; the frontend fixture
|
||||
records widget names and defaults, not help text. Since 2.6.0
|
||||
`tests/test_node_contracts.py` walks every class in `nodes/` and checks the tooltips, so a
|
||||
new node is covered without being listed. No node needs a cache buster: a seed widget's
|
||||
value is already part of ComfyUI's cache signature (2.7.1).
|
||||
5. An example workflow, if the node is meant to be wired by hand: build it in a real
|
||||
frontend, then `tests/test_example_workflows.py` checks every pack node's
|
||||
`widgets_values` count and combo values against the fixture.
|
||||
|
||||
## fields.py — the field engine
|
||||
|
||||
@@ -959,6 +1012,22 @@ free-form prose (own render path — not validated against human fields). Rules:
|
||||
- **Suppression:** a creature `head` hides human Face/Hair/Makeup; `integument` hides skin
|
||||
fields; `form` (Anthropomorphic/Feral/Subtle) sets group-level suppression. Generalizes the
|
||||
cosplayer `covers_face` mechanism via `_meta.suppress_groups` / `suppress_fields`.
|
||||
- **Anthropomorphic is a clothed hybrid, Feral is the creature itself.** Anthro keeps the
|
||||
outfit and body build, and drops only `fitness_level` (a lifestyle word: "a sedentary
|
||||
nautilus"). For classes in `_BODY_DEFINED_CLASSES` (Monsters, Aliens), whose anatomy
|
||||
slots already describe a whole person-shaped body, Anthro also drops the human
|
||||
proportions (bust, waist, hips, shoulders, neck) and the lead noun is "humanoid
|
||||
skeleton", not "anthropomorphic skeleton hybrid": "hybrid" read as a human with
|
||||
skeleton traits and rendered a person in a windbreaker (2.4.0). Suppression pops fields
|
||||
after the draw, so no seed moves; only prose changes.
|
||||
- **A creature's `anthro` block rewrites it for the Anthropomorphic form.** Some animals
|
||||
render whole beside a person in Anthro form (a stegosaurus with forelegs and hind legs,
|
||||
a nautilus shell, a gas cloud). An optional `anthro` dict in the entry gives
|
||||
replacement slot text for that form only (`""` drops a slot), plus an optional
|
||||
`subject` lead noun ("scaly reptilian humanoid"), carried in `_meta.anthro_subject` so
|
||||
recall keeps it. Feral and Subtle use the normal slots. The text swap happens where a
|
||||
slot is read, so it adds no draw. Prefer naming body parts on a person-shaped body over
|
||||
naming the whole animal; the Krea2T Enhancer in the gallery pipeline does the rest.
|
||||
|
||||
## Extending at runtime — user_options.json
|
||||
|
||||
@@ -1105,6 +1174,12 @@ never a guessed default, and **never a substring match on a model name**: the si
|
||||
merge, plausible enough that nobody noticed until it was published. Preflight checks every
|
||||
model, `sampler_name` and `scheduler` against live `/object_info` before the first queue.
|
||||
|
||||
An optional `enhancer_text_scale` in `render_config.json` (0 = off) puts the
|
||||
`Krea2T-Enhancer-Advanced` node (ComfyUI-Krea2T-Enhancer) between the LoRA and the sampler;
|
||||
preflight checks the node is installed. At 1.5 it stopped the turbo model drawing a
|
||||
skeleton, golem or mole as a plain person (2.4.0); the setting is recorded in each
|
||||
manifest entry's `render` record.
|
||||
|
||||
**Render settings are excluded from the entry hash, on purpose.** Stylebook folds its render
|
||||
settings into each tile's hash, which is right there because every tile was produced under
|
||||
recorded settings. Here, ~2,150 images predate this pipeline and were rendered by hand under
|
||||
@@ -2554,16 +2629,6 @@ README gets a short "Using with Stylebook" section mirroring Stylebook's own, an
|
||||
Full preset comes out in tennis whites with a human tone, losing the green. To **layer** a tilt
|
||||
onto a cosplay instead of overwriting it, set the archetype (or cosplayer) to **Essentials** so it
|
||||
emits only the look groups and leaves the rest to flow through.
|
||||
- **Every node with an auto-advancing widget re-executes each queue via `fingerprint_inputs`.**
|
||||
`IdentityForge`, `Archetype`, `Cosplayer` and `Creature` return `float("nan")` from
|
||||
`fingerprint_inputs`, forcing ComfyUI to re-execute them -- otherwise a widget advanced by
|
||||
`control_after_generate` can be served from cache and the output "sticks" (ComfyUI#11905).
|
||||
The trigger is the auto-advancing widget, not the seed as such. Pure cache control (no RNG):
|
||||
a *fixed* seed still reproduces exactly, and identical output keeps expensive downstream nodes
|
||||
cached. **The Turnaround is the counter-example and stays one:** it carries no
|
||||
`control_after_generate` widget and no RNG, so it is a pure function of its inputs and
|
||||
ComfyUI's normal caching is correct for it. It had the NaN signature at 0.98.0 only because
|
||||
its `index` combo auto-advanced; 0.99.0 deleted the widget, so the workaround went with it.
|
||||
- Adding RNG draws in the creature node mid-sequence shifts seed→creature mapping — append draws
|
||||
at the end.
|
||||
- The roster is large (~1300 cosplayers across ~263 franchises, ~195 creatures): always grep
|
||||
@@ -3453,13 +3518,6 @@ that relaxation. This means `random_pool` **stacks** with `random_scope` — "Fr
|
||||
"Mascot suits and beasts only" is a real, correctly-intersected query, not two competing filters
|
||||
that only one of which can win.
|
||||
|
||||
**`fingerprint_inputs` needed no change.** This node's `fingerprint_inputs` already ignores every
|
||||
kwarg and unconditionally returns `float("nan")` — a pre-existing workaround for
|
||||
ComfyUI#11905 that forces a re-roll on every queue regardless of any single field's value. Since
|
||||
caching is already bypassed for every input, there is nothing to add for `random_pool`
|
||||
specifically; the code documents this in a comment rather than a no-op kwargs read that would
|
||||
otherwise look like an oversight to a future reader.
|
||||
|
||||
`_announce_scope` folds `pool` into its cache key and message text, but the default pool
|
||||
(`All characters`) omits the note entirely, so a pre-1.1.0 announcement string is unchanged
|
||||
byte-for-byte — the new widget is additive to the message surface, never a rewording of it.
|
||||
@@ -3529,6 +3587,33 @@ caught and fixed during this task's review rounds. `<img>` tags lazy-load via
|
||||
lazy-load pattern, so opening the dialog with previews on does not eagerly fetch hundreds of
|
||||
images at once.
|
||||
|
||||
**Superseded in 2.3.0: previews go through a server-side cache.** ComfyUI's `--offline` flag adds
|
||||
a Content-Security-Policy (`img-src 'self' data: blob:; connect-src 'self' ...`) that blocks the
|
||||
browser from reaching github.io at all, so the direct fetch above showed nothing for those users.
|
||||
The picker now asks its own ComfyUI origin (`/identity_forge/gallery/<folder>/manifest.json` and
|
||||
`/identity_forge/gallery/<folder>/images/...`, via `api.apiURL`), and `nodes/gallery_cache.py`
|
||||
fetches from `gh-pages` server-side and keeps the files under ComfyUI's user directory
|
||||
(`identity_forge/gallery_cache/`). The CSP binds only the browser, so the server fetch is allowed.
|
||||
Rules that keep it safe and small:
|
||||
|
||||
- **Only what is viewed is stored.** Images are fetched one at a time as the picker lazy-loads
|
||||
them; nothing is prefetched. The whole gallery is a few hundred MiB, a typical session a few MiB.
|
||||
- **Only manifest-listed paths are fetched,** always from the one fixed gh-pages root, and the
|
||||
resolved cache path must stay inside the cache folder. The kind is an allowlist. So a request
|
||||
can never make the server fetch an arbitrary URL or write outside its folder.
|
||||
- **Freshness:** the manifest is reused for 10 minutes, an image for 7 days, then revalidated
|
||||
with the stored ETag (a 304 just renews the file's mtime). Filenames are stable across
|
||||
re-renders, so a re-rendered image arrives on its next revalidation.
|
||||
- **Offline fallback:** any network failure serves the cached copy; with nothing cached the
|
||||
route returns 404 and the picker falls back to text-only, as before.
|
||||
- **Size caps and type checks:** a manifest must parse as JSON with an `entries` list, an image
|
||||
must come back as `image/*`, and each has a byte limit. Writes are atomic.
|
||||
- **Clear cached previews** in the picker POSTs `/identity_forge/gallery/cache/clear` (a JSON
|
||||
body is required, the same CSRF guard as the other POST routes) and reports the size freed.
|
||||
|
||||
The server-side fetch does mean the pack contacts github.io even under `--offline` once a user
|
||||
ticks "Show preview images"; the picker's notice says so, and the checkbox stays off by default.
|
||||
|
||||
**Two Critical bugs surfaced only by live testing**, not by the automated jsdom suite (documented
|
||||
at length in the task's own reports; named here because they shaped what shipped): the trigger
|
||||
button was fully clickable while its node was still an unplaced LiteGraph "ghost" (Escape then
|
||||
|
||||
@@ -101,7 +101,11 @@ cosplayer + an integument creature drop both the face and the skin).
|
||||
|
||||
3. **Render quality varies by model.** Anthropomorphic and hybrid forms are harder for
|
||||
some checkpoints than realistic humans. Lean on a checkpoint that knows the
|
||||
creature, and use `form`/`palette` to steer.
|
||||
creature, and use `form`/`palette` to steer. On Krea2 with a turbo LoRA, the
|
||||
Krea2T Enhancer node (text_scale around 1.5) between the LoRA and the sampler made
|
||||
the model draw the creature instead of a person in clothes. A few non-humanoid
|
||||
animals carry their own Anthropomorphic wording so they render as one figure
|
||||
rather than a person beside the whole animal.
|
||||
|
||||
4. **Feral form vs a wired costume.** Feral drops Clothing, so a costume wired in front
|
||||
of a feral creature is intentionally discarded (a feral dragon is not wearing a
|
||||
|
||||
+396
@@ -1486,3 +1486,399 @@ lacked, because the model only draws what the prose says:
|
||||
manifest): the biomechanical alien ("biomechanical" is a Giger style token and restyled
|
||||
a gilded palace around it), the ocean sunfish (drew a woman holding a fish) and the
|
||||
crystalline alien (a hoodie hid the translucent body).
|
||||
|
||||
## 2.3.0 - offline picker previews, Outfit Sheet, Age Progression, Aztec Noble, more back views
|
||||
|
||||
**Picker previews survive `--offline`.** ComfyUI's `--offline` adds a CSP that blocks the
|
||||
browser from fetching github.io, so the picker's thumbnails silently showed nothing. Checked in
|
||||
ComfyUI's `server.py`: the policy is a response header, so it binds the browser only. The pack's
|
||||
server now fetches the manifest and images and serves them from ComfyUI's own origin, caching
|
||||
them under the user directory. Measured before choosing the design: the published galleries
|
||||
total a few hundred MiB (about 100 KiB an image), so the cache is lazy, never a full mirror;
|
||||
GitHub Pages returns ETags and honours `If-None-Match`, and image filenames are stable across
|
||||
re-renders, so revalidation is cheap. Verified on an isolated ComfyUI started with `--offline`:
|
||||
a direct github.io fetch was blocked, the cached routes served the manifest and a JPEG, and
|
||||
unlisted, traversal and unknown-kind paths returned 404. Design and safety rules:
|
||||
architecture.md -> "Superseded in 2.3.0: previews go through a server-side cache".
|
||||
|
||||
**Outfit Sheet and Age Progression.** Both replay a resolved `prompt_json` like the Turnaround,
|
||||
but they change fields other fields depend on. The first Outfit Sheet draft overrode only the
|
||||
Clothing group and skipped nearly every style: makeup, jewellery and hair accessories are
|
||||
style-gated, so a casual look's ponytail or a formal look's earrings refused the next style.
|
||||
Overriding is the wrong tool; the nodes now ask `lock_clash` what each pin refuses and release
|
||||
those fields for a redraw (architecture.md -> "Sheets that change the person"). Three more
|
||||
conflict sources turned up in seed sweeps and are covered the same way: a locked season under
|
||||
a studio backdrop, a close-up framing against a locked composition or pose, and pinned grey hair
|
||||
against locked highlights. A 20-year-old also briefly gained laugh lines, because the natural
|
||||
hair colour was drawn from a replay that kept the old skin detail; both paths now share one
|
||||
helper. Final sweep: every studio-backdrop sheet and every age sheet kept all its views with no
|
||||
engine conflicts; keep-scene sheets usually keep 3 to 4 of 6 styles, by design. The first
|
||||
example render looked grey in four of six outfits: each style replayed with one fixed seed, so
|
||||
every character drew the same few outfits per style (40 characters, four casual looks). The
|
||||
seed now hashes the character, and an `outfit_seed` input re-dresses the same person; measured
|
||||
after, 36 to 40 distinct outfits per style over 40 characters and a grey share matching plain
|
||||
random characters.
|
||||
|
||||
**Period archetypes.** Edo, Victorian and Regency were proposed and dropped: Samurai, Geisha,
|
||||
Victorian Lady, Victorian Dandy and Regency Aristocrat already ship. Silk Road was declined as a
|
||||
blend of Mongolian Deel, Ottoman Court and Hanfu. Aztec Noble is new (Codex Mendoza and
|
||||
Florentine Codex dress: huipil and cueitl, or tilmatli and maxtlatl with a quetzal headdress).
|
||||
|
||||
**Gallery samples.** The first Aztec Noble tile, rendered at the gallery's default
|
||||
`Essentials` lock level, drew a random ethnicity; the look needs `Full preset`, now a per-entry
|
||||
gallery pin (`_GALLERY_LOCK_LEVEL` in `scripts/render_gallery.py`). The Ancient Roman Patrician
|
||||
sample is pinned Male (the toga is the expected look; the node still offers both). Example
|
||||
workflows for the two new nodes ship in `example_workflows/`, built in the real frontend on an
|
||||
isolated instance and reloaded to confirm what they execute. `--publish-pending` ignored
|
||||
`--dry-run` and pushed; it now only lists what it would publish.
|
||||
|
||||
**More `costume_back` entries,** starting with caped and back-emblem heroes (Survey Corps
|
||||
wings, Gotei 13 captains' haori, capes for Thor, Doctor Strange, Shazam, Supergirl, Robin,
|
||||
Saitama and Vision, plus suit backs for Captain Marvel and Green Lantern). Each is checked by
|
||||
rendering the Turnaround's back view text, never by parsing the front costume. Test renders of
|
||||
six back views (Thor, Doctor Strange, Saitama, Levi, Byakuya, Superman) showed the cape or back
|
||||
emblem and no chest emblem; Byakuya's kanji is not the right glyph (a model text limit).
|
||||
|
||||
Random characters are unchanged: no field pool, weight or draw order moved (verified by hashing
|
||||
the prose of several hundred seeds before and after, and the Turnaround and Expression Sheet
|
||||
output over the shared-helper refactor). The Archetype node's `Random` pick moves on some seeds,
|
||||
as with every archetype addition, because it chooses from a longer list.
|
||||
|
||||
## 2.4.0 - archetype scene coherence, creatures as one hybrid, gallery render fixes
|
||||
|
||||
**Figure Skater was set off the ice.** It locked "roller skating rink" or "dance studio with
|
||||
mirrors", so a skater in blades stood among mirrors and barres, sometimes on a wood floor. It
|
||||
now locks "indoor ice rink". Its pose was never locked, so the random pool drew "walking
|
||||
mid-stride" on blades; it now locks four standing poses. Hockey Goalie and Roller Derby (also
|
||||
on blades or wheels) got the same treatment. A pose lock is Setting & Shot, so it holds in
|
||||
Essentials as well as Full preset. Both rinks already ban floor poses (kneel, crouch, sit), so
|
||||
"crouching low" could never draw there and is not in the lists.
|
||||
|
||||
**The goalie rendered in black and white.** Its pads drew from `{color}` and its jersey named
|
||||
no colour; a charcoal draw on white ice under cool LED light left nothing colourful in the
|
||||
prompt, and the model went monochrome. Pads and jersey now share one `{team_color}` draw.
|
||||
|
||||
**More pose locks.** Carhop skates the order out, so motion stays, but the drive-in lot does
|
||||
not ban floor poses: it now locks two posed and two mid-step poses. Scuba Diver wears fins, so
|
||||
standing poses only. Samurai drew lounging, wall-leaning and hair-touching poses in armour and
|
||||
a horned helm; it now locks warrior stances and seiza, and moved from a photo studio (with
|
||||
three-point lighting) to the Mount Fuji foothills in overcast daylight.
|
||||
|
||||
**Nothing to lean on in an open landscape.** A new rule drops the whole `leaning` and
|
||||
`seated_perch` pose families at a curated list of open places (beach, dunes, meadow, moor,
|
||||
fields, salt flats, savanna, frozen lake, the Fuji foothills and similar). Places with rails,
|
||||
rocks or benches (piers, canyons, parks, the lighthouse) are left out. Whole families only, so
|
||||
the marginals baseline holds; random seeds that land in one of those places draw a new pose
|
||||
(the pool shrinks before the draw), everything else is unchanged.
|
||||
|
||||
**A man keeps a locked eyeliner.** Emo, Indie Sleaze and 1980s New Wave lock eyeliner, but a
|
||||
man's "no makeup" default hid it. The engine now voices a LOCKED `eye_makeup` or `eyeliner`
|
||||
on a bare face (`_BARE_FACE_KEEPS`); lips, blush and contour stay hidden, and random men lock
|
||||
nothing, so their prose is unchanged. Done in the engine, not the data: a Male-variant
|
||||
`makeup_style` lock clashed with the archetype's own presentation gate.
|
||||
|
||||
**1980s New Wave women drew a 1950s face.** The Female variant locked no `makeup_style`, so a
|
||||
random "pin-up" could draw beside the 80s hair and eyeliner. It now picks bold glam or
|
||||
editorial makeup.
|
||||
|
||||
**Four new venues.** "wrestling ring under arena lights" (leisure_fitness; stage, studio-lit
|
||||
and venue-light allowlists so Pro Wrestler's locked spotlight holds), "outdoor tennis court
|
||||
with a net" and "racetrack pit lane" (urban_outdoor, no floor poses) and "racecourse paddock
|
||||
with a white rail" (nature_outdoor, race-day dress allowed). Pro Wrestler and Luchador left
|
||||
the school gym, Tennis Player the city park, Race Car Driver the parking garage (lighting to
|
||||
midday sun), Jockey the meadow. A family-weighted add only re-splits its family, so overall
|
||||
location shares hold; seeds inside those three families can land on a different place.
|
||||
|
||||
**A furnished interior is not a backdrop.** "the subject small against open negative space"
|
||||
is the seamless-sweep look, and indoors the model dropped the room for it: 1980s New Wave and
|
||||
Indie Sleaze both rendered a nightclub as a blank wall. It is now excluded at every interior
|
||||
except the photography studio; it falls from about 11% to under 3% of random characters and
|
||||
stays at outdoor places and backdrops. The engine filters the pool before drawing, so every
|
||||
indoor composition draw re-indexes, not only the excluded one.
|
||||
|
||||
**Indie Sleaze men read as drag.** Its four costumes were unisex (`_COSTUMES`), so a man drew
|
||||
the metallic disco bodysuit with opaque tights, plus the locked smoky eyeshadow. The costumes
|
||||
moved into variants (men get the three jeans-and-jacket looks) and the eyeshadow is hers only;
|
||||
he keeps the smudged liner.
|
||||
|
||||
**Gallery samples.** Maasai, Tuareg and Sami Gakti render at Full preset, like Aztec Noble:
|
||||
at Essentials their sample drew a German woman, a Chinese man and so on. The node is
|
||||
unchanged (ethnicity locks only at Full preset, 1.8.0). Silver Surfer's sample is pinned
|
||||
standing; seated, the board fused into his shoulder. Ahsoka Tano's is pinned standing too;
|
||||
seated with two sabers, she drew a third hand. Sabrina Spellman's costume now names
|
||||
colours; with none, a midday render came back black and white (the goalie cause).
|
||||
|
||||
**Location vs `outfit_style` clashes: audited, left alone.** Many archetypes lock a
|
||||
location whose style rule refuses their own locked style (Bridal Portrait in a chapel, Opera
|
||||
Singer at an amphitheater). Both locks are kept, so the prompt and image are unaffected; the
|
||||
only symptom is an INFO log line. Most pairings are true to life and the style rule is aimed
|
||||
at random people, so neither side was changed.
|
||||
|
||||
**Gallery cost.** Of the tiles these changes touched, those that lost the blank-backdrop
|
||||
composition or changed location were re-rendered; tiles whose only change was one harmless
|
||||
composition swapping for another were accepted with `--rehash`.
|
||||
|
||||
**Yoda drew a man under the robe.** The entry had no `covers_face`, so at Full character
|
||||
the node filled a random human face, hair and beard, and human hands. He now takes Grogu's
|
||||
treatment: `covers_face` + `covers_body`, a `mask` for the head (worded "a smooth wrinkled
|
||||
chin", since "no beard" summons one), the all-over green skin marker, and a `subject` so
|
||||
the lead reads "a wizened green alien Jedi Master" instead of "a man". A scan of unmasked
|
||||
entries whose costume names an alien head found two more drawing random hair: Ahsoka Tano
|
||||
(over her montrals) and Piccolo (hair and stubble). Both now set `bald: True`, which clears
|
||||
scalp and facial hair. The rest of that scan already suppress hair or are human-faced.
|
||||
|
||||
**A prop in each hand leaves no free hand.** A held prop already dropped the two-handed
|
||||
poses, on the reading that the free hand holds it, but a dual prop ("one in each hand",
|
||||
"in the other") left one-handed poses in: Star-Lord "adjusting one cuff" with a blaster in
|
||||
each hand drew a third hand. `ONE_HAND_POSES` now drops too when the prop text says both
|
||||
hands are full. Only cosplay renders with the prop switched on move.
|
||||
|
||||
**Render fixes from the gallery review.** Bayonetta's prop was "four handguns, one in each
|
||||
hand" (two of the four are on her heels in canon) and drew a fan of guns and half-arms; it
|
||||
is a pair now. Bane's "tactical vest" drew a modern plate carrier on an average man: he is
|
||||
hulking, in a white-trimmed luchador mask, with the Venom tubes routed down the arm, since
|
||||
"into the back of the head" never rendered. The Imperial Royal Guard drew bare human hands
|
||||
and a random man's skin: it gains crimson gloves and `covers_body`. The Praetorian Guard
|
||||
showed skin between plates and an open-faced helmet: a full undersuit and an enclosed
|
||||
helmet. Bayonetta and the Praetorian are pinned standing in the gallery, like Ahsoka.
|
||||
An "empty scabbard" in a `prop_costume` renders as a sheathed sword beside the drawn one
|
||||
(Yamada Asaemon Sagiri held two), so Sagiri's and Kirito's prop looks drop the scabbard
|
||||
rather than describe it as empty. Roronoa Zoro's three swords are canon (Santoryu), but his
|
||||
text named only the sash, bandana and earrings, so he rendered shirtless: it now names the
|
||||
white T-shirt, black trousers and boots. Kirito's twin swords drew in one hand: they are
|
||||
"one in each hand" now, and he and Zoro are pinned standing (seated, the drawn sword went to
|
||||
the floor). Blue Beetle (Jaime Reyes) drew a random muscular man's bare arms and mouth under
|
||||
foam armor: he gains `covers_body`, an enclosed helmet, the scarab pack with its legs over
|
||||
the shoulders, and a lean build. Three more drew a random man under the costume: The
|
||||
Spectre (bare-chested in trunks; his white is a bodysuit, and his face is now a chalk-white
|
||||
mask under the hood), Bib Fortuna (now `covers_face` with a Twi'lek head and a `subject`),
|
||||
and the TIE Pilot (open helmet and bare hands; now an enclosed helmet, gloves and
|
||||
`covers_body`). Zoro holding his sword reads as three swords with two more at the hip, so
|
||||
his prop look drops the sheathed pair.
|
||||
|
||||
A second review round: X-23 is recoloured to canon (jet black hair, pale skin) and her
|
||||
claws lead the costume, two per fist, since a trailing clause never rendered. Baraka drew
|
||||
a human face and hand-held swords: he is `covers_face` with a Tarkatan head, a `subject`,
|
||||
and blades that grow out of the forearms. Maz Kanata unmasked drew a random woman: her
|
||||
alien face is a mask now, with a `subject`. Black Panther's "panther mask" drew a bare
|
||||
face: an enclosed helmet, gloves and `covers_body`. King Dedede's mallet is held in both
|
||||
hands (one hand drew a third arm). Krusty's red nose and The Spectre's neck are named
|
||||
where they render. Rosie's "single caster in place of legs" drew legs: her base is
|
||||
described as the cone skirt on wheels it is. The Praetorian and Imperial Royal Guard
|
||||
helmets still drew an open face: the Praetorian's names a solid faceplate, and the Royal
|
||||
Guard needed a `subject` ("faceless crimson-helmeted guard") before the helmet closed.
|
||||
A third round: the TIE Pilot's face still showed between lenses and mask, fixed the same
|
||||
way; the Praetorian drew bare hands under its gauntlets and gains `covers_body`; Baraka's
|
||||
blades, named last, drew short knives behind the arms, so they lead the costume now.
|
||||
Bayonetta drew a curly bob in a sleeveless leotard: rebuilt from her first-game look
|
||||
(beehive, butterfly-wing glasses, full catsuit, white gloves, Umbra Watch). Her hair in
|
||||
the costume's opening words went grey and read as something she "wears"; named last as
|
||||
"a beehive of hair", the way Marge Simpson's is, it came out black.
|
||||
|
||||
**Creatures rendered as people in clothes.** On the turbo Krea2 setup the anthro creature
|
||||
tiles drew a person with a skeleton print, a mole nose, or a whole animal standing beside
|
||||
them. Anthropomorphic is meant to stay a clothed hybrid, so nothing is stripped;
|
||||
three things changed instead. Monsters and Aliens lead with "humanoid skeleton", not
|
||||
"anthropomorphic skeleton hybrid", and drop the human proportions their slots already
|
||||
replace; every Anthro creature drops `fitness_level` ("a sedentary nautilus"). The gallery
|
||||
renderer gained the optional Krea2T Enhancer (text_scale 1.5), which fixed the skeleton,
|
||||
flesh golem and mole outright. Prompt rewording, the LoRA at half strength, more steps and
|
||||
a higher cfg made no difference. A few animals still rendered whole beside a person, so a
|
||||
creature entry may carry an `anthro` block: replacement slot text for that form, plus a
|
||||
lead noun. Nautilus (a shell-shaped head), gaseous alien ("humanoid figure made entirely
|
||||
of glowing gas") and stegosaurus ("scaly reptilian humanoid") now render as one figure;
|
||||
the cicada is one figure with its wings behind, though its head and legs still dominate.
|
||||
Jiangshi, the ghost (two arms, not three) and the gaseous alien's arms were reworded too.
|
||||
|
||||
**Locations written before a better one existed.** Audited every archetype's locked location
|
||||
against the current pool. Moved where a matching place now exists and the engine reports no new
|
||||
conflict: Swashbuckling Pirate (cocktail lounge to a harbour, lighting candlelight to golden
|
||||
hour), Gladiator (museum gallery to the Colosseum exterior, lighting to midday sun), Chef
|
||||
(home kitchen to commercial kitchen), Veterinarian (doctor's room to a veterinary exam room),
|
||||
Boxer (weight room to a boxing gym), Glassblower and Dwarven Blacksmith (factory floor to their
|
||||
own studio and forge), Florist, Potter, Tailor, Martial Artist and Kendo Practitioner (to a
|
||||
flower shop, ceramics studio, tailor's workroom and dojo). Egyptian Pharaoh stays in the museum
|
||||
hall: the Giza plateau adds clashes with its locked spotlight and evening-formal style.
|
||||
|
||||
Random characters move through the open-landscape pose rule, the indoor composition rule and
|
||||
the new venues; the marginals baseline was rewritten for those three.
|
||||
|
||||
## 2.5.0 - picker search
|
||||
|
||||
**Substring search was noisy.** "bow" matched every "elbow-length" glove and "rainbow", "hat"
|
||||
matched "that", "red" matched "layered". Tokens now match from a word's start (a name still
|
||||
matches anywhere). Measured on the roster: "bow" 167 to 111 entries, "hat" 224 to 149, "red"
|
||||
1378 to 770. Word-start alone lost real compounds ("suit" missed 235 "bodysuit" entries,
|
||||
"sword" missed longswords), so `SEARCH_ALSO` lists the compounds the roster actually uses, plus
|
||||
a few synonyms (pants/trousers, gray/grey). One-way on purpose, so a specific word stays
|
||||
specific. A matcher on word endings was rejected: it brought "necklace" for "lace", "earring"
|
||||
for "ring" and "ponytail" for "tail".
|
||||
|
||||
**Accents fold** on both sides (Unicode NFD, plus a few letters NFD keeps, such as ø and ß), so a plain US keyboard finds Día de los Muertos.
|
||||
|
||||
**Description text that was not searched:** `eyes`, the alternate looks in `costumes`,
|
||||
`subject`, `skin`, `costume_back`, `prop_costume` and `anatomy` now go into the roster index.
|
||||
|
||||
**The franchise dropdown** was a native select of hundreds of names that only jumped by first
|
||||
letter. It is a type-to-filter box with the franchises as suggestions. It and the trait facet
|
||||
only match cosplayers, so the Archetype and Creature pickers no longer show them (nor gender on
|
||||
Creature, whose entries have none).
|
||||
|
||||
**Lost place after a pick.** Reopening rebuilt the grid at the top. It now scrolls to, and
|
||||
outlines, the entry the node holds.
|
||||
|
||||
**Queue each** queues one run per matching entry through `app.queuePrompt`, setting the widget
|
||||
before each call and restoring the pick after. It shows only while filtering, so the whole
|
||||
roster cannot be queued by accident, and asks for confirmation with the count.
|
||||
|
||||
Frontend only plus the generated roster index: no schema, data or seed change.
|
||||
|
||||
## 2.6.0 - audit fixes, Scene Sheet, picker stars, random vault pick
|
||||
|
||||
**Framing pins replayed clashes.** The Expression Sheet pinned a close-up and kept the
|
||||
character's own pose ("standing with arms crossed" in a head-and-shoulders view), and the
|
||||
one-view paths of Age Progression and the Outfit Sheet returned before releasing anything.
|
||||
Measured before the fix: 314 of 400 expression views and 200 of 300 one-view replays voiced a
|
||||
value the framing refuses. `pin_framing()` now does it for every sheet; 0 after.
|
||||
|
||||
**The Outfit Sheet never busted the cache.** Its `outfit_seed` auto-advances, which is the
|
||||
ComfyUI#11905 case, but it had no `fingerprint_inputs`. Fixed, and
|
||||
`tests/test_node_contracts.py` now walks every node class for this and for tooltips on every
|
||||
input and output (the main node and the preset outputs had none).
|
||||
|
||||
**User presets lost data.** A user archetype dropped list values and `variants`; a user
|
||||
cosplayer dropped `costumes`, `costume_weights`, `costume_back` and `subject`. All are kept
|
||||
now (weights only when they fit the look count), and anything ignored is logged by key
|
||||
instead of vanishing. `data/user_options.py` logs instead of printing.
|
||||
|
||||
**Smaller fixes.** The gallery cache retried the network on every request once offline with
|
||||
a stale copy (it now backs off by touching the copy) and accepted any `image/*` (now raster
|
||||
only, so no SVG). The roll route returned a 500 on a numeric widget value. A case-only vault
|
||||
rename was a no-op on Windows, and the 120-character name cut could leave a trailing dot. The
|
||||
three galleries' `style.css` and `gallery.js` copies are one set in `gallery/shared/`. Ruff is
|
||||
pinned in `pyproject.toml` to the CI version, and the example workflows are checked against
|
||||
the node schemas.
|
||||
|
||||
**Additions.** The Scene Sheet node (one person in several places, dressed for each by
|
||||
default; see architecture.md -> "Sheets that change the person"), starred favourites in the
|
||||
picker, a seeded `(random saved character)` on Vault Load, and example workflows for the
|
||||
Turnaround, Expression Sheet and Scene Sheet (derived from the Outfit Sheet one and
|
||||
re-serialized by a real frontend).
|
||||
|
||||
Random characters unchanged: no data or engine draw changed.
|
||||
|
||||
## 2.6.1 - Registry description length
|
||||
|
||||
2.6.0 merged and tagged but never reached the Comfy Registry: naming the Scene Sheet in
|
||||
the `pyproject.toml` description took it past the Registry's 1000-character limit, and
|
||||
the publish run failed with `400 description is too long` (CI on `main` was green, so
|
||||
nothing earlier caught it). The description is trimmed, and
|
||||
`AdvertisedCharacterCountTests.test_registry_description_fits` now fails CI before a
|
||||
merge instead. 2.6.1 is the first Registry release carrying the 2.6.0 changes.
|
||||
|
||||
## 2.7.0 - a roster batch, Sheena's three looks, and a people gallery
|
||||
|
||||
**The batch.** A candidate list was compared against the
|
||||
roster by name and franchise. Most of it was gacha and deep-cut entries, or classes the
|
||||
backlog already closes; the shortlist that passed the iconic-and-specific bar shipped:
|
||||
Sheena Fujibayashi, Velvet Crowe, Judith (Tales series), Seras Victoria and Integra
|
||||
Hellsing, Rinoa Heartilly, Y'shtola Rhul, Lunafreya, Cindy Aurum, The Boss and EVA (Metal
|
||||
Gear), KOS-MOS, Perona, Celestia Ludenberg, Hitori Gotoh, Chisato Nishikigi, Tira,
|
||||
Gwenpool and Heather Mason. Visual canon came from Danbooru tag co-occurrence
|
||||
(`related_tag` / `counts`), not memory.
|
||||
|
||||
**Sheena's default kimono is purple, not blue.** The supplied outfit tags said "blue
|
||||
kimono"; Danbooru has the purple tag on her posts and the blue one on none, so the entry
|
||||
follows the posts. Her two alternates are her other title looks: the red beach swimsuit (a
|
||||
string alternate) and the purple harem outfit with the short braided-bun hair (a dict
|
||||
alternate that also moves the hair).
|
||||
|
||||
**Eight more after a canon check.** Kula Diamond, Parasoul, Cerebella, Miriam
|
||||
(Bloodstained), Mina Ashido (hero costume), Alisa Bosconovitch, Beatrix (Final Fantasy) and
|
||||
Evie Frye were held for the maintainer's descriptions, then cross-checked against Danbooru
|
||||
before shipping. The descriptions were wrong in places the tags settle: Parasoul wears a
|
||||
black turtleneck sweater dress and a cross necklace (not a military minidress) and her eyes
|
||||
are tagged yellow over red; Miriam has short dark hair (no braids); Cerebella has dark skin,
|
||||
teal hair and argyle stockings; Kula's bodysuit is purple under a red cropped jacket and
|
||||
chaps. Evie Frye has almost no tagged art, so her entry follows the description. Cerebella's
|
||||
aqua lipstick was dropped because no `lips_makeup` value carries it and a costume clause
|
||||
would contradict the random lip colour. Her living hat's arms did not render at the
|
||||
gallery's enhancer text_scale 1.5 or at 3.0; the 3.0 tile (dark skull hat, harlequin
|
||||
diamonds) is the one kept, and the arms are left as a model limit.
|
||||
|
||||
**No tobacco or drugs.** Integra Hellsing's first tile showed her canonical cigar, which
|
||||
breaks the maintainer's standing rule. Her prop is gone, Popeye's corncob pipe became an
|
||||
open can of spinach and Sherlock Holmes' calabash pipe a brass magnifying glass, and
|
||||
`tests/validate_data.py` now rejects tobacco and drug words in every cosplayer, archetype,
|
||||
creature, slot and field string ("cigarette trousers" stays legal as a garment cut).
|
||||
|
||||
**Nose prose.** A nose value with a trailing clause read "a wide with flared nostrils
|
||||
nose"; the noun now goes before the clause ("a wide nose with flared nostrils"). That is a
|
||||
prose-only change on 157 existing tiles, so they were accepted with
|
||||
`render_gallery.py --rehash` rather than re-rendered.
|
||||
|
||||
**Pyra and Mythra corrected.** Re-sourced while checking the Xenoblade entries: Pyra's
|
||||
costume now leads with the green cross-shaped core crystal and the red-and-black bodysuit,
|
||||
short shorts and thighhighs, with crimson eyes and a short red bob; the Mythra overlay
|
||||
carries the white dress, golden eyes and hip-length blonde hair. `Mythra` is an alias.
|
||||
|
||||
**Alicent Hightower declined.** Her look is a green Westerosi court gown; Cersei's gowns
|
||||
and the Medieval Monarch archetype already cover that silhouette, and the seven-pointed
|
||||
star pendant is too small to carry the character. Lucky Chloe, Kana Arima and Akko Kagari
|
||||
were skipped by the maintainer.
|
||||
|
||||
**The people gallery.** The pack began as a random-person generator, but the galleries only
|
||||
showed roster entries, because an image is filed under an entry name. `gallery/people/`
|
||||
files it under a fixed seed instead: each sample is the plain Identity Forge node at its
|
||||
schema defaults plus a gender, and its card shows the seed and the full prompt with a copy
|
||||
button. The samples ride the existing render gate (`PEOPLE` in `scripts/render_gallery.py`,
|
||||
hashed over the prose like every other tile), so an engine change that moves a seed is
|
||||
reported stale. They deliberately take no gallery pins: the front-facing shot pin would
|
||||
make the card's seed lie about the prompt, so the seeds were scouted to draw front-facing,
|
||||
body-showing framings instead.
|
||||
|
||||
A "same seed, one lock changed" row was considered and dropped: locking an early-drawn
|
||||
field (age) re-rolls nearly everything after it, so the pair would show two different
|
||||
people and teach the wrong thing. A late field (the location setting) does keep the
|
||||
person, which is worth a note in the usage docs if the row is ever wanted.
|
||||
|
||||
## 2.7.1 - downstream nodes cache again
|
||||
|
||||
Contributed by sobakasu in PR #20. The seeded nodes (Identity Forge, Archetype, Cosplayer,
|
||||
Creature), the Outfit Sheet and a random Vault Load pick returned `float("nan")` from
|
||||
`fingerprint_inputs` as a workaround for ComfyUI#11905. That was wrong: ComfyUI builds a
|
||||
node's cache key from every ancestor's fingerprint (`comfy_execution/caching.py`,
|
||||
`get_node_signature`), and NaN never equals itself, so the sampler, VAE decode and everything
|
||||
else downstream re-ran on every queue even with a fixed seed. The old comment claiming identical
|
||||
output kept downstream cached described a cache ComfyUI does not have. A seed value is already
|
||||
part of the key, so an auto-advanced seed re-runs the node without any override.
|
||||
|
||||
Vault Load keeps a fingerprint, now `(picked entry, its mtime+size)` for a random pick too, so a
|
||||
save or delete that moves the pick still re-runs. `tests/test_node_contracts.py` now fails any
|
||||
node that returns NaN. Random characters unchanged.
|
||||
|
||||
## 2.8.0 - a vault pick that survives, and two picker backlog items
|
||||
|
||||
**Vault Load no longer fails validation on a name this vault lacks.** The node's docstring has
|
||||
always promised that a missing entry logs a warning and passes the upstream through, but
|
||||
ComfyUI checks a combo value against the live option list before `execute()` runs, so the
|
||||
prompt was rejected first ("Value not in list"). The common way in: build a workflow on an
|
||||
empty vault (the widget holds `(no characters saved)`), save a character, queue again without
|
||||
pressing Refresh. A shared workflow naming someone else's save failed the same way. ComfyUI
|
||||
skips its combo check for any input a `validate_inputs` override names, so the node now
|
||||
names `character` and accepts it; `execute()` already handled the rest.
|
||||
|
||||
**Refresh no longer swaps the pick for another character.** The frontend replaced any value
|
||||
missing from the list with the first entry, on every refresh, including the one that runs when
|
||||
a workflow loads. A deleted or foreign name silently recalled a different saved person, a
|
||||
failed fetch replaced the pick with the "vault unavailable" placeholder, and renaming the
|
||||
current pick in Manage Vault moved the node to the first entry. Now only a placeholder moves
|
||||
to the first entry, a rename follows the pick, and deleting the pick hands the node the first
|
||||
remaining entry.
|
||||
|
||||
**Picker backlog.** Both open picker items from the 2.5.0 review shipped. A plural query also
|
||||
finds the lone singular ("boots" finds "boot"), but only as a whole word, so "pants" never
|
||||
reaches "panther", and a word ending in "ss" gains nothing ("glasses" never becomes "glass", the
|
||||
trap the backlog named). **Queue random** sits beside Queue each and queues one run with one
|
||||
random matching entry, without the confirm prompt; it shows while filtering with two or more
|
||||
matches. Random characters unchanged.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# Archetype reference
|
||||
|
||||
**291 archetypes.** Each is a curated look wired through the Archetype node. `gender` shows a locked gender (blank = either); `outfit` is the archetype's outfit style.
|
||||
**292 archetypes.** Each is a curated look wired through the Archetype node. `gender` shows a locked gender (blank = either); `outfit` is the archetype's outfit style.
|
||||
|
||||
- **1940s Factory Worker** [Female] -- vintage retro
|
||||
- **1940s Swing Dancer** [Any]
|
||||
@@ -42,6 +42,7 @@
|
||||
- **Astronaut** -- athletic
|
||||
- **Astronomer** -- smart casual
|
||||
- **Athlete** [Any] -- athletic
|
||||
- **Aztec Noble** [Any] -- evening formal
|
||||
- **B-Boy / B-Girl**
|
||||
- **Babushka** [Female] -- vintage retro
|
||||
- **Backyard Country Casual** [Any]
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
# Cosplayer reference
|
||||
|
||||
**2160 characters.** Flags: `F`/`M` = source gender, `giant`/`tiny` = size scale, `masked` = full-face covering, `beast` = rendered as the animal itself (`body_plan: feral`), `+N alt` = extra costumes, `prop` = signature held item.
|
||||
**2187 characters.** Flags: `F`/`M` = source gender, `giant`/`tiny` = size scale, `masked` = full-face covering, `beast` = rendered as the animal itself (`body_plan: feral`), `+N alt` = extra costumes, `prop` = signature held item.
|
||||
|
||||
## Anime & Manga (416)
|
||||
## Anime & Manga (423)
|
||||
|
||||
### Akame ga Kill
|
||||
|
||||
@@ -80,6 +80,10 @@
|
||||
- **Toshiro Hitsugaya** (M, prop)
|
||||
- **Yoruichi** (F)
|
||||
|
||||
### Bocchi the Rock!
|
||||
|
||||
- **Hitori Gotoh** (F, prop)
|
||||
|
||||
### Chainsaw Man
|
||||
|
||||
- **Aki Hayakawa** (M)
|
||||
@@ -108,6 +112,7 @@
|
||||
|
||||
### Danganronpa
|
||||
|
||||
- **Celestia Ludenberg** (F, prop)
|
||||
- **Chiaki Nanami** (F, prop)
|
||||
- **Junko Enoshima** (F)
|
||||
- **Monokuma** (M, tiny, masked)
|
||||
@@ -291,6 +296,8 @@
|
||||
### Hellsing
|
||||
|
||||
- **Alucard (Hellsing)** (M, prop)
|
||||
- **Integra Hellsing** (F)
|
||||
- **Seras Victoria** (F, prop)
|
||||
|
||||
### High School DxD
|
||||
|
||||
@@ -368,6 +375,10 @@
|
||||
|
||||
- **Fujiko Mine** (F)
|
||||
|
||||
### Lycoris Recoil
|
||||
|
||||
- **Chisato Nishikigi** (F)
|
||||
|
||||
### Madoka Magica
|
||||
|
||||
- **Homura Akemi (Devil)** (F)
|
||||
@@ -419,6 +430,7 @@
|
||||
- **Hawks** (M)
|
||||
- **Himiko Toga** (F)
|
||||
- **Midnight (My Hero Academia)** (F, prop)
|
||||
- **Mina Ashido** (F)
|
||||
- **Mirko** (F)
|
||||
- **Momo Yaoyorozu** (F)
|
||||
- **Mt. Lady** (F, giant)
|
||||
@@ -481,6 +493,7 @@
|
||||
- **Monkey D. Luffy** (M)
|
||||
- **Nami** (F)
|
||||
- **Nico Robin** (F)
|
||||
- **Perona** (F, prop)
|
||||
- **Portgas D. Ace** (M)
|
||||
- **Roronoa Zoro** (M, prop)
|
||||
- **Sanji** (M)
|
||||
@@ -1432,7 +1445,7 @@
|
||||
- **The Flash** (M, masked)
|
||||
- **The Penguin** (M, prop)
|
||||
- **The Riddler** (M, prop)
|
||||
- **The Spectre** (M)
|
||||
- **The Spectre** (M, masked)
|
||||
- **Thorn** (F)
|
||||
- **Thunder (Anissa Pierce)** (F)
|
||||
- **Tomar-Re** (M)
|
||||
@@ -1903,7 +1916,7 @@
|
||||
|
||||
- **Zorro** (M, prop)
|
||||
|
||||
## Marvel (196)
|
||||
## Marvel (197)
|
||||
|
||||
### Marvel
|
||||
|
||||
@@ -1964,6 +1977,7 @@
|
||||
- **Gorgon** (M)
|
||||
- **Green Goblin** (M, masked, prop)
|
||||
- **Groot** (M, giant)
|
||||
- **Gwenpool** (F, prop)
|
||||
- **Hawkeye** (M, prop)
|
||||
- **Hela** (F)
|
||||
- **Hellcat** (F)
|
||||
@@ -2716,7 +2730,7 @@
|
||||
- **Bantha** (M, giant, beast)
|
||||
- **Barriss Offee** (F, prop)
|
||||
- **Battle Droid** (M, masked)
|
||||
- **Bib Fortuna** (M)
|
||||
- **Bib Fortuna** (M, masked)
|
||||
- **Bo-Katan Kryze** (F, masked)
|
||||
- **Boba Fett** (M, masked)
|
||||
- **Bossk** (M, masked, prop)
|
||||
@@ -2780,7 +2794,7 @@
|
||||
- **Mace Windu** (M, prop)
|
||||
- **Mara Jade** (F, prop)
|
||||
- **Max Rebo** (M, masked)
|
||||
- **Maz Kanata** (F, tiny)
|
||||
- **Maz Kanata** (F, tiny, masked)
|
||||
- **Mon Mothma** (F)
|
||||
- **Mynock** (M, masked)
|
||||
- **Nien Nunb** (M, masked)
|
||||
@@ -2817,12 +2831,12 @@
|
||||
- **Watto** (M)
|
||||
- **Wedge Antilles** (M)
|
||||
- **Wicket the Ewok** (M, masked, prop)
|
||||
- **Yoda** (M, tiny, prop)
|
||||
- **Yoda** (M, tiny, masked, prop)
|
||||
- **Zeb Orrelios** (M, giant, masked)
|
||||
- **Zorii Bliss** (F, masked, prop)
|
||||
- **Zuckuss** (M, masked)
|
||||
|
||||
## Video Games (520)
|
||||
## Video Games (539)
|
||||
|
||||
### A Certain Scientific Railgun
|
||||
|
||||
@@ -2846,6 +2860,7 @@
|
||||
|
||||
### Assassin's Creed
|
||||
|
||||
- **Evie Frye** (F)
|
||||
- **Ezio Auditore** (M)
|
||||
- **Kassandra** (F)
|
||||
|
||||
@@ -2886,6 +2901,10 @@
|
||||
|
||||
- **Lady Maria** (F, prop)
|
||||
|
||||
### Bloodstained
|
||||
|
||||
- **Miriam (Bloodstained)** (F, prop)
|
||||
|
||||
### Borderlands
|
||||
|
||||
- **Amara** (F)
|
||||
@@ -3063,19 +3082,23 @@
|
||||
- **Aerith Gainsborough** (F, prop)
|
||||
- **Auron** (M, prop)
|
||||
- **Barret Wallace** (M)
|
||||
- **Beatrix (Final Fantasy)** (F, prop)
|
||||
- **Cactuar** (M, tiny, beast)
|
||||
- **Cecil Harvey** (M)
|
||||
- **Celes Chere** (F)
|
||||
- **Chocobo** (M, beast)
|
||||
- **Cindy Aurum** (F, prop)
|
||||
- **Cloud Strife** (M, prop)
|
||||
- **Fran** (F)
|
||||
- **Kain Highwind** (M, masked, prop)
|
||||
- **Kefka Palazzo** (M)
|
||||
- **Lightning** (F, prop)
|
||||
- **Lulu** (F, prop)
|
||||
- **Lunafreya Nox Fleuret** (F, prop)
|
||||
- **Moogle** (M, tiny, masked)
|
||||
- **Noctis** (M)
|
||||
- **Rikku** (F)
|
||||
- **Rinoa Heartilly** (F)
|
||||
- **Rosa Farrell** (F)
|
||||
- **Rydia** (F)
|
||||
- **Sephiroth** (M, prop)
|
||||
@@ -3087,6 +3110,7 @@
|
||||
- **Ultros** (M, masked)
|
||||
- **Vincent Valentine** (M)
|
||||
- **Vivi Ornitier** (M, masked)
|
||||
- **Y'shtola Rhul** (F)
|
||||
- **Yuffie Kisaragi** (F, prop)
|
||||
- **Yuna** (F, prop)
|
||||
- **Zidane** (M)
|
||||
@@ -3293,8 +3317,10 @@
|
||||
|
||||
### Metal Gear
|
||||
|
||||
- **EVA (Metal Gear)** (F, prop)
|
||||
- **Quiet** (F)
|
||||
- **Solid Snake** (M)
|
||||
- **The Boss** (F, prop)
|
||||
|
||||
### Metroid
|
||||
|
||||
@@ -3307,7 +3333,7 @@
|
||||
|
||||
### Mortal Kombat
|
||||
|
||||
- **Baraka** (M)
|
||||
- **Baraka** (M, masked)
|
||||
- **Cassie Cage** (F)
|
||||
- **Cetrion** (F, giant)
|
||||
- **D'Vorah** (F)
|
||||
@@ -3439,9 +3465,15 @@
|
||||
|
||||
### Silent Hill
|
||||
|
||||
- **Heather Mason** (F, prop)
|
||||
- **Nurse (Silent Hill)** (F, masked)
|
||||
- **Pyramid Head** (M, masked, prop)
|
||||
|
||||
### Skullgirls
|
||||
|
||||
- **Cerebella** (F)
|
||||
- **Parasoul** (F, prop)
|
||||
|
||||
### Sonic the Hedgehog
|
||||
|
||||
- **Amy Rose** (F, masked, prop)
|
||||
@@ -3464,6 +3496,7 @@
|
||||
- **Siegfried Schtauffen** (M, prop)
|
||||
- **Sophitia Alexandra** (F, prop)
|
||||
- **Taki** (F, prop)
|
||||
- **Tira** (F, prop)
|
||||
- **Voldo** (M, masked, prop)
|
||||
- **Xianghua** (F, prop)
|
||||
- **Yoshimitsu** (M, masked, prop)
|
||||
@@ -3546,6 +3579,12 @@
|
||||
|
||||
- **SHODAN** (F)
|
||||
|
||||
### Tales series
|
||||
|
||||
- **Judith (Tales)** (F, prop)
|
||||
- **Sheena Fujibayashi** (F, +2 alt, prop)
|
||||
- **Velvet Crowe** (F)
|
||||
|
||||
### Team Fortress 2
|
||||
|
||||
- **Demoman (Team Fortress 2)** (M)
|
||||
@@ -3558,6 +3597,7 @@
|
||||
|
||||
### Tekken
|
||||
|
||||
- **Alisa Bosconovitch** (F)
|
||||
- **Anna Williams** (F)
|
||||
- **Asuka Kazama** (F)
|
||||
- **Azucena Ortiz** (F)
|
||||
@@ -3583,6 +3623,7 @@
|
||||
- **Athena Asamiya** (F)
|
||||
- **Iori Yagami** (M)
|
||||
- **K'** (M)
|
||||
- **Kula Diamond** (F, prop)
|
||||
- **Kyo Kusanagi** (M)
|
||||
- **Leona Heidern** (F)
|
||||
- **Mai Shiranui** (F, prop)
|
||||
@@ -3672,6 +3713,10 @@
|
||||
|
||||
- **Pyra** (F, +1 alt)
|
||||
|
||||
### Xenosaga
|
||||
|
||||
- **KOS-MOS** (F)
|
||||
|
||||
### Zenless Zone Zero
|
||||
|
||||
- **Ellen Joe** (F, prop)
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
- **ghost** (pale spectral white)
|
||||
- **goblin** (sickly green)
|
||||
- **hag** (sallow grey-green)
|
||||
- **jiangshi** (greyed corpse-blue)
|
||||
- **jiangshi** (pale greenish-white)
|
||||
- **lich** (bone-white and sickly green)
|
||||
- **mummy** (dusty bandage-beige)
|
||||
- **ogre** (mottled green-grey)
|
||||
|
||||
@@ -23,13 +23,12 @@ that is what the Creature node is for.
|
||||
|
||||
## Under consideration
|
||||
|
||||
Nothing is open; the last row (the Tellarite snout) closed in 2.1.0 with the `subject` lead noun.
|
||||
|
||||
**Engine and UX backlog** (found in the 1.6.0 review; its five fixes shipped in 1.7.0, and the
|
||||
tight-shot legwear, free-text `held_item` and expression-sheet rows in 1.10.0, see
|
||||
`docs/history.md`):
|
||||
|
||||
Empty: the gaze field and the noun-expression article both shipped in 2.0.0.
|
||||
The gaze field and the noun-expression article both shipped in 2.0.0; the two items from the
|
||||
2.5.0 picker-search review (Queue random, plural search) shipped in 2.8.0. Nothing open here.
|
||||
|
||||
**Researched and skipped — do not re-survey.** Valorant, Apex Legends,
|
||||
Monster Hunter, Skyrim, Splatoon, FNAF, Among Us, Minecraft, Mortal Shell. Each is an armoured,
|
||||
@@ -77,11 +76,16 @@ Closed with a reason. Reopen only with a **new** argument, not a repeat of the r
|
||||
|---|---|
|
||||
| A negative and/or tags output | Maintainer: not needed. (The subject/scene half of the same row shipped at 1.8.0 as `subject_text`.) |
|
||||
| An on-node readout of the resolved prompt | Maintainer: not needed. |
|
||||
| Saved picker searches (a remembered list of frequent filters) (2.5.0) | Maintainer: not wanted. |
|
||||
| Hair-colour and era filters in the picker (2.5.0) | Maintainer: not wanted; word search covers them. |
|
||||
| A pair / group node (two or more resolved characters in one prompt) (2.3.0 plan) | Maintainer: deferred, not refused. Most current t2i models blend or swap traits between two described people in one prompt, so the output would not match the characters. Reopen if models hold separate subjects reliably. |
|
||||
|
||||
### Individual characters
|
||||
|
||||
| Candidate | Why |
|
||||
|---|---|
|
||||
| Alicent Hightower (House of the Dragon) | **Declined at 2.7.0.** A green Westerosi court gown: Cersei's gowns and the Medieval Monarch archetype already cover the silhouette, and the star pendant is too small to carry her. |
|
||||
| Lucky Chloe, Kana Arima, Akko Kagari | **Skipped by the maintainer at 2.7.0.** |
|
||||
| Anxiety (Inside Out) | **Declined at 1.8.0 on the render bar.** The look is a teal turtleneck, high trousers and boots over bright orange skin, and the model could not hold it: two renders kept pale human skin (the orange only reached the hair) and spread the teal from the sweater onto the trousers and boots, so the tile read as a pale redhead in a teal outfit. Body-paint wording that works for a single-colour figure (Megamind's blue) fails when a second saturated costume colour is present. Reopen with a costume that is not a second saturated colour, or if the model's skin-colour handling changes. |
|
||||
| Kliff (Crimson Desert) | **Revisited and DECLINED at 1.4.0.** The original reason was wrong: Kliff is a *fixed* protagonist (set face, body and voice, the Geralt model), not a vendor-built one -- only his hair, facial hair, tattoos and outfit *colours* are customizable. The decline stands on the other half: his equipment and clothing are explicitly "highly customizable", so there is still no single canonical outfit to describe, and what is left -- a bearded man in fantasy leathers -- is the silhouette `Geralt` and `Conan the Barbarian` already carry. Reopen only if a marketing-canonical outfit becomes the settled default look. |
|
||||
| M3GAN (1.5.0 maintainer shortlist) | **Adults-only bar.** Canonically a child-sized android doll modelled on a young girl: rendering her as a child breaks the bar, and rendering her as an adult is not canon. Approved on the shortlist, declined at research. |
|
||||
@@ -345,6 +349,8 @@ From the third-party wildcard packs mined at 1.6.0. What shipped is in docs/hist
|
||||
| A dark/gothic counterpart to Kawaii Street Fashion | Declined on two counts. The pastel silhouette is already `Kawaii Street Fashion` (ruffled blouse, tiered skirt, platform Mary-Janes) and the dark one is already `1990s Goth`, so the candidate sits between two shipped entries rather than beside them. The maintainer also rejected the subculture's usual name outright. **Do not re-propose it under a synonym.** |
|
||||
| Zoot Suit women's (pachuca) variant (1.11.0 plan) | **Declined at 1.11.0 on the render bar; `Zoot Suit` ships men's only.** The long drape jacket and the watch chain are the whole look. Both wordings failed: the first (a long-line jacket over a short pleated skirt) did not read as a zoot suit, and the retry (fingertip-length drape jacket, pegged trousers) drew a sleeveless cropped vest with no chain. |
|
||||
| Renaissance noblewoman, Victorian lady, Edwardian lady, Greek noblewoman, Steampunk aristocrat (2.2.0 historical list) | **Already ship** as `Renaissance Noble`, `Victorian Lady`, `Gibson Girl`, `Greek Goddess` and `Steampunk Inventor`. Baroque gentleman, Rococo marquise and Georgian gentleman were folded into the new `Rococo Courtier`. |
|
||||
| Edo, Victorian and Regency period looks (2.3.0 plan) | **Already ship** as `Samurai`, `Geisha`, `Stealth Ninja`, `Victorian Lady`, `Victorian Dandy` and `Regency Aristocrat`. `Aztec Noble` shipped from the same list. |
|
||||
| Silk Road merchant (2.3.0 plan) | A blend of `Mongolian Deel`, `Ottoman Court` and `Hanfu` with no silhouette of its own; the name would be doing the work. |
|
||||
| Mughal noblewoman, Belle Epoque gown, "cinematic period costume" (2.2.0 historical list) | Mughal court dress overlaps `Lehenga & Sherwani`; a Belle Epoque gown sits between `Victorian Lady` and `Gibson Girl`; "cinematic period costume" is a style, not a look. |
|
||||
| Rockabilly (1.11.0 plan) | Sits between two shipped entries: `1950s Greaser` carries the cuffed jeans, leather jacket and pompadour, and `Pin-up Model` the halter dress, victory rolls and red lip. A third entry would be a blend of the two, not a new look. |
|
||||
|
||||
@@ -357,9 +363,11 @@ Open. No decision has been made either way.
|
||||
| # | Question | Where it stands |
|
||||
|---|---|---|
|
||||
| 2 | **Costume text that asserts a body trait against an unpinned random field.** A costume reading "on a hulking frame" can render beside "a very slim build" in the same sentence, because `physique` applies only in Full-character mode while `costume` renders in both. | Measured at 0.90.0, **33 entries** (`Colossus`, `Gollum`, `Jabba the Hutt`, `Space Marine`, `Brook`, …). Not swept, for two reasons. First, the `signature` / `physique` split is *deliberate* — the schema says physique is Full-mode-only, so a randomly-built person wearing the costume is the intended behaviour, and most of the 33 are mascot suits where the suit supplies the bulk regardless of the wearer. Second, a naive regex reported **171** and was wrong: "tiny" on `Trinity` and `Neo` is their *sunglasses*, "enormous" on `Edna Mode` is her *lashes*. Requiring the adjective to modify a body noun cut it to 33. **If this is ever taken up, measure it again from scratch — do not trust the 171.** The four entries fixed at 0.90.0 (`Dexter Jettster`, `Figrin D'an`, `Ithorian`, plus the new Fallout/GoT entries) pin the trait in `signature`, which applies in both modes; that is the pattern to follow. |
|
||||
| 10 | **Some archetype `outfit_style` proxies disagree with the location gate** (e.g. `Opera Singer` evening formal at an outdoor amphitheater). | Harmless in Full lock level (both locked, the rule only logs); in Essentials the location is steered to a fitting venue. Only worth touching if a real render looks wrong. |
|
||||
| 16 | **Outfits that name no colour.** A costume or archetype outfit with no colour word leaves the prompt colourless when the place and light are muted too, and the model can render black and white (Hockey Goalie and Sabrina Spellman, both fixed in 2.4.0). | Many cosplay costumes and a few archetype outfits still name none; most say "dark" or rely on hair and skin. Fix per entry with canon colours when a render comes back grey; do not bulk-insert colours. |
|
||||
| 13 | **Two values stay reachable only through a lock or a narrow style.** No men's garment bares the back, so a man's shoulder-blade tattoo never shows by default; `dark dress socks` shows only under a cuffed or ankle-length hem (smart casual, vintage retro). | Both are true to life; both used to be reached only through false positives (`dress` matching "dress shirt"). Revisit only if a render asks for them. |
|
||||
|
||||
**Closed at 2.4.0 - rows 10 and 15.** The location vs `outfit_style` clashes were audited and left alone (both locks are kept, nothing renders differently; most pairs are true to life), and four venues shipped for the archetypes that had none (wrestling ring, tennis court, pit lane, racecourse paddock). See docs/history.md -> "2.4.0".
|
||||
|
||||
**Closed at 2.0.0 - rows 11, 12 and 14, the gaze field and the noun-expression article.** Ages 75 and 80 joined `age` (60+ held near 16%), the three shortest women's lengths were weighted down (about 10% of women), a portrait rig no longer lights an everyday interior, the `looking` poses became the `gaze` field, and a noun expression takes an article. See docs/history.md -> "2.0.0".
|
||||
|
||||
**Closed at 1.11.0 - Birdie the Early Bird (was row 5).** Shipped on the mascot-suit route. The aviator cap with goggles, the orange pigtails and the pink flight suit are the silhouette detail the roster's other bird mascots lack, and the render held all three.
|
||||
|
||||
+117
-2
@@ -106,7 +106,9 @@ optional sections:
|
||||
Buckets are `unisex`
|
||||
(always eligible) plus `female` / `male`, chosen by the `wardrobe` control; any subset works.
|
||||
- **`archetypes`** adds presets to the Archetype node (same `{field: value}` shape as the
|
||||
built-ins; `outfit_description` may use `{slot}` placeholders).
|
||||
built-ins; `outfit_description` may use `{slot}` placeholders). A value may be a list, one
|
||||
picked per seed (`"hair_color": ["copper", "auburn"]`), and a `"variants"` object holds
|
||||
separate `"Female"` / `"Male"` looks. Anything else is skipped with a warning in the log.
|
||||
- **`cosplayers`** adds characters to the Cosplayer node. `costume` (worn items only) is required;
|
||||
`franchise`/`gender` are optional; `signature` (both modes) and `physique` (Full character) are
|
||||
`{field: value}` maps. An optional `"prop"` string adds a signature held item; an optional
|
||||
@@ -117,7 +119,12 @@ optional sections:
|
||||
bare skin, suppresses jewellery/nails), `"covers_hair": true` (hood/cowl hides the hair while
|
||||
the face shows), `"bald": true` (fully hairless head), `"body_paint": true` (the skin itself is
|
||||
the costume colour; add `"skin": "warm green"` to name the colour when it isn't obvious from
|
||||
the costume text). Word a full-body colour skin-native — `"smooth, flawless <colour> skin"` —
|
||||
the costume text). Four more keys match the built-ins: `"costumes"` (a list of alternate
|
||||
looks, each a costume string or an object with its own `"costume"` plus per-look keys such
|
||||
as `"mask"` or `"signature"`; one look is picked per seed), `"costume_weights"` (one
|
||||
positive number per look, the main costume first), `"costume_back"` (the costume seen from
|
||||
behind, used by the Turnaround's back views) and `"subject"` (a lead noun for a non-human
|
||||
head, such as `"pig-headed alien"`). Word a full-body colour skin-native - `"smooth, flawless <colour> skin"` -
|
||||
not as "body paint"/"dye", which t2i models render as a streaky coat over a human tone; the
|
||||
skin-native marker is auto-detected, so the flag is only needed for other phrasings. See the
|
||||
worked examples in
|
||||
@@ -208,6 +215,7 @@ their usual costume text in every view.
|
||||
Everything else belongs on the Identity Forge node - it owns the character and the scene,
|
||||
the Turnaround owns only the camera. For a clean reference sheet, set that node's
|
||||
`location_setting` to `Studio / solid backdrop` and lock `composition` to `centered symmetry`.
|
||||
A ready-made workflow is `example_workflows/Identity Forge - Turnaround.json`.
|
||||
|
||||
## Expression sheets
|
||||
|
||||
@@ -226,6 +234,113 @@ Image's `filename_prefix`), and it owns only the face's emotion: `expression`, `
|
||||
Each view sets a fixed, curated expression/mood/smile combination, so a sheet is
|
||||
deterministic and no two views land on the same face. A face-covering character (a mascot
|
||||
head, a full helmet) has no visible expression, so the sheet emits one view, `1-masked`.
|
||||
A ready-made workflow is `example_workflows/Identity Forge - Expression Sheet.json`.
|
||||
|
||||
## Outfit sheets
|
||||
|
||||
The **Identity Forge Outfit Sheet** node is wired like the Turnaround and keeps the person while
|
||||
it redresses them once per outfit style.
|
||||
|
||||
- **`sheet`** - `Range (6)` (casual, smart casual, business formal, evening formal, athletic,
|
||||
resort vacation), `Everyday (4)`, `Work to evening (4)` or `Every style`.
|
||||
- **`backdrop`** - a grey (default), white or black studio backdrop, or `Keep the character's
|
||||
scene`. A studio backdrop also redraws lighting and composition to suit the studio, so every
|
||||
style fits.
|
||||
Keeping the scene skips styles the place does not allow (no evening gown on a hiking trail),
|
||||
so that sheet is often shorter.
|
||||
- **`framing`** - `Full body` by default, so the whole outfit shows. **`pose`** - a standing
|
||||
pose by default; `Keep the character's pose` keeps theirs.
|
||||
- **`outfit_seed`** - every outfit is drawn at random within its style, and differs from one
|
||||
character to the next. Change this number to re-dress the same person; set its control to
|
||||
`randomize` for new outfits every queue.
|
||||
|
||||
The face, body and hair colour stay; makeup, jewellery and hair styling follow each outfit when
|
||||
the old ones would clash with it. Labels read `1-casual`, `2-smart-casual` and so on. A cosplay
|
||||
character or a full-body suit has its costume, so the sheet emits one view as resolved.
|
||||
A ready-made workflow is `example_workflows/Identity Forge - Outfit Sheet.json` (also in
|
||||
ComfyUI's template browser).
|
||||
|
||||
## Scene sheets
|
||||
|
||||
The **Identity Forge Scene Sheet** node (2.6.0) is wired like the Turnaround and shows the same
|
||||
person in several places.
|
||||
|
||||
- **`sheet`** - `Everyday (6)` (city park, coffee shop, living room, office, beach, forest trail),
|
||||
`Indoors (4)`, `Outdoors (4)` or `Studio backdrops (3)`.
|
||||
- **`framing`** - `Cowboy (mid-thigh up)` by default, so the place shows around the person;
|
||||
`Unspecified` keeps the character's own framing.
|
||||
- **`clothes`** - `Dress for each place` (default) picks a new outfit that suits each place.
|
||||
`Keep the outfit` keeps the character's clothes and skips any place they do not suit, so that
|
||||
sheet can be shorter, or a single view as resolved if no place fits.
|
||||
|
||||
Lighting, composition and season are drawn again for each place. A pose, gaze, makeup,
|
||||
jewellery or hair styling a place refuses is redrawn for that view; anything else a place
|
||||
refuses (age, body, a held item) skips it. The face and body never change. A cosplay character
|
||||
or a full-body suit keeps the costume. Labels read `1-sunny-city-park` and so on. A ready-made
|
||||
workflow is `example_workflows/Identity Forge - Scene Sheet.json`.
|
||||
|
||||
## Age progression
|
||||
|
||||
The **Identity Forge Age Progression** node shows the same person at several ages.
|
||||
|
||||
- **`stages`** - `Life stages (4)` (20, 35, 50, 70), `Decades (6)` (20 to 70) or `Young and old
|
||||
(2)` (25, 70).
|
||||
- **`framing`** - `Head and shoulders` by default; `Unspecified` keeps the character's own.
|
||||
|
||||
Only the age and what depends on it change (skin detail, and an outfit or hair style the new
|
||||
age does not allow). With a natural hair colour scope, hair greys past 55: dark hair goes salt
|
||||
and pepper, then silver from 70. A grey-haired character shown younger gets a natural colour.
|
||||
Dyed or vivid scopes, cosplay hair and covered hair are left alone. A face-covering character
|
||||
emits one view as resolved. Labels read `1-age-20` and so on. A ready-made workflow is
|
||||
`example_workflows/Identity Forge - Age Progression.json`.
|
||||
|
||||
## Searching the picker
|
||||
|
||||
- **Words match from their start.** `bow` finds a bow tie or a bowler hat, not "elbow" or
|
||||
"rainbow". A name still matches anywhere (`man` finds Batman). Several words must all match,
|
||||
in any order; put a phrase in quotes (`"bow tie"`) to match it as written.
|
||||
- **Accents are optional.** `dia` and `día` both find Día de los Muertos; `pokemon` finds
|
||||
Pokémon. The same holds in the franchise box.
|
||||
- **Everything in an entry's description is searched:** name, franchise, costume, alternate
|
||||
costumes, back view, mask, prop, eyes, hair and body text.
|
||||
- **A few words also find their synonyms and compounds:** `pants` finds trousers, slacks and
|
||||
jeans, `suit` finds bodysuits and jumpsuits, `sword` finds katanas, `gray` finds grey. The
|
||||
list is `SEARCH_ALSO` in `js/identity_forge_picker.js`; it is one-way (`jeans` does not
|
||||
find slacks).
|
||||
- **Plurals find the singular (2.8.0).** `boots` also finds a lone "boot" and `gloves` a lone
|
||||
"glove". The singular must be a whole word, so `pants` never finds "panther", and words
|
||||
ending in "ss" (`dress`, `glasses`) are left as typed.
|
||||
- **Franchise box (Cosplayer node):** type part of a name. `star` keeps Star Wars and Star
|
||||
Trek; picking a suggestion, or typing a full name, keeps that franchise only. Trait, gender
|
||||
and franchise filters only appear on nodes where they can narrow something.
|
||||
- **Your place is kept.** Reopening the picker scrolls to the character the node holds (outlined),
|
||||
with the same search and filters, so you can pick, queue, and come back to the next one.
|
||||
- **Queue each (N)** appears while you are filtering: it queues one run per matching entry the
|
||||
node can take, then puts your original pick back. Each run uses the rest of the workflow as it
|
||||
stands, so a seed set to randomize gives each one a new person. **Queue random** (2.8.0), beside
|
||||
it, queues a single run with one random matching entry and does not ask first.
|
||||
- **Star your favourites (2.6.0).** Click the star on a card (or press S on the focused card),
|
||||
then tick **Starred only** to see just those. Stars are kept in this browser, shared by all
|
||||
three pickers, and work with every other filter and with Queue each.
|
||||
|
||||
## Recalling a random saved character
|
||||
|
||||
Vault Load's `character` list ends with `(random saved character)` once anything is saved
|
||||
(2.6.0). It picks one saved character by the node's `seed`: the same seed and vault give the
|
||||
same pick, and `randomize` gives a different one each queue.
|
||||
|
||||
If the node names a character this vault does not hold (a workflow from another machine, or
|
||||
an entry deleted since), it logs a warning and passes the `upstream` through instead of
|
||||
failing the queue (2.8.0). Refresh keeps such a name rather than swapping in a different
|
||||
saved character; pick another from the list to replace it.
|
||||
|
||||
## Preview images in the picker
|
||||
|
||||
"Show preview images" in the roster picker is off by default. When it is on, your ComfyUI
|
||||
server downloads each sample image the first time you scroll to it and keeps it in
|
||||
`<ComfyUI user folder>/identity_forge/gallery_cache/`, so previews also show when ComfyUI runs
|
||||
with `--offline` (once the server has fetched them). Only images you view are stored. "Clear
|
||||
cached previews" in the picker deletes the folder and shows how much it freed.
|
||||
|
||||
## Holding something specific
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+32
-11
@@ -1,12 +1,13 @@
|
||||
# Sample galleries
|
||||
|
||||
Three sibling galleries, one per preset node:
|
||||
Four sibling galleries, one per preset node plus one for the plain node:
|
||||
|
||||
| Folder | Entries from | Live page |
|
||||
| --- | --- | --- |
|
||||
| [`cosplay/`](cosplay/) | `data/cosplayers.py` | [cosplay gallery](https://enragedantelope.github.io/comfyui-identity-forge/gallery/cosplay/) |
|
||||
| [`archetypes/`](archetypes/) | `data/templates.py` (`ARCHETYPES`) | [archetype gallery](https://enragedantelope.github.io/comfyui-identity-forge/gallery/archetypes/) |
|
||||
| [`creatures/`](creatures/) | `data/creatures.py` (`CREATURES`) | [creature gallery](https://enragedantelope.github.io/comfyui-identity-forge/gallery/creatures/) |
|
||||
| [`people/`](people/) | `PEOPLE` in `scripts/render_gallery.py` | [people gallery](https://enragedantelope.github.io/comfyui-identity-forge/gallery/people/) |
|
||||
|
||||
**Images live only on the `gh-pages` branch.** `gallery/.gitignore` blocks `images/`
|
||||
on `main`, so cloning or pulling the repo never drags down hundreds of megabytes of
|
||||
@@ -24,6 +25,23 @@ python gallery/cosplay/build_manifest.py --images gallery/cosplay/images
|
||||
|
||||
---
|
||||
|
||||
## The people gallery (2.7.0)
|
||||
|
||||
The original point of the pack is random people, and the roster galleries cannot show
|
||||
them: a person has no name to file the image under. So each sample is a **fixed seed** on
|
||||
the plain Identity Forge node, with no preset node and every widget at its schema default
|
||||
except the gender. Its card shows the seed and gender, and the full prompt the node wrote
|
||||
with a copy button, so a viewer can reproduce the prompt exactly on a fresh node. The
|
||||
seeds were scouted so the set spans gender, age, outfit style and indoor/outdoor places.
|
||||
|
||||
The samples go through the same render gate as the roster: `render_gallery.py` resolves
|
||||
them in-process, hashes the prose, and `--check` reports a sample stale when an engine
|
||||
change moves what its seed draws. Re-render it, or pick a new seed if the spread suffers.
|
||||
The page needs no release stamps (a seed is not a roster entry; the sort controls stay
|
||||
hidden) and ships no cycle workflow (the card carries everything needed).
|
||||
|
||||
---
|
||||
|
||||
## Publishing
|
||||
|
||||
Double-click `update_gallery.bat` in the gallery you want, or drag a folder of images
|
||||
@@ -74,12 +92,13 @@ is the right failure mode — it has no image on `gh-pages` either.
|
||||
|
||||
## Editing the page files
|
||||
|
||||
`gallery.js` and `style.css` are copies too, exactly like the four `.py` scripts. `style.css` is
|
||||
byte-identical across all three and `gallery.js` differs **only** in its header banner;
|
||||
`PageAssetsStayInSyncTests` in `tests/test_gallery.py` fails until a change has landed in all
|
||||
three. It also checks that every `$('#id')` the script reaches for exists in that gallery's
|
||||
`index.html` — a lookup returning `null` is how the "Clear search" button sat dead for several
|
||||
releases without anyone noticing.
|
||||
`gallery.js` and `style.css` exist once, in `gallery/shared/` (2.6.0; they used to be three
|
||||
copies). Each `index.html` links `../shared/`, and every `publish.py` stages that folder to
|
||||
`gallery/shared/` on `gh-pages` beside its own page, so a fix lands once and any gallery's
|
||||
publish ships it to every gallery. `SharedPageAssetsTests` in `tests/test_gallery.py` fails if a
|
||||
per-gallery copy comes back. It also checks that every `$('#id')` the script reaches for exists
|
||||
in each gallery's `index.html` - a lookup returning `null` is how the "Clear search" button sat
|
||||
dead for several releases without anyone noticing.
|
||||
|
||||
---
|
||||
|
||||
@@ -113,13 +132,13 @@ python gallery/cosplay/cross_reference.py # what still needs an image, what
|
||||
|
||||
---
|
||||
|
||||
## Three copies, deliberately
|
||||
## Four copies, deliberately
|
||||
|
||||
Each gallery owns its scripts rather than importing a shared package. The four Python
|
||||
files are **byte-identical outside their docstring and their `GALLERY CONFIG` block** —
|
||||
that block is where the data module, the roster accessor and the page file list live.
|
||||
|
||||
**If you fix a bug or make an improvement in one, port it to the other two.**
|
||||
**If you fix a bug or make an improvement in one, port it to the other three.**
|
||||
`tests/test_gallery.py::CopiesStayInSyncTests` enforces this: it strips the docstring
|
||||
and config block, neutralises the gallery name, and fails if the remaining code differs.
|
||||
You cannot land a one-gallery fix by accident.
|
||||
@@ -130,12 +149,14 @@ parenthesised `if` blocks, ASCII only, and CRLF enforced by `.gitattributes`.
|
||||
|
||||
---
|
||||
|
||||
## Adding a fourth gallery
|
||||
## Adding another gallery
|
||||
|
||||
1. Copy a gallery folder wholesale.
|
||||
2. Edit only the `GALLERY CONFIG` block in each of the four `.py` files: `GALLERY_KIND`,
|
||||
the data import, `entry_names()`, `entry_meta()`, and `PAGE_FILES`.
|
||||
3. Update the title, subtitle and search placeholder in `index.html`.
|
||||
4. Add the new kind to `KINDS` in `tests/test_gallery.py`.
|
||||
4. Add the new kind to `KINDS` in `tests/test_gallery.py` (and to `ROSTER_KINDS` if it
|
||||
is built from a stamped roster with a downloadable workflow), and to `KINDS` and
|
||||
`entries_for()` in `scripts/render_gallery.py`.
|
||||
5. Run `python gallery/<kind>/cross_reference.py` — it should list every entry as
|
||||
missing. That is the empty gallery, ready for its first publish.
|
||||
|
||||
@@ -9,10 +9,10 @@ the gh-pages checkout, so the normal workflow never needs this script directly.
|
||||
Use it when you want a local optimized copy without publishing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/archetypes/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -33,7 +33,7 @@ except ImportError: # pragma: no cover - exercised by the dependency-free CI ru
|
||||
|
||||
PILLOW_HINT = "Pillow is required to optimize images. Install it: pip install Pillow"
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "archetypes"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
python gallery/archetypes/build_manifest.py --images <dir>
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/build_manifest.py - gallery/archetypes/build_manifest.py -
|
||||
gallery/creatures/build_manifest.py
|
||||
gallery/creatures/build_manifest.py - gallery/people/build_manifest.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
``publish.py`` calls this against the images that are actually on ``gh-pages``,
|
||||
@@ -28,7 +28,7 @@ from pathlib import Path
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, REPO_ROOT)
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "archetypes"
|
||||
#: This gallery's key in ``data/versions.py`` (written by
|
||||
#: ``scripts/stamp_versions.py``). Differs from GALLERY_KIND for cosplay,
|
||||
|
||||
@@ -7,10 +7,10 @@ Read-only. Writes ``missing.txt`` / ``orphans.txt`` beside this script (both
|
||||
git-ignored) and prints a summary. Deletes nothing, publishes nothing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/archetypes/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -23,7 +23,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "archetypes"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Identity Forge — Archetype Sample Gallery</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='7' fill='%231a1a2e'/><circle cx='16' cy='13' r='6.5' fill='%235b8def'/><path d='M6 27c1.5-5 5.5-7.5 10-7.5S24.5 22 26 27Z' fill='%237aa5ff'/></svg>">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="../shared/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -78,6 +78,6 @@
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="gallery.js"></script>
|
||||
<script src="../shared/gallery.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
python gallery/archetypes/publish.py --source <dir> --dry-run # report, change nothing
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/publish.py - gallery/archetypes/publish.py -
|
||||
gallery/creatures/publish.py
|
||||
gallery/creatures/publish.py - gallery/people/publish.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
THE SAFETY MODEL, which is the whole point of this script:
|
||||
@@ -45,17 +45,20 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(REPO_ROOT))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG — the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "archetypes"
|
||||
GALLERY_TITLE = "themed archetype"
|
||||
PAGE_FILES = ["index.html", "style.css", "gallery.js",
|
||||
"Krea2_IdentityForge_ArchetypeCycle.json"]
|
||||
PAGE_FILES = ["index.html", "Krea2_IdentityForge_ArchetypeCycle.json"]
|
||||
# ============================================================================
|
||||
|
||||
from build_manifest import entry_names, generate_manifest, normalize_name # noqa: E402
|
||||
from build_gallery_images import optimize_image # noqa: E402
|
||||
|
||||
GALLERY_SRC_DIR = Path(__file__).resolve().parent
|
||||
#: 2.6.0: the page assets every gallery shares, published to gallery/shared/.
|
||||
SHARED_SRC_DIR = GALLERY_SRC_DIR.parent / "shared"
|
||||
SHARED_FILES = ["style.css", "gallery.js"]
|
||||
SHARED_REL_DIR = "gallery/shared"
|
||||
BRANCH = "gh-pages"
|
||||
REL_DIR = f"gallery/{GALLERY_KIND}"
|
||||
|
||||
@@ -247,9 +250,15 @@ def main() -> int:
|
||||
(worktree / REL_DIR / fname).write_text(
|
||||
src.read_text(encoding="utf-8"), encoding="utf-8", newline="")
|
||||
|
||||
for fname in SHARED_FILES:
|
||||
target = worktree / SHARED_REL_DIR / fname
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text((SHARED_SRC_DIR / fname).read_text(encoding="utf-8"),
|
||||
encoding="utf-8", newline="")
|
||||
|
||||
# -A, not a bare add: a plain `git add` stages additions and
|
||||
# modifications but NOT deletions, so a prune would be silently undone.
|
||||
run("git", "add", "-A", REL_DIR, cwd=worktree)
|
||||
run("git", "add", "-A", REL_DIR, SHARED_REL_DIR, cwd=worktree)
|
||||
if not run("git", "status", "--porcelain", cwd=worktree):
|
||||
print("\nNothing changed on the branch.")
|
||||
return 0
|
||||
|
||||
@@ -1,588 +0,0 @@
|
||||
/* =============================================================
|
||||
Identity Forge - Sample Gallery Styles
|
||||
Shared verbatim by the cosplay, archetype and creature galleries;
|
||||
see gallery/README.md before editing (a fix lands three times).
|
||||
Dark theme, tuned for browsing a large lazy-loaded grid.
|
||||
============================================================= */
|
||||
|
||||
/* --- CSS Variables --- */
|
||||
:root {
|
||||
--bg-primary: #1a1a2e;
|
||||
--bg-secondary: #16213e;
|
||||
--bg-card: #1e2a3a;
|
||||
--bg-card-hover: #253545;
|
||||
--bg-input: #0f1824;
|
||||
--text-primary: #e8e8f0;
|
||||
--text-secondary: #9098a8;
|
||||
--text-muted: #606878;
|
||||
--accent: #5b8def;
|
||||
--accent-hover: #7aa5ff;
|
||||
--accent-glow: rgba(91, 141, 239, 0.15);
|
||||
--border: #2a3a50;
|
||||
--border-hover: #4a6a90;
|
||||
--shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
--shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
|
||||
--radius: 8px;
|
||||
--transition: 0.2s ease;
|
||||
--max-width: 1400px;
|
||||
--card-min-width: 200px;
|
||||
--card-max-width: 280px;
|
||||
}
|
||||
|
||||
/* --- Reset & Base --- */
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { color: var(--accent-hover); }
|
||||
|
||||
/* --- Header --- */
|
||||
.gallery-header {
|
||||
text-align: center;
|
||||
padding: 2.5rem 1rem 1.5rem;
|
||||
max-width: var(--max-width);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.gallery-header h1 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.95rem;
|
||||
max-width: 700px;
|
||||
margin: 0 auto 1rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.header-subtitle strong {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.header-links {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.header-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.5rem 1.25rem;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.header-link:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
/* --- Controls --- */
|
||||
.gallery-controls {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: var(--bg-primary);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0.75rem 1rem;
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
max-width: 600px;
|
||||
margin: 0 auto 0.5rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.search-bar input {
|
||||
width: 100%;
|
||||
padding: 0.6rem 1rem;
|
||||
padding-right: 2.5rem;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.95rem;
|
||||
transition: border-color var(--transition), box-shadow var(--transition);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.search-bar input:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
.search-bar input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.search-clear {
|
||||
position: absolute;
|
||||
right: 0.5rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0.5rem;
|
||||
line-height: 1;
|
||||
transition: color var(--transition);
|
||||
}
|
||||
|
||||
.search-clear:hover { color: var(--text-primary); }
|
||||
.search-clear.hidden { display: none; }
|
||||
|
||||
.stats-bar {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.stats-missing {
|
||||
color: #c9a44b;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stats-missing:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* --- Grid --- */
|
||||
.gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
|
||||
gap: 0.75rem;
|
||||
padding: 1rem;
|
||||
max-width: var(--max-width);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* --- Card --- */
|
||||
.gallery-card {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.gallery-card:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--border-hover);
|
||||
box-shadow: var(--shadow-hover);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.gallery-card:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.card-image-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 2 / 3;
|
||||
background: var(--bg-input);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-image-wrapper img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.card-image-wrapper img.loaded {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.card-image-wrapper img:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* Placeholder for missing images */
|
||||
.card-image-wrapper.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg-input);
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 2rem;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.card-name {
|
||||
padding: 0.5rem 0.6rem;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Missing image card styling */
|
||||
.gallery-card.missing {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.gallery-card.missing:hover {
|
||||
opacity: 0.75;
|
||||
transform: none;
|
||||
border-color: var(--border);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.missing-badge {
|
||||
position: absolute;
|
||||
top: 0.25rem;
|
||||
right: 0.25rem;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
color: #c9a44b;
|
||||
font-size: 0.65rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-radius: 3px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* --- Loading --- */
|
||||
.loading-indicator {
|
||||
text-align: center;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.loading-indicator.hidden { display: none; }
|
||||
|
||||
.spinner {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border: 3px solid var(--border);
|
||||
border-top-color: var(--accent);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
margin: 0 auto 0.75rem;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* --- No Results --- */
|
||||
.no-results {
|
||||
text-align: center;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.no-results.hidden { display: none; }
|
||||
|
||||
.btn-secondary {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5rem 1.25rem;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
/* --- Lightbox --- */
|
||||
.lightbox {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
background: rgba(0, 0, 0, 0.92);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: fadeIn 0.2s ease;
|
||||
}
|
||||
|
||||
.lightbox.hidden { display: none; }
|
||||
|
||||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||||
|
||||
.lightbox-content {
|
||||
position: relative;
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.lightbox-content img {
|
||||
max-width: 90vw;
|
||||
max-height: 80vh;
|
||||
object-fit: contain;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.lightbox-name {
|
||||
margin-top: 0.75rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.lightbox-close {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
right: 1.5rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 2rem;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
z-index: 1001;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition);
|
||||
}
|
||||
|
||||
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
|
||||
|
||||
.lightbox-nav {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 2.5rem;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
z-index: 1001;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition), opacity var(--transition);
|
||||
}
|
||||
|
||||
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
|
||||
.lightbox-nav:disabled { opacity: 0.3; cursor: default; }
|
||||
|
||||
.lightbox-prev { left: 1rem; }
|
||||
.lightbox-next { right: 1rem; }
|
||||
|
||||
/* --- Footer --- */
|
||||
.gallery-footer {
|
||||
text-align: center;
|
||||
padding: 2rem 1rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
border-top: 1px solid var(--border);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
/* --- Keyboard shortcut hint --- */
|
||||
.keyboard-hint {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
color: var(--text-muted);
|
||||
font-size: 0.7rem;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: var(--radius);
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.keyboard-hint.visible { opacity: 1; }
|
||||
|
||||
/* --- Responsive --- */
|
||||
@media (max-width: 600px) {
|
||||
.gallery-header h1 { font-size: 1.35rem; }
|
||||
.header-subtitle { font-size: 0.85rem; }
|
||||
.gallery-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.card-name { font-size: 0.72rem; padding: 0.35rem 0.4rem; }
|
||||
.lightbox-prev { left: 0.25rem; }
|
||||
.lightbox-next { right: 0.25rem; }
|
||||
.lightbox-nav { font-size: 2rem; width: 40px; height: 40px; }
|
||||
}
|
||||
|
||||
/* --- Reduced motion --- */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
html { scroll-behavior: auto; }
|
||||
}
|
||||
|
||||
/* --- View controls: sort + "new in" filter (0.97.0) --------------------- */
|
||||
/* Both children are hidden by gallery.js unless the manifest actually supports
|
||||
them, so an older manifest renders the row empty rather than showing a control
|
||||
that cannot do anything. */
|
||||
.view-controls {
|
||||
max-width: 600px;
|
||||
margin: 0 auto 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.view-controls:empty { display: none; }
|
||||
|
||||
.sort-group {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.sort-group[hidden] { display: none; }
|
||||
|
||||
.sort-label {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.sort-select {
|
||||
padding: 0.3rem 1.6rem 0.3rem 0.6rem;
|
||||
background-color: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font: inherit;
|
||||
font-size: 0.82rem;
|
||||
cursor: pointer;
|
||||
transition: border-color var(--transition);
|
||||
/* Native select arrows are unstyleable and render light-on-light in a dark
|
||||
control on some platforms, so the arrow is drawn here instead. */
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
|
||||
linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
|
||||
background-position: right 0.75rem center, right 0.5rem center;
|
||||
background-size: 5px 5px, 5px 5px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.sort-select:hover { border-color: var(--border-hover); }
|
||||
|
||||
.sort-select:focus-visible {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
/* The select's own dropdown list is painted by the OS, which does not inherit
|
||||
the page's dark palette -- name the colours so the options are legible. */
|
||||
.sort-select option {
|
||||
background: var(--bg-card);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
padding: 0.3rem 0.7rem;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
color: var(--text-secondary);
|
||||
font: inherit;
|
||||
font-size: 0.78rem;
|
||||
cursor: pointer;
|
||||
transition: background var(--transition), border-color var(--transition),
|
||||
color var(--transition);
|
||||
}
|
||||
|
||||
.filter-chip[hidden] { display: none; }
|
||||
.filter-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }
|
||||
|
||||
.filter-chip:focus-visible {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
.filter-chip.is-active,
|
||||
.stats-missing .is-active {
|
||||
background: var(--accent-glow);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
/* "new" corner tag on a card added in this release. Sits opposite the existing
|
||||
.missing-badge so the two can never overlap on one card. */
|
||||
.new-badge {
|
||||
position: absolute;
|
||||
top: 0.4rem;
|
||||
left: 0.4rem;
|
||||
z-index: 2;
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
color: #0f1824;
|
||||
font-size: 0.62rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -8,8 +8,8 @@ REM
|
||||
REM Entries you do NOT supply an image for are left completely alone.
|
||||
REM Nothing is ever deleted by this script.
|
||||
REM
|
||||
REM ONE OF THREE NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures).
|
||||
REM Fix a bug here and apply it to the other two - see gallery\README.md.
|
||||
REM ONE OF FOUR NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures / people).
|
||||
REM Fix a bug here and apply it to the other three - see gallery\README.md.
|
||||
REM ==========================================================================
|
||||
setlocal
|
||||
set "GALLERY=archetypes"
|
||||
|
||||
@@ -9,10 +9,10 @@ the gh-pages checkout, so the normal workflow never needs this script directly.
|
||||
Use it when you want a local optimized copy without publishing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -33,7 +33,7 @@ except ImportError: # pragma: no cover - exercised by the dependency-free CI ru
|
||||
|
||||
PILLOW_HINT = "Pillow is required to optimize images. Install it: pip install Pillow"
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "cosplay"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
python gallery/cosplay/build_manifest.py --images <dir>
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/build_manifest.py - gallery/archetypes/build_manifest.py -
|
||||
gallery/creatures/build_manifest.py
|
||||
gallery/creatures/build_manifest.py - gallery/people/build_manifest.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
``publish.py`` calls this against the images that are actually on ``gh-pages``,
|
||||
@@ -28,7 +28,7 @@ from pathlib import Path
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, REPO_ROOT)
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "cosplay"
|
||||
#: This gallery's key in ``data/versions.py`` (written by
|
||||
#: ``scripts/stamp_versions.py``). Differs from GALLERY_KIND for cosplay,
|
||||
|
||||
@@ -7,10 +7,10 @@ Read-only. Writes ``missing.txt`` / ``orphans.txt`` beside this script (both
|
||||
git-ignored) and prints a summary. Deletes nothing, publishes nothing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -23,7 +23,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "cosplay"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -1,488 +0,0 @@
|
||||
/* =============================================================
|
||||
Identity Forge — Cosplay Gallery Script
|
||||
Lazy-loading image grid with search, lightbox, keyboard nav.
|
||||
============================================================= */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// ── State ──────────────────────────────────────────────
|
||||
const state = {
|
||||
entries: [], // Full list from manifest
|
||||
filtered: [], // Currently filtered subset
|
||||
lightboxIndex: -1, // Current lightbox position in filtered[]
|
||||
observer: null, // IntersectionObserver for lazy loading
|
||||
searchTerm: '',
|
||||
sort: 'az', // 'az' | 'new'
|
||||
onlyMissing: false, // "N missing images" toggle
|
||||
onlyNew: false, // "New in <version>" toggle
|
||||
version: '', // Pack version this manifest was built from
|
||||
rank: new Map(), // release -> position in the release list
|
||||
};
|
||||
|
||||
// Sorting by name is locale-aware and numeric-aware, so "Spider-Man 2" lands
|
||||
// after "Spider-Man" rather than between "Spider-Man 1" and "Spider-Man 10".
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
||||
|
||||
// Remembering the sort is a per-viewer convenience, not state anyone else sees,
|
||||
// so it lives in localStorage -- which throws outright in some privacy modes,
|
||||
// hence the try/catch on BOTH sides.
|
||||
const SORT_KEY = 'if-gallery-sort';
|
||||
function loadSort() {
|
||||
try {
|
||||
const saved = localStorage.getItem(SORT_KEY);
|
||||
if (saved === 'az' || saved === 'new') return saved;
|
||||
} catch (e) { /* private mode, blocked site data - fall through */ }
|
||||
return 'az';
|
||||
}
|
||||
function saveSort(value) {
|
||||
try { localStorage.setItem(SORT_KEY, value); } catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
/* An entry's release, ranked by POSITION in the manifest's release list rather
|
||||
than by comparing the version strings -- "0.10.0" sorts before "0.9.0" as
|
||||
text. An unstamped entry (a user-added one) ranks -1, i.e. oldest. */
|
||||
function rankOf(entry) {
|
||||
const r = state.rank.get(entry.added);
|
||||
return r === undefined ? -1 : r;
|
||||
}
|
||||
|
||||
function isNew(entry) {
|
||||
return Boolean(state.version) && entry.added === state.version;
|
||||
}
|
||||
|
||||
// ── DOM refs ───────────────────────────────────────────
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
const grid = $('#gallery-grid');
|
||||
const searchInput = $('#search');
|
||||
const searchClear = $('#search-clear');
|
||||
const sortSelect = $('#sort');
|
||||
const sortGroup = $('#sort-group');
|
||||
const newFilterBtn = $('#filter-new');
|
||||
const countVisible = $('#count-visible');
|
||||
const countTotal = $('#count-total');
|
||||
const statsMissing = $('#stats-missing');
|
||||
const loadingEl = $('#loading');
|
||||
const noResults = $('#no-results');
|
||||
const clearFiltersBtn = $('#clear-search-btn');
|
||||
const lightbox = $('#lightbox');
|
||||
const lightboxImg = $('#lightbox-img');
|
||||
const lightboxName = $('#lightbox-name');
|
||||
const lightboxClose = $('#lightbox-close');
|
||||
const lightboxPrev = $('#lightbox-prev');
|
||||
const lightboxNext = $('#lightbox-next');
|
||||
|
||||
// ── Load manifest ──────────────────────────────────────
|
||||
async function loadManifest() {
|
||||
try {
|
||||
const resp = await fetch('manifest.json');
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
||||
const data = await resp.json();
|
||||
state.entries = data.entries || [];
|
||||
state.version = data.version || '';
|
||||
// schema_version 1 manifests carry neither field. Everything below then
|
||||
// sees every entry as unstamped, the sort control stays hidden, and the
|
||||
// page behaves exactly as it did before -- no error, no empty control.
|
||||
(data.releases || []).forEach((release, i) => state.rank.set(release, i));
|
||||
state.filtered = [...state.entries];
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.error('Failed to load manifest:', err);
|
||||
loadingEl.innerHTML = '<p style="color:#e06060">⚠ Failed to load gallery data. Please try refreshing.</p>';
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Render ─────────────────────────────────────────────
|
||||
function render() {
|
||||
// Clear grid
|
||||
grid.innerHTML = '';
|
||||
|
||||
// Fires for ANY active narrowing, not just a search. Before 0.97.0 only a
|
||||
// search could empty the grid; the two toggles can too, and an empty grid with
|
||||
// no explanation reads as a broken page.
|
||||
if (state.filtered.length === 0 && isNarrowed()) {
|
||||
noResults.classList.remove('hidden');
|
||||
} else {
|
||||
noResults.classList.add('hidden');
|
||||
}
|
||||
|
||||
// Build cards
|
||||
const fragment = document.createDocumentFragment();
|
||||
state.filtered.forEach((entry, idx) => {
|
||||
const card = createCard(entry, idx);
|
||||
fragment.appendChild(card);
|
||||
});
|
||||
grid.appendChild(fragment);
|
||||
|
||||
// Update stats
|
||||
countVisible.textContent = state.filtered.length;
|
||||
countTotal.textContent = state.entries.length;
|
||||
|
||||
// Update missing count
|
||||
const missingCount = state.entries.filter(e => !e.has_image).length;
|
||||
if (missingCount > 0) {
|
||||
statsMissing.innerHTML = `<span role="button" tabindex="0" title="Show missing entries" id="show-missing-btn">${missingCount} missing image${missingCount !== 1 ? 's' : ''}</span>`;
|
||||
const btn = $('#show-missing-btn');
|
||||
if (btn) {
|
||||
btn.setAttribute('aria-pressed', String(state.onlyMissing));
|
||||
btn.classList.toggle('is-active', state.onlyMissing);
|
||||
btn.addEventListener('click', toggleMissing);
|
||||
btn.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleMissing(); }
|
||||
});
|
||||
}
|
||||
} else {
|
||||
statsMissing.textContent = '';
|
||||
}
|
||||
|
||||
// Re-observe lazy images
|
||||
observeNewImages();
|
||||
}
|
||||
|
||||
function createCard(entry) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'gallery-card' + (entry.has_image ? '' : ' missing');
|
||||
card.setAttribute('role', 'listitem');
|
||||
card.setAttribute('tabindex', '0');
|
||||
card.setAttribute('aria-label', entry.name + (entry.has_image ? '' : ' (no image)'));
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'card-image-wrapper';
|
||||
|
||||
if (entry.has_image) {
|
||||
const img = document.createElement('img');
|
||||
img.setAttribute('data-src', entry.image);
|
||||
img.alt = entry.name;
|
||||
img.loading = 'lazy';
|
||||
// Inline tiny placeholder color to avoid layout shift
|
||||
img.style.backgroundColor = '#1a2a3a';
|
||||
wrapper.appendChild(img);
|
||||
} else {
|
||||
wrapper.classList.add('placeholder');
|
||||
wrapper.innerHTML = '<span class="placeholder-icon" aria-hidden="true">📷</span>';
|
||||
const badge = document.createElement('span');
|
||||
badge.className = 'missing-badge';
|
||||
badge.textContent = 'no image';
|
||||
card.appendChild(badge);
|
||||
}
|
||||
|
||||
if (isNew(entry)) {
|
||||
const tag = document.createElement('span');
|
||||
tag.className = 'new-badge';
|
||||
tag.textContent = 'new';
|
||||
tag.title = 'Added in ' + entry.added;
|
||||
card.appendChild(tag);
|
||||
}
|
||||
|
||||
const nameEl = document.createElement('div');
|
||||
nameEl.className = 'card-name';
|
||||
nameEl.textContent = entry.name;
|
||||
nameEl.title = entry.name + (entry.added ? ' - added in ' + entry.added : '');
|
||||
|
||||
card.appendChild(wrapper);
|
||||
card.appendChild(nameEl);
|
||||
|
||||
// Click handler
|
||||
if (entry.has_image) {
|
||||
card.addEventListener('click', () => openLightbox(entry.name));
|
||||
card.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
openLightbox(entry.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
// ── Lazy Loading ───────────────────────────────────────
|
||||
function observeNewImages() {
|
||||
// Disconnect previous observer
|
||||
if (state.observer) state.observer.disconnect();
|
||||
|
||||
state.observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
const img = entry.target;
|
||||
const src = img.getAttribute('data-src');
|
||||
if (src) {
|
||||
img.src = src;
|
||||
img.removeAttribute('data-src');
|
||||
img.addEventListener('load', () => img.classList.add('loaded'));
|
||||
img.addEventListener('error', () => {
|
||||
// On error, show placeholder
|
||||
img.parentElement.classList.add('placeholder');
|
||||
img.remove();
|
||||
});
|
||||
}
|
||||
state.observer.unobserve(img);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
rootMargin: '200px 0px',
|
||||
threshold: 0.01,
|
||||
}
|
||||
);
|
||||
|
||||
// Observe all images with data-src
|
||||
grid.querySelectorAll('img[data-src]').forEach((img) => {
|
||||
state.observer.observe(img);
|
||||
});
|
||||
}
|
||||
|
||||
// ── Search ─────────────────────────────────────────────
|
||||
function debounce(fn, delay) {
|
||||
let timer;
|
||||
return function (...args) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn.apply(this, args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
/* The single place `state.filtered` is computed. Search, the two toggles and
|
||||
the sort all funnel through here, so they compose instead of overwriting one
|
||||
another -- searching used to clear a "missing images" view, and vice versa. */
|
||||
function applyView() {
|
||||
let list = state.entries;
|
||||
if (state.onlyMissing) list = list.filter((e) => !e.has_image);
|
||||
if (state.onlyNew) list = list.filter(isNew);
|
||||
if (state.searchTerm) {
|
||||
list = list.filter((e) => e.name.toLowerCase().includes(state.searchTerm));
|
||||
}
|
||||
|
||||
// The manifest is already name-sorted, so A-Z needs no work; sorting a copy
|
||||
// matters only for 'new', but both branches copy so `filtered` is never an
|
||||
// alias of `entries`.
|
||||
list = [...list];
|
||||
if (state.sort === 'new') {
|
||||
list.sort((a, b) => rankOf(b) - rankOf(a) || collator.compare(a.name, b.name));
|
||||
}
|
||||
state.filtered = list;
|
||||
|
||||
searchClear.classList.toggle('hidden', !state.searchTerm);
|
||||
if (newFilterBtn) newFilterBtn.setAttribute('aria-pressed', String(state.onlyNew));
|
||||
render();
|
||||
}
|
||||
|
||||
function doSearch(term) {
|
||||
state.searchTerm = term.trim().toLowerCase();
|
||||
applyView();
|
||||
}
|
||||
|
||||
function isNarrowed() {
|
||||
return Boolean(state.searchTerm) || state.onlyMissing || state.onlyNew;
|
||||
}
|
||||
|
||||
/* Resets every narrowing at once. The button for this shipped in the markup from
|
||||
the start but was never wired to anything -- a dead control, and the only exit
|
||||
from a filtered empty state that does not require guessing which control caused
|
||||
it. The sort is deliberately NOT reset: it is a view preference, not a filter. */
|
||||
function clearFilters() {
|
||||
state.searchTerm = '';
|
||||
state.onlyMissing = false;
|
||||
state.onlyNew = false;
|
||||
searchInput.value = '';
|
||||
if (newFilterBtn) newFilterBtn.classList.remove('is-active');
|
||||
applyView();
|
||||
}
|
||||
|
||||
const debouncedSearch = debounce(doSearch, 150);
|
||||
|
||||
searchInput.addEventListener('input', () => {
|
||||
debouncedSearch(searchInput.value);
|
||||
});
|
||||
|
||||
searchClear.addEventListener('click', () => {
|
||||
searchInput.value = '';
|
||||
doSearch('');
|
||||
searchInput.focus();
|
||||
});
|
||||
|
||||
if (clearFiltersBtn) {
|
||||
clearFiltersBtn.addEventListener('click', () => {
|
||||
clearFilters();
|
||||
searchInput.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// ── Show missing ───────────────────────────────────────
|
||||
/* Was: it planted the literal text "missing entries" in the search box, which
|
||||
looked like a query the viewer had typed and could not be un-typed without
|
||||
clearing a real search. It is a toggle now, and it composes with the rest. */
|
||||
function toggleMissing() {
|
||||
state.onlyMissing = !state.onlyMissing;
|
||||
applyView();
|
||||
}
|
||||
|
||||
// ── Lightbox ───────────────────────────────────────────
|
||||
function openLightbox(name) {
|
||||
// Find entry index in filtered list
|
||||
state.lightboxIndex = state.filtered.findIndex(
|
||||
(e) => e.name === name && e.has_image
|
||||
);
|
||||
if (state.lightboxIndex === -1) return;
|
||||
updateLightbox();
|
||||
lightbox.classList.remove('hidden');
|
||||
document.body.style.overflow = 'hidden';
|
||||
lightboxClose.focus();
|
||||
window.addEventListener('keydown', handleLightboxKey);
|
||||
}
|
||||
|
||||
function closeLightbox() {
|
||||
lightbox.classList.add('hidden');
|
||||
document.body.style.overflow = '';
|
||||
state.lightboxIndex = -1;
|
||||
window.removeEventListener('keydown', handleLightboxKey);
|
||||
|
||||
// Refocus the card that was open
|
||||
const name = lightboxName.textContent;
|
||||
const cards = grid.querySelectorAll('.gallery-card');
|
||||
cards.forEach((card) => {
|
||||
if (card.querySelector('.card-name')?.textContent === name) {
|
||||
card.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateLightbox() {
|
||||
const entry = state.filtered[state.lightboxIndex];
|
||||
if (!entry) return;
|
||||
|
||||
lightboxImg.src = entry.image;
|
||||
lightboxImg.alt = entry.name;
|
||||
lightboxName.textContent = entry.name;
|
||||
|
||||
// Update nav button states
|
||||
lightboxPrev.disabled = state.lightboxIndex <= 0;
|
||||
lightboxNext.disabled = state.lightboxIndex >= state.filtered.length - 1;
|
||||
}
|
||||
|
||||
function lightboxPrevImage() {
|
||||
// Find previous entry with an image
|
||||
let idx = state.lightboxIndex - 1;
|
||||
while (idx >= 0) {
|
||||
if (state.filtered[idx].has_image) {
|
||||
state.lightboxIndex = idx;
|
||||
updateLightbox();
|
||||
return;
|
||||
}
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
|
||||
function lightboxNextImage() {
|
||||
let idx = state.lightboxIndex + 1;
|
||||
while (idx < state.filtered.length) {
|
||||
if (state.filtered[idx].has_image) {
|
||||
state.lightboxIndex = idx;
|
||||
updateLightbox();
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
function handleLightboxKey(e) {
|
||||
switch (e.key) {
|
||||
case 'Escape':
|
||||
closeLightbox();
|
||||
break;
|
||||
case 'ArrowLeft':
|
||||
e.preventDefault();
|
||||
lightboxPrevImage();
|
||||
break;
|
||||
case 'ArrowRight':
|
||||
e.preventDefault();
|
||||
lightboxNextImage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lightboxClose.addEventListener('click', closeLightbox);
|
||||
lightboxPrev.addEventListener('click', lightboxPrevImage);
|
||||
lightboxNext.addEventListener('click', lightboxNextImage);
|
||||
|
||||
lightbox.addEventListener('click', (e) => {
|
||||
if (e.target === lightbox) closeLightbox();
|
||||
});
|
||||
|
||||
// ── Keyboard shortcut hint ─────────────────────────────
|
||||
document.addEventListener('keydown', (e) => {
|
||||
// Ctrl+K or / to focus search
|
||||
if ((e.ctrlKey && e.key === 'k') || (e.key === '/' && document.activeElement !== searchInput)) {
|
||||
e.preventDefault();
|
||||
searchInput.focus();
|
||||
searchInput.select();
|
||||
}
|
||||
});
|
||||
|
||||
// ── Sort & filter controls ─────────────────────────────
|
||||
/* Both controls are HIDDEN unless the manifest actually supports them: a sort
|
||||
with nothing to sort by, or a "New in ..." filter that is always present and
|
||||
sometimes empty, only teaches a viewer to ignore the control row. */
|
||||
function setupSortControls() {
|
||||
const stamped = state.rank.size > 0
|
||||
&& state.entries.some((e) => e.added);
|
||||
|
||||
if (sortGroup) sortGroup.hidden = !stamped;
|
||||
if (sortSelect) {
|
||||
if (stamped) {
|
||||
state.sort = loadSort();
|
||||
sortSelect.value = state.sort;
|
||||
sortSelect.addEventListener('change', () => {
|
||||
state.sort = sortSelect.value === 'new' ? 'new' : 'az';
|
||||
saveSort(state.sort);
|
||||
applyView();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (newFilterBtn) {
|
||||
const anyNew = stamped && state.entries.some(isNew);
|
||||
newFilterBtn.hidden = !anyNew;
|
||||
if (anyNew) {
|
||||
newFilterBtn.textContent = 'New in ' + state.version;
|
||||
newFilterBtn.addEventListener('click', () => {
|
||||
state.onlyNew = !state.onlyNew;
|
||||
newFilterBtn.classList.toggle('is-active', state.onlyNew);
|
||||
applyView();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Init ───────────────────────────────────────────────
|
||||
async function init() {
|
||||
try {
|
||||
const manifest = await loadManifest();
|
||||
loadingEl.classList.add('hidden');
|
||||
|
||||
// Update stats
|
||||
countTotal.textContent = manifest.total_entries || state.entries.length;
|
||||
|
||||
setupSortControls();
|
||||
applyView();
|
||||
|
||||
// Focus search on load if no hash
|
||||
if (!window.location.hash) {
|
||||
// Don't auto-focus on mobile to avoid keyboard popup
|
||||
if (window.innerWidth > 768) {
|
||||
searchInput.focus();
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
loadingEl.innerHTML = '<p style="color:#e06060">⚠ Failed to load gallery.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
// Start when DOM is ready
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Identity Forge — Cosplay Sample Gallery</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='7' fill='%231a1a2e'/><circle cx='16' cy='13' r='6.5' fill='%235b8def'/><path d='M6 27c1.5-5 5.5-7.5 10-7.5S24.5 22 26 27Z' fill='%237aa5ff'/></svg>">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="../shared/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -78,6 +78,6 @@
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="gallery.js"></script>
|
||||
<script src="../shared/gallery.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
python gallery/cosplay/publish.py --source <dir> --dry-run # report, change nothing
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/publish.py - gallery/archetypes/publish.py -
|
||||
gallery/creatures/publish.py
|
||||
gallery/creatures/publish.py - gallery/people/publish.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
THE SAFETY MODEL, which is the whole point of this script:
|
||||
@@ -45,17 +45,20 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(REPO_ROOT))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG — the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "cosplay"
|
||||
GALLERY_TITLE = "cosplay character"
|
||||
PAGE_FILES = ["index.html", "style.css", "gallery.js",
|
||||
"Krea2_IdentityForge_CharacterCycle.json"]
|
||||
PAGE_FILES = ["index.html", "Krea2_IdentityForge_CharacterCycle.json"]
|
||||
# ============================================================================
|
||||
|
||||
from build_manifest import entry_names, generate_manifest, normalize_name # noqa: E402
|
||||
from build_gallery_images import optimize_image # noqa: E402
|
||||
|
||||
GALLERY_SRC_DIR = Path(__file__).resolve().parent
|
||||
#: 2.6.0: the page assets every gallery shares, published to gallery/shared/.
|
||||
SHARED_SRC_DIR = GALLERY_SRC_DIR.parent / "shared"
|
||||
SHARED_FILES = ["style.css", "gallery.js"]
|
||||
SHARED_REL_DIR = "gallery/shared"
|
||||
BRANCH = "gh-pages"
|
||||
REL_DIR = f"gallery/{GALLERY_KIND}"
|
||||
|
||||
@@ -247,9 +250,15 @@ def main() -> int:
|
||||
(worktree / REL_DIR / fname).write_text(
|
||||
src.read_text(encoding="utf-8"), encoding="utf-8", newline="")
|
||||
|
||||
for fname in SHARED_FILES:
|
||||
target = worktree / SHARED_REL_DIR / fname
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text((SHARED_SRC_DIR / fname).read_text(encoding="utf-8"),
|
||||
encoding="utf-8", newline="")
|
||||
|
||||
# -A, not a bare add: a plain `git add` stages additions and
|
||||
# modifications but NOT deletions, so a prune would be silently undone.
|
||||
run("git", "add", "-A", REL_DIR, cwd=worktree)
|
||||
run("git", "add", "-A", REL_DIR, SHARED_REL_DIR, cwd=worktree)
|
||||
if not run("git", "status", "--porcelain", cwd=worktree):
|
||||
print("\nNothing changed on the branch.")
|
||||
return 0
|
||||
|
||||
@@ -1,588 +0,0 @@
|
||||
/* =============================================================
|
||||
Identity Forge - Sample Gallery Styles
|
||||
Shared verbatim by the cosplay, archetype and creature galleries;
|
||||
see gallery/README.md before editing (a fix lands three times).
|
||||
Dark theme, tuned for browsing a large lazy-loaded grid.
|
||||
============================================================= */
|
||||
|
||||
/* --- CSS Variables --- */
|
||||
:root {
|
||||
--bg-primary: #1a1a2e;
|
||||
--bg-secondary: #16213e;
|
||||
--bg-card: #1e2a3a;
|
||||
--bg-card-hover: #253545;
|
||||
--bg-input: #0f1824;
|
||||
--text-primary: #e8e8f0;
|
||||
--text-secondary: #9098a8;
|
||||
--text-muted: #606878;
|
||||
--accent: #5b8def;
|
||||
--accent-hover: #7aa5ff;
|
||||
--accent-glow: rgba(91, 141, 239, 0.15);
|
||||
--border: #2a3a50;
|
||||
--border-hover: #4a6a90;
|
||||
--shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
--shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
|
||||
--radius: 8px;
|
||||
--transition: 0.2s ease;
|
||||
--max-width: 1400px;
|
||||
--card-min-width: 200px;
|
||||
--card-max-width: 280px;
|
||||
}
|
||||
|
||||
/* --- Reset & Base --- */
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { color: var(--accent-hover); }
|
||||
|
||||
/* --- Header --- */
|
||||
.gallery-header {
|
||||
text-align: center;
|
||||
padding: 2.5rem 1rem 1.5rem;
|
||||
max-width: var(--max-width);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.gallery-header h1 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.95rem;
|
||||
max-width: 700px;
|
||||
margin: 0 auto 1rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.header-subtitle strong {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.header-links {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.header-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.5rem 1.25rem;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.header-link:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
/* --- Controls --- */
|
||||
.gallery-controls {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: var(--bg-primary);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0.75rem 1rem;
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
max-width: 600px;
|
||||
margin: 0 auto 0.5rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.search-bar input {
|
||||
width: 100%;
|
||||
padding: 0.6rem 1rem;
|
||||
padding-right: 2.5rem;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.95rem;
|
||||
transition: border-color var(--transition), box-shadow var(--transition);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.search-bar input:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
.search-bar input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.search-clear {
|
||||
position: absolute;
|
||||
right: 0.5rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0.5rem;
|
||||
line-height: 1;
|
||||
transition: color var(--transition);
|
||||
}
|
||||
|
||||
.search-clear:hover { color: var(--text-primary); }
|
||||
.search-clear.hidden { display: none; }
|
||||
|
||||
.stats-bar {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.stats-missing {
|
||||
color: #c9a44b;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stats-missing:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* --- Grid --- */
|
||||
.gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
|
||||
gap: 0.75rem;
|
||||
padding: 1rem;
|
||||
max-width: var(--max-width);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* --- Card --- */
|
||||
.gallery-card {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.gallery-card:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--border-hover);
|
||||
box-shadow: var(--shadow-hover);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.gallery-card:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.card-image-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 2 / 3;
|
||||
background: var(--bg-input);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-image-wrapper img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.card-image-wrapper img.loaded {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.card-image-wrapper img:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* Placeholder for missing images */
|
||||
.card-image-wrapper.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg-input);
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 2rem;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.card-name {
|
||||
padding: 0.5rem 0.6rem;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Missing image card styling */
|
||||
.gallery-card.missing {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.gallery-card.missing:hover {
|
||||
opacity: 0.75;
|
||||
transform: none;
|
||||
border-color: var(--border);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.missing-badge {
|
||||
position: absolute;
|
||||
top: 0.25rem;
|
||||
right: 0.25rem;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
color: #c9a44b;
|
||||
font-size: 0.65rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-radius: 3px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* --- Loading --- */
|
||||
.loading-indicator {
|
||||
text-align: center;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.loading-indicator.hidden { display: none; }
|
||||
|
||||
.spinner {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border: 3px solid var(--border);
|
||||
border-top-color: var(--accent);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
margin: 0 auto 0.75rem;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* --- No Results --- */
|
||||
.no-results {
|
||||
text-align: center;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.no-results.hidden { display: none; }
|
||||
|
||||
.btn-secondary {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5rem 1.25rem;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: var(--bg-card-hover);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
/* --- Lightbox --- */
|
||||
.lightbox {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
background: rgba(0, 0, 0, 0.92);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: fadeIn 0.2s ease;
|
||||
}
|
||||
|
||||
.lightbox.hidden { display: none; }
|
||||
|
||||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||||
|
||||
.lightbox-content {
|
||||
position: relative;
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.lightbox-content img {
|
||||
max-width: 90vw;
|
||||
max-height: 80vh;
|
||||
object-fit: contain;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.lightbox-name {
|
||||
margin-top: 0.75rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.lightbox-close {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
right: 1.5rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 2rem;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
z-index: 1001;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition);
|
||||
}
|
||||
|
||||
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
|
||||
|
||||
.lightbox-nav {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 2.5rem;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
z-index: 1001;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition), opacity var(--transition);
|
||||
}
|
||||
|
||||
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
|
||||
.lightbox-nav:disabled { opacity: 0.3; cursor: default; }
|
||||
|
||||
.lightbox-prev { left: 1rem; }
|
||||
.lightbox-next { right: 1rem; }
|
||||
|
||||
/* --- Footer --- */
|
||||
.gallery-footer {
|
||||
text-align: center;
|
||||
padding: 2rem 1rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
border-top: 1px solid var(--border);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
/* --- Keyboard shortcut hint --- */
|
||||
.keyboard-hint {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
color: var(--text-muted);
|
||||
font-size: 0.7rem;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: var(--radius);
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.keyboard-hint.visible { opacity: 1; }
|
||||
|
||||
/* --- Responsive --- */
|
||||
@media (max-width: 600px) {
|
||||
.gallery-header h1 { font-size: 1.35rem; }
|
||||
.header-subtitle { font-size: 0.85rem; }
|
||||
.gallery-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.card-name { font-size: 0.72rem; padding: 0.35rem 0.4rem; }
|
||||
.lightbox-prev { left: 0.25rem; }
|
||||
.lightbox-next { right: 0.25rem; }
|
||||
.lightbox-nav { font-size: 2rem; width: 40px; height: 40px; }
|
||||
}
|
||||
|
||||
/* --- Reduced motion --- */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
html { scroll-behavior: auto; }
|
||||
}
|
||||
|
||||
/* --- View controls: sort + "new in" filter (0.97.0) --------------------- */
|
||||
/* Both children are hidden by gallery.js unless the manifest actually supports
|
||||
them, so an older manifest renders the row empty rather than showing a control
|
||||
that cannot do anything. */
|
||||
.view-controls {
|
||||
max-width: 600px;
|
||||
margin: 0 auto 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.view-controls:empty { display: none; }
|
||||
|
||||
.sort-group {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.sort-group[hidden] { display: none; }
|
||||
|
||||
.sort-label {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.sort-select {
|
||||
padding: 0.3rem 1.6rem 0.3rem 0.6rem;
|
||||
background-color: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-primary);
|
||||
font: inherit;
|
||||
font-size: 0.82rem;
|
||||
cursor: pointer;
|
||||
transition: border-color var(--transition);
|
||||
/* Native select arrows are unstyleable and render light-on-light in a dark
|
||||
control on some platforms, so the arrow is drawn here instead. */
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
|
||||
linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
|
||||
background-position: right 0.75rem center, right 0.5rem center;
|
||||
background-size: 5px 5px, 5px 5px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.sort-select:hover { border-color: var(--border-hover); }
|
||||
|
||||
.sort-select:focus-visible {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
/* The select's own dropdown list is painted by the OS, which does not inherit
|
||||
the page's dark palette -- name the colours so the options are legible. */
|
||||
.sort-select option {
|
||||
background: var(--bg-card);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
padding: 0.3rem 0.7rem;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
color: var(--text-secondary);
|
||||
font: inherit;
|
||||
font-size: 0.78rem;
|
||||
cursor: pointer;
|
||||
transition: background var(--transition), border-color var(--transition),
|
||||
color var(--transition);
|
||||
}
|
||||
|
||||
.filter-chip[hidden] { display: none; }
|
||||
.filter-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }
|
||||
|
||||
.filter-chip:focus-visible {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||
}
|
||||
|
||||
.filter-chip.is-active,
|
||||
.stats-missing .is-active {
|
||||
background: var(--accent-glow);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
/* "new" corner tag on a card added in this release. Sits opposite the existing
|
||||
.missing-badge so the two can never overlap on one card. */
|
||||
.new-badge {
|
||||
position: absolute;
|
||||
top: 0.4rem;
|
||||
left: 0.4rem;
|
||||
z-index: 2;
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
color: #0f1824;
|
||||
font-size: 0.62rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -8,8 +8,8 @@ REM
|
||||
REM Entries you do NOT supply an image for are left completely alone.
|
||||
REM Nothing is ever deleted by this script.
|
||||
REM
|
||||
REM ONE OF THREE NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures).
|
||||
REM Fix a bug here and apply it to the other two - see gallery\README.md.
|
||||
REM ONE OF FOUR NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures / people).
|
||||
REM Fix a bug here and apply it to the other three - see gallery\README.md.
|
||||
REM ==========================================================================
|
||||
setlocal
|
||||
set "GALLERY=cosplay"
|
||||
|
||||
@@ -9,10 +9,10 @@ the gh-pages checkout, so the normal workflow never needs this script directly.
|
||||
Use it when you want a local optimized copy without publishing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/creatures/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -33,7 +33,7 @@ except ImportError: # pragma: no cover - exercised by the dependency-free CI ru
|
||||
|
||||
PILLOW_HINT = "Pillow is required to optimize images. Install it: pip install Pillow"
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "creatures"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
python gallery/creatures/build_manifest.py --images <dir>
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/build_manifest.py - gallery/archetypes/build_manifest.py -
|
||||
gallery/creatures/build_manifest.py
|
||||
gallery/creatures/build_manifest.py - gallery/people/build_manifest.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
``publish.py`` calls this against the images that are actually on ``gh-pages``,
|
||||
@@ -28,7 +28,7 @@ from pathlib import Path
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, REPO_ROOT)
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "creatures"
|
||||
#: This gallery's key in ``data/versions.py`` (written by
|
||||
#: ``scripts/stamp_versions.py``). Differs from GALLERY_KIND for cosplay,
|
||||
|
||||
@@ -7,10 +7,10 @@ Read-only. Writes ``missing.txt`` / ``orphans.txt`` beside this script (both
|
||||
git-ignored) and prints a summary. Deletes nothing, publishes nothing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
gallery/creatures/ - gallery/archetypes/ - gallery/creatures/
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -23,7 +23,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "creatures"
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@@ -1,488 +0,0 @@
|
||||
/* =============================================================
|
||||
Identity Forge — Creature Gallery Script
|
||||
Lazy-loading image grid with search, lightbox, keyboard nav.
|
||||
============================================================= */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// ── State ──────────────────────────────────────────────
|
||||
const state = {
|
||||
entries: [], // Full list from manifest
|
||||
filtered: [], // Currently filtered subset
|
||||
lightboxIndex: -1, // Current lightbox position in filtered[]
|
||||
observer: null, // IntersectionObserver for lazy loading
|
||||
searchTerm: '',
|
||||
sort: 'az', // 'az' | 'new'
|
||||
onlyMissing: false, // "N missing images" toggle
|
||||
onlyNew: false, // "New in <version>" toggle
|
||||
version: '', // Pack version this manifest was built from
|
||||
rank: new Map(), // release -> position in the release list
|
||||
};
|
||||
|
||||
// Sorting by name is locale-aware and numeric-aware, so "Spider-Man 2" lands
|
||||
// after "Spider-Man" rather than between "Spider-Man 1" and "Spider-Man 10".
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
||||
|
||||
// Remembering the sort is a per-viewer convenience, not state anyone else sees,
|
||||
// so it lives in localStorage -- which throws outright in some privacy modes,
|
||||
// hence the try/catch on BOTH sides.
|
||||
const SORT_KEY = 'if-gallery-sort';
|
||||
function loadSort() {
|
||||
try {
|
||||
const saved = localStorage.getItem(SORT_KEY);
|
||||
if (saved === 'az' || saved === 'new') return saved;
|
||||
} catch (e) { /* private mode, blocked site data - fall through */ }
|
||||
return 'az';
|
||||
}
|
||||
function saveSort(value) {
|
||||
try { localStorage.setItem(SORT_KEY, value); } catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
/* An entry's release, ranked by POSITION in the manifest's release list rather
|
||||
than by comparing the version strings -- "0.10.0" sorts before "0.9.0" as
|
||||
text. An unstamped entry (a user-added one) ranks -1, i.e. oldest. */
|
||||
function rankOf(entry) {
|
||||
const r = state.rank.get(entry.added);
|
||||
return r === undefined ? -1 : r;
|
||||
}
|
||||
|
||||
function isNew(entry) {
|
||||
return Boolean(state.version) && entry.added === state.version;
|
||||
}
|
||||
|
||||
// ── DOM refs ───────────────────────────────────────────
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
const grid = $('#gallery-grid');
|
||||
const searchInput = $('#search');
|
||||
const searchClear = $('#search-clear');
|
||||
const sortSelect = $('#sort');
|
||||
const sortGroup = $('#sort-group');
|
||||
const newFilterBtn = $('#filter-new');
|
||||
const countVisible = $('#count-visible');
|
||||
const countTotal = $('#count-total');
|
||||
const statsMissing = $('#stats-missing');
|
||||
const loadingEl = $('#loading');
|
||||
const noResults = $('#no-results');
|
||||
const clearFiltersBtn = $('#clear-search-btn');
|
||||
const lightbox = $('#lightbox');
|
||||
const lightboxImg = $('#lightbox-img');
|
||||
const lightboxName = $('#lightbox-name');
|
||||
const lightboxClose = $('#lightbox-close');
|
||||
const lightboxPrev = $('#lightbox-prev');
|
||||
const lightboxNext = $('#lightbox-next');
|
||||
|
||||
// ── Load manifest ──────────────────────────────────────
|
||||
async function loadManifest() {
|
||||
try {
|
||||
const resp = await fetch('manifest.json');
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
||||
const data = await resp.json();
|
||||
state.entries = data.entries || [];
|
||||
state.version = data.version || '';
|
||||
// schema_version 1 manifests carry neither field. Everything below then
|
||||
// sees every entry as unstamped, the sort control stays hidden, and the
|
||||
// page behaves exactly as it did before -- no error, no empty control.
|
||||
(data.releases || []).forEach((release, i) => state.rank.set(release, i));
|
||||
state.filtered = [...state.entries];
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.error('Failed to load manifest:', err);
|
||||
loadingEl.innerHTML = '<p style="color:#e06060">⚠ Failed to load gallery data. Please try refreshing.</p>';
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Render ─────────────────────────────────────────────
|
||||
function render() {
|
||||
// Clear grid
|
||||
grid.innerHTML = '';
|
||||
|
||||
// Fires for ANY active narrowing, not just a search. Before 0.97.0 only a
|
||||
// search could empty the grid; the two toggles can too, and an empty grid with
|
||||
// no explanation reads as a broken page.
|
||||
if (state.filtered.length === 0 && isNarrowed()) {
|
||||
noResults.classList.remove('hidden');
|
||||
} else {
|
||||
noResults.classList.add('hidden');
|
||||
}
|
||||
|
||||
// Build cards
|
||||
const fragment = document.createDocumentFragment();
|
||||
state.filtered.forEach((entry, idx) => {
|
||||
const card = createCard(entry, idx);
|
||||
fragment.appendChild(card);
|
||||
});
|
||||
grid.appendChild(fragment);
|
||||
|
||||
// Update stats
|
||||
countVisible.textContent = state.filtered.length;
|
||||
countTotal.textContent = state.entries.length;
|
||||
|
||||
// Update missing count
|
||||
const missingCount = state.entries.filter(e => !e.has_image).length;
|
||||
if (missingCount > 0) {
|
||||
statsMissing.innerHTML = `<span role="button" tabindex="0" title="Show missing entries" id="show-missing-btn">${missingCount} missing image${missingCount !== 1 ? 's' : ''}</span>`;
|
||||
const btn = $('#show-missing-btn');
|
||||
if (btn) {
|
||||
btn.setAttribute('aria-pressed', String(state.onlyMissing));
|
||||
btn.classList.toggle('is-active', state.onlyMissing);
|
||||
btn.addEventListener('click', toggleMissing);
|
||||
btn.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleMissing(); }
|
||||
});
|
||||
}
|
||||
} else {
|
||||
statsMissing.textContent = '';
|
||||
}
|
||||
|
||||
// Re-observe lazy images
|
||||
observeNewImages();
|
||||
}
|
||||
|
||||
function createCard(entry) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'gallery-card' + (entry.has_image ? '' : ' missing');
|
||||
card.setAttribute('role', 'listitem');
|
||||
card.setAttribute('tabindex', '0');
|
||||
card.setAttribute('aria-label', entry.name + (entry.has_image ? '' : ' (no image)'));
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'card-image-wrapper';
|
||||
|
||||
if (entry.has_image) {
|
||||
const img = document.createElement('img');
|
||||
img.setAttribute('data-src', entry.image);
|
||||
img.alt = entry.name;
|
||||
img.loading = 'lazy';
|
||||
// Inline tiny placeholder color to avoid layout shift
|
||||
img.style.backgroundColor = '#1a2a3a';
|
||||
wrapper.appendChild(img);
|
||||
} else {
|
||||
wrapper.classList.add('placeholder');
|
||||
wrapper.innerHTML = '<span class="placeholder-icon" aria-hidden="true">📷</span>';
|
||||
const badge = document.createElement('span');
|
||||
badge.className = 'missing-badge';
|
||||
badge.textContent = 'no image';
|
||||
card.appendChild(badge);
|
||||
}
|
||||
|
||||
if (isNew(entry)) {
|
||||
const tag = document.createElement('span');
|
||||
tag.className = 'new-badge';
|
||||
tag.textContent = 'new';
|
||||
tag.title = 'Added in ' + entry.added;
|
||||
card.appendChild(tag);
|
||||
}
|
||||
|
||||
const nameEl = document.createElement('div');
|
||||
nameEl.className = 'card-name';
|
||||
nameEl.textContent = entry.name;
|
||||
nameEl.title = entry.name + (entry.added ? ' - added in ' + entry.added : '');
|
||||
|
||||
card.appendChild(wrapper);
|
||||
card.appendChild(nameEl);
|
||||
|
||||
// Click handler
|
||||
if (entry.has_image) {
|
||||
card.addEventListener('click', () => openLightbox(entry.name));
|
||||
card.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
openLightbox(entry.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
// ── Lazy Loading ───────────────────────────────────────
|
||||
function observeNewImages() {
|
||||
// Disconnect previous observer
|
||||
if (state.observer) state.observer.disconnect();
|
||||
|
||||
state.observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
const img = entry.target;
|
||||
const src = img.getAttribute('data-src');
|
||||
if (src) {
|
||||
img.src = src;
|
||||
img.removeAttribute('data-src');
|
||||
img.addEventListener('load', () => img.classList.add('loaded'));
|
||||
img.addEventListener('error', () => {
|
||||
// On error, show placeholder
|
||||
img.parentElement.classList.add('placeholder');
|
||||
img.remove();
|
||||
});
|
||||
}
|
||||
state.observer.unobserve(img);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
rootMargin: '200px 0px',
|
||||
threshold: 0.01,
|
||||
}
|
||||
);
|
||||
|
||||
// Observe all images with data-src
|
||||
grid.querySelectorAll('img[data-src]').forEach((img) => {
|
||||
state.observer.observe(img);
|
||||
});
|
||||
}
|
||||
|
||||
// ── Search ─────────────────────────────────────────────
|
||||
function debounce(fn, delay) {
|
||||
let timer;
|
||||
return function (...args) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn.apply(this, args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
/* The single place `state.filtered` is computed. Search, the two toggles and
|
||||
the sort all funnel through here, so they compose instead of overwriting one
|
||||
another -- searching used to clear a "missing images" view, and vice versa. */
|
||||
function applyView() {
|
||||
let list = state.entries;
|
||||
if (state.onlyMissing) list = list.filter((e) => !e.has_image);
|
||||
if (state.onlyNew) list = list.filter(isNew);
|
||||
if (state.searchTerm) {
|
||||
list = list.filter((e) => e.name.toLowerCase().includes(state.searchTerm));
|
||||
}
|
||||
|
||||
// The manifest is already name-sorted, so A-Z needs no work; sorting a copy
|
||||
// matters only for 'new', but both branches copy so `filtered` is never an
|
||||
// alias of `entries`.
|
||||
list = [...list];
|
||||
if (state.sort === 'new') {
|
||||
list.sort((a, b) => rankOf(b) - rankOf(a) || collator.compare(a.name, b.name));
|
||||
}
|
||||
state.filtered = list;
|
||||
|
||||
searchClear.classList.toggle('hidden', !state.searchTerm);
|
||||
if (newFilterBtn) newFilterBtn.setAttribute('aria-pressed', String(state.onlyNew));
|
||||
render();
|
||||
}
|
||||
|
||||
function doSearch(term) {
|
||||
state.searchTerm = term.trim().toLowerCase();
|
||||
applyView();
|
||||
}
|
||||
|
||||
function isNarrowed() {
|
||||
return Boolean(state.searchTerm) || state.onlyMissing || state.onlyNew;
|
||||
}
|
||||
|
||||
/* Resets every narrowing at once. The button for this shipped in the markup from
|
||||
the start but was never wired to anything -- a dead control, and the only exit
|
||||
from a filtered empty state that does not require guessing which control caused
|
||||
it. The sort is deliberately NOT reset: it is a view preference, not a filter. */
|
||||
function clearFilters() {
|
||||
state.searchTerm = '';
|
||||
state.onlyMissing = false;
|
||||
state.onlyNew = false;
|
||||
searchInput.value = '';
|
||||
if (newFilterBtn) newFilterBtn.classList.remove('is-active');
|
||||
applyView();
|
||||
}
|
||||
|
||||
const debouncedSearch = debounce(doSearch, 150);
|
||||
|
||||
searchInput.addEventListener('input', () => {
|
||||
debouncedSearch(searchInput.value);
|
||||
});
|
||||
|
||||
searchClear.addEventListener('click', () => {
|
||||
searchInput.value = '';
|
||||
doSearch('');
|
||||
searchInput.focus();
|
||||
});
|
||||
|
||||
if (clearFiltersBtn) {
|
||||
clearFiltersBtn.addEventListener('click', () => {
|
||||
clearFilters();
|
||||
searchInput.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// ── Show missing ───────────────────────────────────────
|
||||
/* Was: it planted the literal text "missing entries" in the search box, which
|
||||
looked like a query the viewer had typed and could not be un-typed without
|
||||
clearing a real search. It is a toggle now, and it composes with the rest. */
|
||||
function toggleMissing() {
|
||||
state.onlyMissing = !state.onlyMissing;
|
||||
applyView();
|
||||
}
|
||||
|
||||
// ── Lightbox ───────────────────────────────────────────
|
||||
function openLightbox(name) {
|
||||
// Find entry index in filtered list
|
||||
state.lightboxIndex = state.filtered.findIndex(
|
||||
(e) => e.name === name && e.has_image
|
||||
);
|
||||
if (state.lightboxIndex === -1) return;
|
||||
updateLightbox();
|
||||
lightbox.classList.remove('hidden');
|
||||
document.body.style.overflow = 'hidden';
|
||||
lightboxClose.focus();
|
||||
window.addEventListener('keydown', handleLightboxKey);
|
||||
}
|
||||
|
||||
function closeLightbox() {
|
||||
lightbox.classList.add('hidden');
|
||||
document.body.style.overflow = '';
|
||||
state.lightboxIndex = -1;
|
||||
window.removeEventListener('keydown', handleLightboxKey);
|
||||
|
||||
// Refocus the card that was open
|
||||
const name = lightboxName.textContent;
|
||||
const cards = grid.querySelectorAll('.gallery-card');
|
||||
cards.forEach((card) => {
|
||||
if (card.querySelector('.card-name')?.textContent === name) {
|
||||
card.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateLightbox() {
|
||||
const entry = state.filtered[state.lightboxIndex];
|
||||
if (!entry) return;
|
||||
|
||||
lightboxImg.src = entry.image;
|
||||
lightboxImg.alt = entry.name;
|
||||
lightboxName.textContent = entry.name;
|
||||
|
||||
// Update nav button states
|
||||
lightboxPrev.disabled = state.lightboxIndex <= 0;
|
||||
lightboxNext.disabled = state.lightboxIndex >= state.filtered.length - 1;
|
||||
}
|
||||
|
||||
function lightboxPrevImage() {
|
||||
// Find previous entry with an image
|
||||
let idx = state.lightboxIndex - 1;
|
||||
while (idx >= 0) {
|
||||
if (state.filtered[idx].has_image) {
|
||||
state.lightboxIndex = idx;
|
||||
updateLightbox();
|
||||
return;
|
||||
}
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
|
||||
function lightboxNextImage() {
|
||||
let idx = state.lightboxIndex + 1;
|
||||
while (idx < state.filtered.length) {
|
||||
if (state.filtered[idx].has_image) {
|
||||
state.lightboxIndex = idx;
|
||||
updateLightbox();
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
function handleLightboxKey(e) {
|
||||
switch (e.key) {
|
||||
case 'Escape':
|
||||
closeLightbox();
|
||||
break;
|
||||
case 'ArrowLeft':
|
||||
e.preventDefault();
|
||||
lightboxPrevImage();
|
||||
break;
|
||||
case 'ArrowRight':
|
||||
e.preventDefault();
|
||||
lightboxNextImage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lightboxClose.addEventListener('click', closeLightbox);
|
||||
lightboxPrev.addEventListener('click', lightboxPrevImage);
|
||||
lightboxNext.addEventListener('click', lightboxNextImage);
|
||||
|
||||
lightbox.addEventListener('click', (e) => {
|
||||
if (e.target === lightbox) closeLightbox();
|
||||
});
|
||||
|
||||
// ── Keyboard shortcut hint ─────────────────────────────
|
||||
document.addEventListener('keydown', (e) => {
|
||||
// Ctrl+K or / to focus search
|
||||
if ((e.ctrlKey && e.key === 'k') || (e.key === '/' && document.activeElement !== searchInput)) {
|
||||
e.preventDefault();
|
||||
searchInput.focus();
|
||||
searchInput.select();
|
||||
}
|
||||
});
|
||||
|
||||
// ── Sort & filter controls ─────────────────────────────
|
||||
/* Both controls are HIDDEN unless the manifest actually supports them: a sort
|
||||
with nothing to sort by, or a "New in ..." filter that is always present and
|
||||
sometimes empty, only teaches a viewer to ignore the control row. */
|
||||
function setupSortControls() {
|
||||
const stamped = state.rank.size > 0
|
||||
&& state.entries.some((e) => e.added);
|
||||
|
||||
if (sortGroup) sortGroup.hidden = !stamped;
|
||||
if (sortSelect) {
|
||||
if (stamped) {
|
||||
state.sort = loadSort();
|
||||
sortSelect.value = state.sort;
|
||||
sortSelect.addEventListener('change', () => {
|
||||
state.sort = sortSelect.value === 'new' ? 'new' : 'az';
|
||||
saveSort(state.sort);
|
||||
applyView();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (newFilterBtn) {
|
||||
const anyNew = stamped && state.entries.some(isNew);
|
||||
newFilterBtn.hidden = !anyNew;
|
||||
if (anyNew) {
|
||||
newFilterBtn.textContent = 'New in ' + state.version;
|
||||
newFilterBtn.addEventListener('click', () => {
|
||||
state.onlyNew = !state.onlyNew;
|
||||
newFilterBtn.classList.toggle('is-active', state.onlyNew);
|
||||
applyView();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Init ───────────────────────────────────────────────
|
||||
async function init() {
|
||||
try {
|
||||
const manifest = await loadManifest();
|
||||
loadingEl.classList.add('hidden');
|
||||
|
||||
// Update stats
|
||||
countTotal.textContent = manifest.total_entries || state.entries.length;
|
||||
|
||||
setupSortControls();
|
||||
applyView();
|
||||
|
||||
// Focus search on load if no hash
|
||||
if (!window.location.hash) {
|
||||
// Don't auto-focus on mobile to avoid keyboard popup
|
||||
if (window.innerWidth > 768) {
|
||||
searchInput.focus();
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
loadingEl.innerHTML = '<p style="color:#e06060">⚠ Failed to load gallery.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
// Start when DOM is ready
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Identity Forge — Creature Sample Gallery</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='7' fill='%231a1a2e'/><circle cx='16' cy='13' r='6.5' fill='%235b8def'/><path d='M6 27c1.5-5 5.5-7.5 10-7.5S24.5 22 26 27Z' fill='%237aa5ff'/></svg>">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="../shared/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -78,6 +78,6 @@
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="gallery.js"></script>
|
||||
<script src="../shared/gallery.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
python gallery/creatures/publish.py --source <dir> --dry-run # report, change nothing
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF THREE NEAR-IDENTICAL COPIES
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/publish.py - gallery/archetypes/publish.py -
|
||||
gallery/creatures/publish.py
|
||||
gallery/creatures/publish.py - gallery/people/publish.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other two (see gallery/README.md).
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
THE SAFETY MODEL, which is the whole point of this script:
|
||||
@@ -45,17 +45,20 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(REPO_ROOT))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG — the only part that differs between the three copies ====
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "creatures"
|
||||
GALLERY_TITLE = "creature form"
|
||||
PAGE_FILES = ["index.html", "style.css", "gallery.js",
|
||||
"Krea2_IdentityForge_CreatureCycle.json"]
|
||||
PAGE_FILES = ["index.html", "Krea2_IdentityForge_CreatureCycle.json"]
|
||||
# ============================================================================
|
||||
|
||||
from build_manifest import entry_names, generate_manifest, normalize_name # noqa: E402
|
||||
from build_gallery_images import optimize_image # noqa: E402
|
||||
|
||||
GALLERY_SRC_DIR = Path(__file__).resolve().parent
|
||||
#: 2.6.0: the page assets every gallery shares, published to gallery/shared/.
|
||||
SHARED_SRC_DIR = GALLERY_SRC_DIR.parent / "shared"
|
||||
SHARED_FILES = ["style.css", "gallery.js"]
|
||||
SHARED_REL_DIR = "gallery/shared"
|
||||
BRANCH = "gh-pages"
|
||||
REL_DIR = f"gallery/{GALLERY_KIND}"
|
||||
|
||||
@@ -247,9 +250,15 @@ def main() -> int:
|
||||
(worktree / REL_DIR / fname).write_text(
|
||||
src.read_text(encoding="utf-8"), encoding="utf-8", newline="")
|
||||
|
||||
for fname in SHARED_FILES:
|
||||
target = worktree / SHARED_REL_DIR / fname
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text((SHARED_SRC_DIR / fname).read_text(encoding="utf-8"),
|
||||
encoding="utf-8", newline="")
|
||||
|
||||
# -A, not a bare add: a plain `git add` stages additions and
|
||||
# modifications but NOT deletions, so a prune would be silently undone.
|
||||
run("git", "add", "-A", REL_DIR, cwd=worktree)
|
||||
run("git", "add", "-A", REL_DIR, SHARED_REL_DIR, cwd=worktree)
|
||||
if not run("git", "status", "--porcelain", cwd=worktree):
|
||||
print("\nNothing changed on the branch.")
|
||||
return 0
|
||||
|
||||
@@ -8,8 +8,8 @@ REM
|
||||
REM Entries you do NOT supply an image for are left completely alone.
|
||||
REM Nothing is ever deleted by this script.
|
||||
REM
|
||||
REM ONE OF THREE NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures).
|
||||
REM Fix a bug here and apply it to the other two - see gallery\README.md.
|
||||
REM ONE OF FOUR NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures / people).
|
||||
REM Fix a bug here and apply it to the other three - see gallery\README.md.
|
||||
REM ==========================================================================
|
||||
setlocal
|
||||
set "GALLERY=creatures"
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
"""Optimize PEOPLE sample images for web display.
|
||||
|
||||
Standalone bulk tool: resize to 600px wide, JPEG quality 80, keep aspect ratio.
|
||||
|
||||
python gallery/people/build_gallery_images.py --source <dir> --output <dir>
|
||||
|
||||
``publish.py`` imports :func:`optimize_image` from here and writes straight into
|
||||
the gh-pages checkout, so the normal workflow never needs this script directly.
|
||||
Use it when you want a local optimized copy without publishing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError: # pragma: no cover - exercised by the dependency-free CI run
|
||||
# Pillow is OPTIONAL and only the encode path needs it. Importing this module
|
||||
# must never kill the process: `publish.py`, `cross_reference.py` and the test
|
||||
# suite all import it, and CI installs no third-party packages at all (the
|
||||
# pack itself is zero-dependency). A `sys.exit(1)` here took the whole test
|
||||
# run down with "ERROR: Pillow is required" the moment tests/test_gallery.py
|
||||
# started importing it.
|
||||
Image = None
|
||||
|
||||
PILLOW_HINT = "Pillow is required to optimize images. Install it: pip install Pillow"
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "people"
|
||||
# ============================================================================
|
||||
|
||||
#: 600px is the widest the gallery grid ever renders a card, so anything larger
|
||||
#: is bytes the visitor downloads and never sees.
|
||||
MAX_WIDTH = 600
|
||||
JPEG_QUALITY = 80
|
||||
|
||||
SOURCE_SUFFIXES = (".jpeg", ".jpg", ".png", ".webp")
|
||||
|
||||
|
||||
def optimize_image(source_path: Path, output_path: Path) -> dict:
|
||||
"""Resize and re-encode one image. Returns a stats dict, never raises."""
|
||||
if Image is None:
|
||||
return {"status": "error", "reason": PILLOW_HINT}
|
||||
source_path = Path(source_path)
|
||||
output_path = Path(output_path)
|
||||
if source_path.suffix.lower() not in SOURCE_SUFFIXES:
|
||||
return {"status": "skipped", "reason": f"not an image ({source_path.suffix})"}
|
||||
|
||||
try:
|
||||
img = Image.open(source_path)
|
||||
# JPEG has no alpha channel; converting first avoids a save error on
|
||||
# PNG/WebP sources with transparency.
|
||||
if img.mode in ("RGBA", "P", "LA"):
|
||||
img = img.convert("RGB")
|
||||
|
||||
original_size = img.size
|
||||
original_bytes = source_path.stat().st_size
|
||||
if img.width > MAX_WIDTH:
|
||||
new_height = int(img.height * (MAX_WIDTH / img.width))
|
||||
img = img.resize((MAX_WIDTH, new_height), Image.LANCZOS)
|
||||
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
img.save(output_path, "JPEG", quality=JPEG_QUALITY, optimize=True)
|
||||
output_bytes = output_path.stat().st_size
|
||||
return {
|
||||
"status": "optimized",
|
||||
"original_size": f"{original_size[0]}x{original_size[1]}",
|
||||
"new_size": f"{img.size[0]}x{img.size[1]}",
|
||||
"original_bytes": original_bytes,
|
||||
"output_bytes": output_bytes,
|
||||
"reduction_pct": round((1 - output_bytes / original_bytes) * 100, 1),
|
||||
}
|
||||
except Exception as exc: # noqa: BLE001 - report and continue the batch
|
||||
return {"status": "error", "reason": str(exc)}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"Optimize {GALLERY_KIND} gallery images for the web.")
|
||||
parser.add_argument("--source", required=True, help="Folder of full-size images.")
|
||||
parser.add_argument("--output", required=True, help="Folder for optimized JPEGs.")
|
||||
parser.add_argument("--dry-run", action="store_true")
|
||||
parser.add_argument("--skip-existing", action="store_true",
|
||||
help="Leave images already present in --output alone.")
|
||||
args = parser.parse_args()
|
||||
|
||||
if Image is None:
|
||||
print(f"ERROR: {PILLOW_HINT}")
|
||||
return 1
|
||||
|
||||
source_dir, output_dir = Path(args.source), Path(args.output)
|
||||
if not source_dir.is_dir():
|
||||
print(f"ERROR: source folder not found: {source_dir}")
|
||||
return 1
|
||||
|
||||
files = sorted((f for f in source_dir.iterdir()
|
||||
if f.suffix.lower() in SOURCE_SUFFIXES),
|
||||
key=lambda f: f.name.lower())
|
||||
print(f"Found {len(files)} image(s) in {source_dir}")
|
||||
print(f"Output: {output_dir} ({MAX_WIDTH}px wide, quality {JPEG_QUALITY})")
|
||||
if args.skip_existing:
|
||||
print("Mode: INCREMENTAL - existing outputs are left alone")
|
||||
if args.dry_run:
|
||||
print("Mode: DRY RUN - nothing will be written")
|
||||
print("-" * 62)
|
||||
|
||||
done = skipped = errors = 0
|
||||
src_mb = out_mb = 0.0
|
||||
for i, path in enumerate(files, 1):
|
||||
dest = output_dir / f"{path.stem}.jpeg"
|
||||
if args.skip_existing and dest.exists():
|
||||
skipped += 1
|
||||
continue
|
||||
if args.dry_run:
|
||||
done += 1
|
||||
continue
|
||||
result = optimize_image(path, dest)
|
||||
if result["status"] == "optimized":
|
||||
done += 1
|
||||
src_mb += result["original_bytes"] / (1024 * 1024)
|
||||
out_mb += result["output_bytes"] / (1024 * 1024)
|
||||
print(f" [{i:4d}/{len(files)}] {path.name[:46]:46s} "
|
||||
f"{result['original_size']} -> {result['new_size']} "
|
||||
f"({result['output_bytes'] // 1024} KB, -{result['reduction_pct']}%)")
|
||||
elif result["status"] == "error":
|
||||
errors += 1
|
||||
print(f" [{i:4d}/{len(files)}] {path.name[:46]:46s} "
|
||||
f"ERROR: {result['reason']}")
|
||||
else:
|
||||
skipped += 1
|
||||
|
||||
print("-" * 62)
|
||||
print(f" Processed: {done} Skipped: {skipped} Errors: {errors}")
|
||||
if not args.dry_run and src_mb:
|
||||
print(f" {src_mb:.1f} MB -> {out_mb:.1f} MB "
|
||||
f"({(1 - out_mb / src_mb) * 100:.1f}% smaller)")
|
||||
return 1 if errors else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,188 @@
|
||||
"""Generate manifest.json for the PEOPLE gallery.
|
||||
|
||||
python gallery/people/build_manifest.py --images <dir>
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/build_manifest.py - gallery/archetypes/build_manifest.py -
|
||||
gallery/creatures/build_manifest.py - gallery/people/build_manifest.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
``publish.py`` calls this against the images that are actually on ``gh-pages``,
|
||||
which is what makes "an entry you did not supply is left alone" true. Running it
|
||||
by hand against some *other* folder describes that folder instead -- fine for a
|
||||
local preview, dangerous if you then publish it. ``publish.py`` never does that.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import unicodedata
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, REPO_ROOT)
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "people"
|
||||
#: A sample is a seed, not a roster entry, so ``data/versions.py`` has no stamps
|
||||
#: for it and the page hides its sort controls.
|
||||
VERSIONS_KIND = "people"
|
||||
|
||||
sys.path.insert(0, os.path.join(REPO_ROOT, "scripts"))
|
||||
from render_gallery import PEOPLE, people_card # noqa: E402
|
||||
|
||||
def entry_names() -> list[str]:
|
||||
"""Every fixed-seed sample (``PEOPLE`` in scripts/render_gallery.py)."""
|
||||
return list(PEOPLE)
|
||||
|
||||
|
||||
def entry_meta(name: str) -> dict:
|
||||
"""The card's seed and settings line, and the full prompt (searchable on the page)."""
|
||||
return people_card(name)
|
||||
# ============================================================================
|
||||
|
||||
DEFAULT_OUTPUT = os.path.join(os.path.dirname(__file__), "manifest.json")
|
||||
|
||||
|
||||
def pack_version() -> str:
|
||||
"""The version in ``pyproject.toml``, used for the "New in ..." filter."""
|
||||
import re
|
||||
text = (Path(REPO_ROOT) / "pyproject.toml").read_text(encoding="utf-8")
|
||||
match = re.search(r'(?m)^version\s*=\s*"([^"]+)"', text)
|
||||
return match.group(1) if match else ""
|
||||
|
||||
|
||||
def release_order() -> tuple:
|
||||
"""Every release that shipped roster content, oldest first."""
|
||||
from data.versions import RELEASES
|
||||
return RELEASES
|
||||
|
||||
|
||||
def release_stamps() -> dict:
|
||||
"""``{entry name: release}`` for this gallery's kind.
|
||||
|
||||
Written by ``scripts/stamp_versions.py`` and checked in CI. An entry with no
|
||||
stamp (a user-added one) gets ``""`` and the page treats it as oldest.
|
||||
"""
|
||||
from data.versions import ADDED_IN
|
||||
return dict(ADDED_IN.get(VERSIONS_KIND, {}))
|
||||
|
||||
|
||||
|
||||
#: Characters no Windows (and, for ``/``, no POSIX) filename may contain. A roster
|
||||
#: name is a display label, not a filename, so any entry is free to use them --
|
||||
#: ``B-Boy / B-Girl`` reads correctly in the dropdown and must not be renamed just
|
||||
#: to suit the gallery. The saving side strips them silently, so the MATCHING side
|
||||
#: has to do the same or the image can never be paired with its entry.
|
||||
_UNSAFE_FILENAME_CHARS = re.compile(r'[<>:"/\\|?*]')
|
||||
|
||||
|
||||
def normalize_name(name: str) -> str:
|
||||
"""Normalize a name for filename comparison.
|
||||
|
||||
Three separate things Windows does to a name on its way to disk, each of which
|
||||
silently broke the pairing before it was handled here:
|
||||
|
||||
* **Trailing period dropped** -- the entry ``C.C.`` lands as ``C.C.jpeg``.
|
||||
Without this, that entry was reported as *both* missing an image and having
|
||||
an orphaned one, on every single run.
|
||||
* **Illegal characters removed** -- ``B-Boy / B-Girl`` is saved as
|
||||
``B-Boy B-Girl.jpeg``. Substituting a space (not the empty string) is what
|
||||
makes the stripped filename and the original label converge, since the label
|
||||
already has spaces either side of the slash.
|
||||
* **Whitespace runs** -- the substitution above leaves a double space, and a
|
||||
hand-typed filename may differ in spacing anyway. Collapsing both sides makes
|
||||
``B-Boy B-Girl`` and ``B-Boy B-Girl`` the same key.
|
||||
|
||||
Callers that build a *filename* use this too, so the canonical on-disk form is
|
||||
whatever this returns. NFC last, so a decomposed accent from a Mac-authored
|
||||
filename matches a composed one in the roster.
|
||||
"""
|
||||
name = _UNSAFE_FILENAME_CHARS.sub(" ", name)
|
||||
name = name.rstrip(". ")
|
||||
name = " ".join(name.split())
|
||||
return unicodedata.normalize("NFC", name)
|
||||
|
||||
|
||||
def generate_manifest(images_dir: str, output_path: str) -> dict:
|
||||
"""Build the manifest describing ``images_dir``."""
|
||||
images_path = Path(images_dir)
|
||||
if not images_path.is_dir():
|
||||
# Fail loudly. Continuing would emit a well-formed manifest in which
|
||||
# every entry has has_image=false -- a silently wrong artifact that,
|
||||
# once published, blanks the live gallery.
|
||||
raise SystemExit(
|
||||
f"ERROR: images directory not found: {images_dir}\n"
|
||||
f"Refusing to write a manifest claiming no entry has an image."
|
||||
)
|
||||
|
||||
available: dict[str, str] = {}
|
||||
for f in images_path.iterdir():
|
||||
if f.suffix.lower() == ".jpeg":
|
||||
available.setdefault(normalize_name(f.stem), f.stem)
|
||||
|
||||
stamps = release_stamps()
|
||||
|
||||
entries, missing = [], []
|
||||
for name in sorted(entry_names()):
|
||||
stem = available.get(normalize_name(name))
|
||||
entry = {"name": name, "has_image": stem is not None, **entry_meta(name)}
|
||||
# The release this entry first shipped in, "" for a user-added one. The page
|
||||
# ranks by POSITION IN ``releases`` below, never by parsing this string --
|
||||
# "0.10.0" sorts before "0.9.0" as text.
|
||||
entry["added"] = stamps.get(name, "")
|
||||
if stem is not None:
|
||||
entry["image"] = f"images/{stem}.jpeg"
|
||||
else:
|
||||
missing.append(name)
|
||||
entries.append(entry)
|
||||
|
||||
manifest = {
|
||||
# 2 (0.97.0): entries gained "added", and the manifest gained
|
||||
# "version" + "releases", so the page can offer a Newest-first sort.
|
||||
# A page served an older manifest simply sees every entry as unstamped
|
||||
# and falls back to A-Z, so the bump is informational.
|
||||
"schema_version": 2,
|
||||
"gallery": GALLERY_KIND,
|
||||
"generated": __import__("datetime").datetime.now().isoformat(),
|
||||
"version": pack_version(),
|
||||
"releases": list(release_order()),
|
||||
"total_entries": len(entries),
|
||||
"entries_with_images": len(entries) - len(missing),
|
||||
"entries_missing_images": len(missing),
|
||||
"missing": sorted(missing),
|
||||
"entries": entries,
|
||||
}
|
||||
|
||||
out_dir = os.path.dirname(output_path)
|
||||
if out_dir:
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
with open(output_path, "w", encoding="utf-8") as f:
|
||||
json.dump(manifest, f, indent=2, ensure_ascii=False)
|
||||
return manifest
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"Generate the {GALLERY_KIND} gallery manifest.")
|
||||
parser.add_argument("--images", required=True,
|
||||
help="Directory of optimized JPEGs to describe.")
|
||||
parser.add_argument("--output", default=DEFAULT_OUTPUT)
|
||||
args = parser.parse_args()
|
||||
|
||||
manifest = generate_manifest(args.images, args.output)
|
||||
print(f" Total entries: {manifest['total_entries']}")
|
||||
print(f" With images: {manifest['entries_with_images']}")
|
||||
print(f" Missing images: {manifest['entries_missing_images']}")
|
||||
print(f"Written to {args.output}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,103 @@
|
||||
"""Report which PEOPLE samples still need an image.
|
||||
|
||||
python gallery/people/cross_reference.py # against gh-pages
|
||||
python gallery/people/cross_reference.py --images <dir> # against a folder
|
||||
|
||||
Read-only. Writes ``missing.txt`` / ``orphans.txt`` beside this script (both
|
||||
git-ignored) and prints a summary. Deletes nothing, publishes nothing.
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/ - gallery/archetypes/ - gallery/creatures/ - gallery/people/
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "people"
|
||||
# ============================================================================
|
||||
|
||||
from build_manifest import entry_names, normalize_name # noqa: E402
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
BRANCH = "gh-pages"
|
||||
|
||||
|
||||
def published_stems() -> set[str]:
|
||||
"""Image stems currently on the gh-pages branch, read without checking out."""
|
||||
listing = subprocess.run(
|
||||
["git", "ls-tree", "-r", "--name-only", BRANCH,
|
||||
f"gallery/{GALLERY_KIND}/images/"],
|
||||
capture_output=True, text=True, cwd=str(REPO_ROOT),
|
||||
)
|
||||
if listing.returncode != 0:
|
||||
print(f"WARNING: could not read branch {BRANCH}; treating it as empty.")
|
||||
return set()
|
||||
return {normalize_name(Path(line).stem)
|
||||
for line in listing.stdout.splitlines() if line.endswith(".jpeg")}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"Report {GALLERY_KIND} gallery image coverage.")
|
||||
parser.add_argument("--images", help="Check a local folder instead of gh-pages.")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.images:
|
||||
folder = Path(args.images)
|
||||
if not folder.is_dir():
|
||||
print(f"ERROR: folder not found: {folder}")
|
||||
return 1
|
||||
have = {normalize_name(f.stem) for f in folder.iterdir()
|
||||
if f.suffix.lower() == ".jpeg"}
|
||||
source_label = str(folder)
|
||||
else:
|
||||
have = published_stems()
|
||||
source_label = f"branch {BRANCH}"
|
||||
|
||||
names = entry_names()
|
||||
wanted = {normalize_name(n): n for n in names}
|
||||
|
||||
missing = sorted(orig for norm, orig in wanted.items() if norm not in have)
|
||||
orphans = sorted(stem for stem in have if stem not in wanted)
|
||||
|
||||
print(f"Gallery : {GALLERY_KIND}")
|
||||
print(f"Images : {source_label}")
|
||||
print(f"Entries : {len(names)}")
|
||||
print(f" with an image : {len(names) - len(missing)}")
|
||||
print(f" MISSING : {len(missing)}")
|
||||
print(f" orphaned files: {len(orphans)} (no roster entry matches these)")
|
||||
|
||||
(HERE / "missing.txt").write_text(
|
||||
"\n".join(missing) + ("\n" if missing else ""), encoding="utf-8")
|
||||
(HERE / "orphans.txt").write_text(
|
||||
"\n".join(orphans) + ("\n" if orphans else ""), encoding="utf-8")
|
||||
|
||||
if missing:
|
||||
print("\n--- Entries needing an image (first 25) ---")
|
||||
for name in missing[:25]:
|
||||
print(f" {name}")
|
||||
if len(missing) > 25:
|
||||
print(f" ... and {len(missing) - 25} more (see missing.txt)")
|
||||
if orphans:
|
||||
print("\n--- Orphaned images (first 25) ---")
|
||||
for stem in orphans[:25]:
|
||||
print(f" {stem}.jpeg")
|
||||
print("\nThese match no roster entry, usually because the entry was "
|
||||
"renamed or removed.\nRemove them with: publish.py --prune-orphans")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Identity Forge - People Sample Gallery</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='7' fill='%231a1a2e'/><circle cx='16' cy='13' r='6.5' fill='%235b8def'/><path d='M6 27c1.5-5 5.5-7.5 10-7.5S24.5 22 26 27Z' fill='%237aa5ff'/></svg>">
|
||||
<link rel="stylesheet" href="../shared/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="gallery-header">
|
||||
<h1>Identity Forge - People Sample Gallery</h1>
|
||||
<p class="header-subtitle">
|
||||
Random people from the plain <strong>Identity Forge</strong> node, no preset nodes, rendered with the <strong>Krea2 T2I model</strong>.
|
||||
Each card shows its seed and the prompt the node wrote; every other widget was left at its default,
|
||||
so the same seed and gender give the same prompt on your machine (the images were rendered with a short photo style prefix in front of it).
|
||||
</p>
|
||||
<div class="header-links">
|
||||
<a href="https://github.com/EnragedAntelope/comfyui-identity-forge/blob/main/docs/usage.md" class="header-link" target="_blank" rel="noopener">
|
||||
How to use the node
|
||||
</a>
|
||||
<a href="https://github.com/EnragedAntelope/comfyui-identity-forge" class="header-link" target="_blank" rel="noopener">
|
||||
View on GitHub
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="gallery-controls">
|
||||
<div class="search-bar">
|
||||
<input type="text" id="search" placeholder="Search prompts (beach, 70-year-old, linen...)" autocomplete="off" aria-label="Search the sample prompts">
|
||||
<button id="search-clear" class="search-clear hidden" aria-label="Clear search">×</button>
|
||||
</div>
|
||||
<div class="view-controls">
|
||||
<span class="sort-group" id="sort-group" hidden>
|
||||
<label class="sort-label" for="sort">Sort</label>
|
||||
<select id="sort" class="sort-select">
|
||||
<option value="az">A-Z</option>
|
||||
<option value="new">Newest first</option>
|
||||
</select>
|
||||
</span>
|
||||
<button type="button" id="filter-new" class="filter-chip" aria-pressed="false" hidden></button>
|
||||
</div>
|
||||
<div class="stats-bar">
|
||||
<span id="stats-visible">Showing <strong id="count-visible">0</strong> of <strong id="count-total">0</strong> entries</span>
|
||||
<span id="stats-missing" class="stats-missing"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="gallery-grid" class="gallery-grid" role="list" aria-label="People sample gallery">
|
||||
<!-- Cards injected by gallery.js -->
|
||||
</div>
|
||||
|
||||
<div id="loading" class="loading-indicator">
|
||||
<div class="spinner"></div>
|
||||
<p>Loading gallery...</p>
|
||||
</div>
|
||||
|
||||
<div id="no-results" class="no-results hidden">
|
||||
<p>Nothing matches the current filters.</p>
|
||||
<button type="button" id="clear-search-btn" class="btn-secondary">Clear filters</button>
|
||||
</div>
|
||||
|
||||
<!-- Lightbox Modal -->
|
||||
<div id="lightbox" class="lightbox hidden" role="dialog" aria-modal="true" aria-label="Image preview">
|
||||
<button id="lightbox-close" class="lightbox-close" aria-label="Close">×</button>
|
||||
<button id="lightbox-prev" class="lightbox-nav lightbox-prev" aria-label="Previous image">‹</button>
|
||||
<button id="lightbox-next" class="lightbox-nav lightbox-next" aria-label="Next image">›</button>
|
||||
<div class="lightbox-content">
|
||||
<img id="lightbox-img" src="" alt="">
|
||||
<p id="lightbox-name" class="lightbox-name"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="gallery-footer">
|
||||
<p>
|
||||
Powered by <a href="https://github.com/EnragedAntelope/comfyui-identity-forge" target="_blank" rel="noopener">ComfyUI Identity Forge</a>.
|
||||
Gallery images are not included in the main repository download.
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="../shared/gallery.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,291 @@
|
||||
"""Publish the PEOPLE gallery: optimize, stage and push, in one pass.
|
||||
|
||||
python gallery/people/publish.py --source <dir> # add missing only
|
||||
python gallery/people/publish.py --source <dir> --overwrite # also replace existing
|
||||
python gallery/people/publish.py --source <dir> --dry-run # report, change nothing
|
||||
|
||||
=============================================================================
|
||||
THIS FILE IS ONE OF FOUR NEAR-IDENTICAL COPIES
|
||||
gallery/cosplay/publish.py - gallery/archetypes/publish.py -
|
||||
gallery/creatures/publish.py - gallery/people/publish.py
|
||||
They differ ONLY in the GALLERY CONFIG block below. Fix a bug here and apply
|
||||
it to the other three (see gallery/README.md).
|
||||
=============================================================================
|
||||
|
||||
THE SAFETY MODEL, which is the whole point of this script:
|
||||
|
||||
* ``gh-pages`` is the source of truth for what is published. The manifest is
|
||||
rebuilt from the files that are actually on the branch AFTER staging, never
|
||||
from the source folder.
|
||||
* The source folder only ever ADDS or OVERWRITES. An entry you did not supply
|
||||
an image for is not touched, not re-encoded, and above all not deleted.
|
||||
* Nothing is removed unless you pass ``--prune-orphans``, and even then only
|
||||
images whose filename matches no roster entry at all - i.e. a sample that
|
||||
was renamed or deleted in the data, never one that is merely absent from
|
||||
this run's source folder.
|
||||
|
||||
The predecessor (``deploy.py``, removed at 0.80.0) got this wrong in a way that
|
||||
could have destroyed the gallery: it built the manifest from the source folder,
|
||||
so pointing it at a folder of five new images marked every other entry as
|
||||
image-less, and its prune step would then have deleted them all from the branch.
|
||||
|
||||
It also switched branches in place with ``git stash``/``git checkout``, which
|
||||
runs over whatever is in your working tree. This uses ``git worktree`` instead,
|
||||
which touches the current checkout not at all.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(REPO_ROOT))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
# === GALLERY CONFIG - the only part that differs between the four copies ====
|
||||
GALLERY_KIND = "people"
|
||||
GALLERY_TITLE = "random people"
|
||||
PAGE_FILES = ["index.html"]
|
||||
# ============================================================================
|
||||
|
||||
from build_manifest import entry_names, generate_manifest, normalize_name # noqa: E402
|
||||
from build_gallery_images import optimize_image # noqa: E402
|
||||
|
||||
GALLERY_SRC_DIR = Path(__file__).resolve().parent
|
||||
#: 2.6.0: the page assets every gallery shares, published to gallery/shared/.
|
||||
SHARED_SRC_DIR = GALLERY_SRC_DIR.parent / "shared"
|
||||
SHARED_FILES = ["style.css", "gallery.js"]
|
||||
SHARED_REL_DIR = "gallery/shared"
|
||||
BRANCH = "gh-pages"
|
||||
REL_DIR = f"gallery/{GALLERY_KIND}"
|
||||
|
||||
|
||||
def run(*cmd: str, cwd: Path | None = None) -> str:
|
||||
"""Run a git command from argv words.
|
||||
|
||||
Never ``shell=True``: the commit message is user-supplied, and interpolating
|
||||
it into a shell string means a quote breaks the command and a semicolon runs
|
||||
as shell syntax.
|
||||
"""
|
||||
result = subprocess.run(cmd, capture_output=True, text=True,
|
||||
cwd=str(cwd or REPO_ROOT))
|
||||
out = (result.stdout + result.stderr).strip()
|
||||
if result.returncode != 0:
|
||||
print(f" COMMAND FAILED: {' '.join(cmd)}")
|
||||
print(f" {out}")
|
||||
raise RuntimeError(f"git exited {result.returncode}")
|
||||
return out
|
||||
|
||||
|
||||
def published_stems(images_dir: Path) -> dict[str, Path]:
|
||||
"""Map ``normalize_name(stem) -> path`` for every image already on the branch.
|
||||
|
||||
Both callers below used to compare a **raw** ``Path.stem`` against normalized
|
||||
roster names. Any entry whose label cannot be a filename verbatim therefore
|
||||
never matched its own published image: add-mode would re-encode it on every
|
||||
run, and ``--prune-orphans`` would classify it as belonging to no roster entry
|
||||
and DELETE it. That is exactly what would have happened to the two hand-added
|
||||
``B-Boy / B-Girl`` and ``E-Girl / E-Boy`` images.
|
||||
"""
|
||||
return {normalize_name(p.stem): p for p in images_dir.glob("*.jpeg")}
|
||||
|
||||
|
||||
def match_sources(source_dir: Path) -> tuple[dict[str, Path], list[Path]]:
|
||||
"""Pair source images with roster entries by filename stem.
|
||||
|
||||
Returns ``({entry_name: source_path}, [unmatched_files])``. Unmatched files
|
||||
are reported rather than published: a typo in a filename would otherwise put
|
||||
an image on the site under a name no dropdown can ever reach.
|
||||
"""
|
||||
by_norm = {normalize_name(name): name for name in entry_names()}
|
||||
matched: dict[str, Path] = {}
|
||||
unmatched: list[Path] = []
|
||||
for path in sorted(source_dir.iterdir(), key=lambda p: p.name.lower()):
|
||||
if path.suffix.lower() not in (".jpeg", ".jpg", ".png", ".webp"):
|
||||
continue
|
||||
entry = by_norm.get(normalize_name(path.stem))
|
||||
if entry is None:
|
||||
unmatched.append(path)
|
||||
else:
|
||||
matched[entry] = path
|
||||
return matched, unmatched
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"Publish the {GALLERY_KIND} gallery to the {BRANCH} branch.")
|
||||
parser.add_argument("--source",
|
||||
help="Folder of full-size images named after entries. "
|
||||
"Required unless --pages-only.")
|
||||
parser.add_argument("--overwrite", action="store_true",
|
||||
help="Replace images for entries that already have one. "
|
||||
"Default is to add only what is missing.")
|
||||
parser.add_argument("--dry-run", action="store_true",
|
||||
help="Report the plan and exit without changing anything.")
|
||||
parser.add_argument("--prune-orphans", action="store_true",
|
||||
help="Also delete published images matching no roster "
|
||||
"entry (renamed/deleted characters). Off by default.")
|
||||
parser.add_argument("--pages-only", action="store_true",
|
||||
help="Publish only the page files (HTML/CSS/JS) and "
|
||||
"refresh the manifest. No --source needed, and no "
|
||||
"image is added, replaced or removed.")
|
||||
parser.add_argument("--no-push", action="store_true",
|
||||
help="Commit to the local branch but do not push. Lets you "
|
||||
"inspect the result before it goes live.")
|
||||
parser.add_argument("--message", default=f"Update {GALLERY_KIND} gallery",
|
||||
help="Commit message.")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.pages_only:
|
||||
source_dir, matched, unmatched = None, {}, []
|
||||
else:
|
||||
if not args.source:
|
||||
print("ERROR: --source is required (or use --pages-only).")
|
||||
return 1
|
||||
source_dir = Path(args.source)
|
||||
if not source_dir.is_dir():
|
||||
print(f"ERROR: source folder not found: {source_dir}")
|
||||
return 1
|
||||
matched, unmatched = match_sources(source_dir)
|
||||
print(f"Gallery : {GALLERY_KIND}")
|
||||
if args.pages_only:
|
||||
mode = "PAGE FILES ONLY - no image added, replaced or removed"
|
||||
elif args.overwrite:
|
||||
mode = "OVERWRITE existing"
|
||||
else:
|
||||
mode = "ADD missing only"
|
||||
print(f"Source folder: {source_dir or '(not used)'}")
|
||||
print(f"Mode : {mode}")
|
||||
print(f"Roster : {len(entry_names())} entries")
|
||||
print(f"Source images : {len(matched)} matched, {len(unmatched)} unmatched")
|
||||
if unmatched:
|
||||
print("\n These files match no roster entry and will be IGNORED "
|
||||
"(check the spelling):")
|
||||
for path in unmatched[:20]:
|
||||
print(f" ? {path.name}")
|
||||
if len(unmatched) > 20:
|
||||
print(f" ... and {len(unmatched) - 20} more")
|
||||
if not matched and not args.pages_only:
|
||||
print()
|
||||
print("Nothing to publish. Stopping before touching the branch.")
|
||||
return 0
|
||||
|
||||
worktree = Path(tempfile.mkdtemp(prefix=f"ifgallery-{GALLERY_KIND}-"))
|
||||
created = False
|
||||
try:
|
||||
print(f"\nChecking out {BRANCH} into a temporary worktree...")
|
||||
print("(your current checkout is not touched)")
|
||||
run("git", "worktree", "add", str(worktree), BRANCH)
|
||||
created = True
|
||||
run("git", "pull", "--ff-only", "origin", BRANCH, cwd=worktree)
|
||||
|
||||
images_dir = worktree / "gallery" / GALLERY_KIND / "images"
|
||||
images_dir.mkdir(parents=True, exist_ok=True)
|
||||
published = published_stems(images_dir)
|
||||
print(f"Already published: {len(published)} image(s)")
|
||||
|
||||
# Decide per entry. An entry that already has an image and was not
|
||||
# supplied this run never appears here at all -- that is the guarantee.
|
||||
to_write, skipped = {}, []
|
||||
for entry, src in matched.items():
|
||||
if normalize_name(entry) in published and not args.overwrite:
|
||||
skipped.append(entry)
|
||||
else:
|
||||
to_write[entry] = src
|
||||
|
||||
print(f"\nPlan: {len(to_write)} to write, {len(skipped)} already present "
|
||||
f"(left untouched), {len(published) - len(skipped)} untouched entries "
|
||||
f"not in this source folder")
|
||||
|
||||
orphans = []
|
||||
if args.prune_orphans:
|
||||
keep = {normalize_name(n) for n in entry_names()}
|
||||
orphans = sorted(p.name for norm, p in published_stems(images_dir).items()
|
||||
if norm not in keep)
|
||||
print(f"Orphans to prune: {len(orphans)}")
|
||||
for name in orphans:
|
||||
print(f" - {name}")
|
||||
|
||||
if args.dry_run:
|
||||
print("\nDRY RUN - nothing written, nothing committed, nothing pushed.")
|
||||
for entry in sorted(to_write)[:30]:
|
||||
print(f" + {entry}")
|
||||
if len(to_write) > 30:
|
||||
print(f" ... and {len(to_write) - 30} more")
|
||||
return 0
|
||||
|
||||
# Optimize straight into the branch checkout. No intermediate staging
|
||||
# directory to go stale and be published by accident on a later run.
|
||||
print()
|
||||
written = errors = 0
|
||||
for i, entry in enumerate(sorted(to_write), 1):
|
||||
dest = images_dir / f"{normalize_name(entry)}.jpeg"
|
||||
result = optimize_image(to_write[entry], dest)
|
||||
if result["status"] == "optimized":
|
||||
written += 1
|
||||
print(f" [{i:4d}/{len(to_write)}] {entry[:48]:48s} "
|
||||
f"{result['new_size']} ({result['output_bytes'] // 1024} KB)")
|
||||
else:
|
||||
errors += 1
|
||||
print(f" [{i:4d}/{len(to_write)}] {entry[:48]:48s} "
|
||||
f"ERROR: {result.get('reason')}")
|
||||
|
||||
for name in orphans:
|
||||
(images_dir / name).unlink()
|
||||
|
||||
# Rebuild the manifest from what is ACTUALLY on the branch now. This is
|
||||
# the line that makes the safety guarantee true rather than aspirational.
|
||||
manifest = generate_manifest(str(images_dir),
|
||||
str(images_dir.parent / "manifest.json"))
|
||||
print(f"\nManifest: {manifest['total_entries']} entries, "
|
||||
f"{manifest['entries_with_images']} with images, "
|
||||
f"{manifest['entries_missing_images']} still missing")
|
||||
|
||||
for fname in PAGE_FILES:
|
||||
src = GALLERY_SRC_DIR / fname
|
||||
if src.exists():
|
||||
(worktree / REL_DIR / fname).write_text(
|
||||
src.read_text(encoding="utf-8"), encoding="utf-8", newline="")
|
||||
|
||||
for fname in SHARED_FILES:
|
||||
target = worktree / SHARED_REL_DIR / fname
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text((SHARED_SRC_DIR / fname).read_text(encoding="utf-8"),
|
||||
encoding="utf-8", newline="")
|
||||
|
||||
# -A, not a bare add: a plain `git add` stages additions and
|
||||
# modifications but NOT deletions, so a prune would be silently undone.
|
||||
run("git", "add", "-A", REL_DIR, SHARED_REL_DIR, cwd=worktree)
|
||||
if not run("git", "status", "--porcelain", cwd=worktree):
|
||||
print("\nNothing changed on the branch.")
|
||||
return 0
|
||||
|
||||
run("git", "commit", "-m", args.message, cwd=worktree)
|
||||
if args.no_push:
|
||||
print()
|
||||
print(f"Committed to the local {BRANCH} branch but NOT pushed.")
|
||||
print(f"Review it: git log {BRANCH} -1 --stat")
|
||||
print(f"Publish it: git push origin {BRANCH}")
|
||||
print(f"Discard it: git branch -f {BRANCH} origin/{BRANCH}")
|
||||
return 1 if errors else 0
|
||||
print("Pushing...")
|
||||
run("git", "push", "origin", BRANCH, cwd=worktree)
|
||||
print(f"\nDone. {written} image(s) published"
|
||||
+ (f", {errors} error(s)" if errors else "") + ".")
|
||||
print(f"https://enragedantelope.github.io/comfyui-identity-forge/{REL_DIR}/")
|
||||
return 1 if errors else 0
|
||||
|
||||
finally:
|
||||
if created:
|
||||
try:
|
||||
run("git", "worktree", "remove", "--force", str(worktree))
|
||||
except RuntimeError:
|
||||
print(f"WARNING: could not remove the temporary worktree at "
|
||||
f"{worktree}.\n Run: git worktree prune")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,115 @@
|
||||
@echo off
|
||||
REM ==========================================================================
|
||||
REM Identity Forge - publish the PEOPLE sample gallery
|
||||
REM
|
||||
REM Drag a folder of images onto this file, or run it and type the path.
|
||||
REM Images must be named after the entry: "Elven Ranger.jpeg", "Pop Star.png", ...
|
||||
REM
|
||||
REM Entries you do NOT supply an image for are left completely alone.
|
||||
REM Nothing is ever deleted by this script.
|
||||
REM
|
||||
REM ONE OF FOUR NEAR-IDENTICAL COPIES (cosplay / archetypes / creatures / people).
|
||||
REM Fix a bug here and apply it to the other three - see gallery\README.md.
|
||||
REM ==========================================================================
|
||||
setlocal
|
||||
set "GALLERY=people"
|
||||
set "HERE=%~dp0"
|
||||
set "REPO=%HERE%..\.."
|
||||
|
||||
title Identity Forge - update %GALLERY% gallery
|
||||
|
||||
echo.
|
||||
echo ==========================================================
|
||||
echo Identity Forge - %GALLERY% gallery
|
||||
echo ==========================================================
|
||||
echo.
|
||||
|
||||
REM --- source folder: dragged onto the .bat, or typed at the prompt ---------
|
||||
set "SOURCE=%~1"
|
||||
if not defined SOURCE goto :ask
|
||||
goto :havesource
|
||||
|
||||
:ask
|
||||
echo Drop the folder of images here, or paste its path.
|
||||
echo Leave it blank and press Enter to cancel.
|
||||
echo.
|
||||
set /p "SOURCE=Source folder: "
|
||||
if not defined SOURCE goto :cancelled
|
||||
|
||||
:havesource
|
||||
REM Strip surrounding quotes that drag-and-drop adds.
|
||||
set "SOURCE=%SOURCE:"=%"
|
||||
if not exist "%SOURCE%\" goto :nosource
|
||||
|
||||
REM --- mode ----------------------------------------------------------------
|
||||
echo.
|
||||
echo Which entries should be written?
|
||||
echo.
|
||||
echo [1] Add only what is missing - default, safest
|
||||
echo [2] Add missing AND replace existing
|
||||
echo [3] Preview only, change nothing - dry run
|
||||
echo.
|
||||
set "CHOICE="
|
||||
set /p "CHOICE=Choose 1, 2 or 3 [1]: "
|
||||
if not defined CHOICE set "CHOICE=1"
|
||||
|
||||
set "FLAGS="
|
||||
if "%CHOICE%"=="1" set "FLAGS="
|
||||
if "%CHOICE%"=="2" set "FLAGS=--overwrite"
|
||||
if "%CHOICE%"=="3" set "FLAGS=--dry-run"
|
||||
if "%CHOICE%"=="1" goto :run
|
||||
if "%CHOICE%"=="2" goto :run
|
||||
if "%CHOICE%"=="3" goto :run
|
||||
goto :badchoice
|
||||
|
||||
:run
|
||||
echo.
|
||||
echo ----------------------------------------------------------
|
||||
python "%HERE%publish.py" --source "%SOURCE%" %FLAGS%
|
||||
if errorlevel 1 goto :failed
|
||||
echo ----------------------------------------------------------
|
||||
echo.
|
||||
echo Finished.
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
exit /b 0
|
||||
|
||||
:nosource
|
||||
echo.
|
||||
echo ERROR: that folder does not exist:
|
||||
echo %SOURCE%
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
exit /b 1
|
||||
|
||||
:badchoice
|
||||
echo.
|
||||
echo ERROR: "%CHOICE%" is not one of 1, 2 or 3.
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
exit /b 1
|
||||
|
||||
:failed
|
||||
echo ----------------------------------------------------------
|
||||
echo.
|
||||
echo FAILED. The gallery was NOT updated. Read the messages above.
|
||||
echo.
|
||||
echo Common causes:
|
||||
echo - Pillow is not installed fix: pip install Pillow
|
||||
echo - not signed in to git/GitHub fix: check your credentials
|
||||
echo - the gh-pages branch moved fix: git fetch origin
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
exit /b 1
|
||||
|
||||
:cancelled
|
||||
echo.
|
||||
echo Cancelled - nothing was changed.
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
exit /b 0
|
||||
+1998
-1378
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
/* =============================================================
|
||||
Identity Forge — Archetype Gallery Script
|
||||
Identity Forge - Sample Gallery Script
|
||||
One file for every gallery page.
|
||||
Lazy-loading image grid with search, lightbox, keyboard nav.
|
||||
============================================================= */
|
||||
|
||||
@@ -182,6 +183,7 @@
|
||||
|
||||
card.appendChild(wrapper);
|
||||
card.appendChild(nameEl);
|
||||
if (entry.prompt) card.appendChild(createPromptBlock(entry));
|
||||
|
||||
// Click handler
|
||||
if (entry.has_image) {
|
||||
@@ -197,6 +199,43 @@
|
||||
return card;
|
||||
}
|
||||
|
||||
/* People gallery (2.7.0): a sample has no name worth showing, so its card carries
|
||||
the seed and settings, and the prompt the node wrote with a copy button. */
|
||||
function createPromptBlock(entry) {
|
||||
const block = document.createElement('div');
|
||||
block.className = 'card-prompt';
|
||||
if (entry.settings) {
|
||||
const settings = document.createElement('div');
|
||||
settings.className = 'card-settings';
|
||||
settings.textContent = entry.settings;
|
||||
block.appendChild(settings);
|
||||
}
|
||||
const details = document.createElement('details');
|
||||
const summary = document.createElement('summary');
|
||||
summary.textContent = 'Prompt';
|
||||
const text = document.createElement('p');
|
||||
text.textContent = entry.prompt;
|
||||
const copy = document.createElement('button');
|
||||
copy.type = 'button';
|
||||
copy.className = 'btn-secondary card-copy';
|
||||
copy.textContent = 'Copy prompt';
|
||||
copy.addEventListener('click', async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(entry.prompt);
|
||||
copy.textContent = 'Copied';
|
||||
} catch (e) {
|
||||
copy.textContent = 'Copy failed';
|
||||
}
|
||||
setTimeout(() => { copy.textContent = 'Copy prompt'; }, 1500);
|
||||
});
|
||||
details.append(summary, text, copy);
|
||||
block.appendChild(details);
|
||||
// Clicks and keys in here must not open the lightbox.
|
||||
block.addEventListener('click', (e) => e.stopPropagation());
|
||||
block.addEventListener('keydown', (e) => e.stopPropagation());
|
||||
return block;
|
||||
}
|
||||
|
||||
// ── Lazy Loading ───────────────────────────────────────
|
||||
function observeNewImages() {
|
||||
// Disconnect previous observer
|
||||
@@ -251,7 +290,8 @@
|
||||
if (state.onlyMissing) list = list.filter((e) => !e.has_image);
|
||||
if (state.onlyNew) list = list.filter(isNew);
|
||||
if (state.searchTerm) {
|
||||
list = list.filter((e) => e.name.toLowerCase().includes(state.searchTerm));
|
||||
list = list.filter((e) => (e.name + ' ' + (e.prompt || '')).toLowerCase()
|
||||
.includes(state.searchTerm));
|
||||
}
|
||||
|
||||
// The manifest is already name-sorted, so A-Z needs no work; sorting a copy
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =============================================================
|
||||
Identity Forge - Sample Gallery Styles
|
||||
Shared verbatim by the cosplay, archetype and creature galleries;
|
||||
see gallery/README.md before editing (a fix lands three times).
|
||||
One file for every gallery page
|
||||
(gallery/shared/, published next to each page; see gallery/README.md).
|
||||
Dark theme, tuned for browsing a large lazy-loaded grid.
|
||||
============================================================= */
|
||||
|
||||
@@ -262,6 +262,24 @@ a:hover { color: var(--accent-hover); }
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* People gallery: seed/settings line and the expandable prompt */
|
||||
.card-prompt {
|
||||
padding: 0 0.6rem 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
cursor: default;
|
||||
}
|
||||
.card-settings { text-align: center; margin-bottom: 0.3rem; }
|
||||
.card-prompt summary { cursor: pointer; color: var(--accent); }
|
||||
.card-prompt p {
|
||||
margin: 0.4rem 0;
|
||||
max-height: 14rem;
|
||||
overflow-y: auto;
|
||||
line-height: 1.4;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.card-copy { margin-top: 0.2rem; padding: 0.3rem 0.8rem; font-size: 0.75rem; }
|
||||
|
||||
/* Missing image card styling */
|
||||
.gallery-card.missing {
|
||||
opacity: 0.6;
|
||||
@@ -144,6 +144,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Veronica Lodge"
|
||||
],
|
||||
"Assassin's Creed": [
|
||||
"Evie Frye",
|
||||
"Ezio Auditore",
|
||||
"Kassandra"
|
||||
],
|
||||
@@ -297,6 +298,9 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Bloodshot": [
|
||||
"Bloodshot"
|
||||
],
|
||||
"Bloodstained": [
|
||||
"Miriam (Bloodstained)"
|
||||
],
|
||||
"Bob's Burgers": [
|
||||
"Bob Belcher",
|
||||
"Gene Belcher",
|
||||
@@ -304,6 +308,9 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Louise Belcher",
|
||||
"Tina Belcher"
|
||||
],
|
||||
"Bocchi the Rock!": [
|
||||
"Hitori Gotoh"
|
||||
],
|
||||
"Borderlands": [
|
||||
"Amara",
|
||||
"Claptrap",
|
||||
@@ -626,6 +633,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Momo Ayase"
|
||||
],
|
||||
"Danganronpa": [
|
||||
"Celestia Ludenberg",
|
||||
"Chiaki Nanami",
|
||||
"Junko Enoshima",
|
||||
"Monokuma",
|
||||
@@ -944,19 +952,23 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Aerith Gainsborough",
|
||||
"Auron",
|
||||
"Barret Wallace",
|
||||
"Beatrix (Final Fantasy)",
|
||||
"Cactuar",
|
||||
"Cecil Harvey",
|
||||
"Celes Chere",
|
||||
"Chocobo",
|
||||
"Cindy Aurum",
|
||||
"Cloud Strife",
|
||||
"Fran",
|
||||
"Kain Highwind",
|
||||
"Kefka Palazzo",
|
||||
"Lightning",
|
||||
"Lulu",
|
||||
"Lunafreya Nox Fleuret",
|
||||
"Moogle",
|
||||
"Noctis",
|
||||
"Rikku",
|
||||
"Rinoa Heartilly",
|
||||
"Rosa Farrell",
|
||||
"Rydia",
|
||||
"Sephiroth",
|
||||
@@ -968,6 +980,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Ultros",
|
||||
"Vincent Valentine",
|
||||
"Vivi Ornitier",
|
||||
"Y'shtola Rhul",
|
||||
"Yuffie Kisaragi",
|
||||
"Yuna",
|
||||
"Zidane"
|
||||
@@ -1214,7 +1227,9 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Pinhead"
|
||||
],
|
||||
"Hellsing": [
|
||||
"Alucard (Hellsing)"
|
||||
"Alucard (Hellsing)",
|
||||
"Integra Hellsing",
|
||||
"Seras Victoria"
|
||||
],
|
||||
"Hercules": [
|
||||
"Aphrodite (Hercules)",
|
||||
@@ -1530,6 +1545,9 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Lupin III": [
|
||||
"Fujiko Mine"
|
||||
],
|
||||
"Lycoris Recoil": [
|
||||
"Chisato Nishikigi"
|
||||
],
|
||||
"Mad Max": [
|
||||
"Immortan Joe",
|
||||
"Imperator Furiosa",
|
||||
@@ -1614,6 +1632,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Gorgon",
|
||||
"Green Goblin",
|
||||
"Groot",
|
||||
"Gwenpool",
|
||||
"Hawkeye",
|
||||
"Hela",
|
||||
"Hellcat",
|
||||
@@ -1796,8 +1815,10 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Megamind"
|
||||
],
|
||||
"Metal Gear": [
|
||||
"EVA (Metal Gear)",
|
||||
"Quiet",
|
||||
"Solid Snake"
|
||||
"Solid Snake",
|
||||
"The Boss"
|
||||
],
|
||||
"Metroid": [
|
||||
"Samus Aran (Power Suit)",
|
||||
@@ -1907,6 +1928,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Hawks",
|
||||
"Himiko Toga",
|
||||
"Midnight (My Hero Academia)",
|
||||
"Mina Ashido",
|
||||
"Mirko",
|
||||
"Momo Yaoyorozu",
|
||||
"Mt. Lady",
|
||||
@@ -1984,6 +2006,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Monkey D. Luffy",
|
||||
"Nami",
|
||||
"Nico Robin",
|
||||
"Perona",
|
||||
"Portgas D. Ace",
|
||||
"Roronoa Zoro",
|
||||
"Sanji",
|
||||
@@ -2318,6 +2341,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Shrek"
|
||||
],
|
||||
"Silent Hill": [
|
||||
"Heather Mason",
|
||||
"Nurse (Silent Hill)",
|
||||
"Pyramid Head"
|
||||
],
|
||||
@@ -2328,6 +2352,10 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Eris",
|
||||
"Sinbad"
|
||||
],
|
||||
"Skullgirls": [
|
||||
"Cerebella",
|
||||
"Parasoul"
|
||||
],
|
||||
"Sleeping Beauty": [
|
||||
"Aurora",
|
||||
"Maleficent"
|
||||
@@ -2360,6 +2388,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Siegfried Schtauffen",
|
||||
"Sophitia Alexandra",
|
||||
"Taki",
|
||||
"Tira",
|
||||
"Voldo",
|
||||
"Xianghua",
|
||||
"Yoshimitsu"
|
||||
@@ -2662,6 +2691,11 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Shredder",
|
||||
"Splinter"
|
||||
],
|
||||
"Tales series": [
|
||||
"Judith (Tales)",
|
||||
"Sheena Fujibayashi",
|
||||
"Velvet Crowe"
|
||||
],
|
||||
"Tangled": [
|
||||
"Flynn Rider",
|
||||
"Rapunzel"
|
||||
@@ -2686,6 +2720,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Spy (Team Fortress 2)"
|
||||
],
|
||||
"Tekken": [
|
||||
"Alisa Bosconovitch",
|
||||
"Anna Williams",
|
||||
"Asuka Kazama",
|
||||
"Azucena Ortiz",
|
||||
@@ -2813,6 +2848,7 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Athena Asamiya",
|
||||
"Iori Yagami",
|
||||
"K'",
|
||||
"Kula Diamond",
|
||||
"Kyo Kusanagi",
|
||||
"Leona Heidern",
|
||||
"Mai Shiranui",
|
||||
@@ -3172,6 +3208,9 @@ const COSPLAYER_FRANCHISES = {
|
||||
"Xenoblade Chronicles": [
|
||||
"Pyra"
|
||||
],
|
||||
"Xenosaga": [
|
||||
"KOS-MOS"
|
||||
],
|
||||
"Youngblood": [
|
||||
"Riptide",
|
||||
"Suprema",
|
||||
|
||||
@@ -202,6 +202,28 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* 2.6.0: the star sits over the art's top-right corner. */
|
||||
.if-picker-tile {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.if-picker-star {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
padding: 0 4px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--descrip-text, #999);
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.if-picker-star.on {
|
||||
color: #f5c518;
|
||||
}
|
||||
|
||||
.if-picker-tile:hover {
|
||||
filter: brightness(1.15);
|
||||
}
|
||||
@@ -211,6 +233,16 @@
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
/* 2.5.0: the entry the node currently holds. */
|
||||
.if-picker-tile.current {
|
||||
border-color: var(--if-picker-accent, #5c9eff);
|
||||
box-shadow: inset 0 0 0 1px var(--if-picker-accent, #5c9eff);
|
||||
}
|
||||
|
||||
.if-picker-franchise {
|
||||
width: 170px;
|
||||
}
|
||||
|
||||
.if-picker-tile-disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
|
||||
+393
-59
@@ -1,4 +1,5 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { api } from "../../scripts/api.js";
|
||||
|
||||
/*
|
||||
* Identity Forge roster picker — Phase 4b (1.1.0).
|
||||
@@ -121,15 +122,95 @@ function tabLabel(tab) {
|
||||
return tab === TAB_ALL ? "All" : KIND_LABEL[tab] || tab;
|
||||
}
|
||||
|
||||
// --- search: substring, multi-token AND, case-insensitive -------------------
|
||||
// --- search: word-start, multi-token AND, case-insensitive -------------------
|
||||
//
|
||||
// 2.5.0: a token matches where a WORD starts in the description ("bow" finds
|
||||
// "bow tie" and "bowler hat", no longer "elbow" or "rainbow"), or anywhere in
|
||||
// the entry's name. A quoted phrase ("bow tie") is one token. SEARCH_ALSO widens
|
||||
// a few words to their synonyms and to the compounds the roster really uses
|
||||
// (scripts measured: "suit" alone missed 235 "bodysuit" entries under word-start).
|
||||
// Directional on purpose: "pants" finds trousers, "jeans" does not find slacks.
|
||||
|
||||
const SEARCH_ALSO = {
|
||||
pants: ["trousers", "slacks", "jeans", "sweatpants", "breeches"],
|
||||
trousers: ["pants", "slacks"],
|
||||
suit: ["bodysuit", "jumpsuit", "catsuit", "supersuit", "tracksuit", "spacesuit", "swimsuit", "wetsuit", "plugsuit", "batsuit", "exosuit"],
|
||||
sword: ["longsword", "greatsword", "broadsword", "katana", "sabre", "saber", "rapier", "scimitar", "cutlass"],
|
||||
coat: ["waistcoat", "tailcoat", "overcoat", "greatcoat", "raincoat", "trenchcoat", "longcoat"],
|
||||
dress: ["minidress", "sundress", "gown"],
|
||||
skirt: ["miniskirt", "overskirt"],
|
||||
shirt: ["sweatshirt", "undershirt", "overshirt"],
|
||||
glasses: ["sunglasses", "spectacles", "eyeglasses"],
|
||||
gun: ["shotgun", "handgun", "minigun", "railgun", "pistol", "rifle", "revolver", "blaster"],
|
||||
band: ["headband", "armband", "wristband", "hairband"],
|
||||
sweater: ["jumper", "pullover"],
|
||||
sneakers: ["trainers"],
|
||||
trainers: ["sneakers"],
|
||||
gray: ["grey"],
|
||||
grey: ["gray"],
|
||||
blonde: ["blond"],
|
||||
armor: ["armour"],
|
||||
armour: ["armor"],
|
||||
color: ["colour"],
|
||||
colour: ["color"],
|
||||
mustache: ["moustache"],
|
||||
moustache: ["mustache"],
|
||||
saber: ["sabre"],
|
||||
sabre: ["saber"],
|
||||
robot: ["android", "droid", "cyborg", "mech"],
|
||||
};
|
||||
|
||||
// Accents and special letters fold to their plain-keyboard form on both sides,
|
||||
// so "dia", "día" and "Día" all find Día de los Muertos, "pokemon" finds Pokémon.
|
||||
const FOLD_EXTRA = { "ø": "o", "æ": "ae", "œ": "oe", "ß": "ss", "ł": "l", "đ": "d", "ð": "d", "þ": "th", "ı": "i" };
|
||||
|
||||
function fold(text) {
|
||||
return String(text || "").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "")
|
||||
.replace(/[øæœßłđðþı]/g, (c) => FOLD_EXTRA[c]);
|
||||
}
|
||||
|
||||
const foldedEntries = new WeakMap(); // entry -> { name, haystack }, folded once
|
||||
|
||||
function foldedEntry(entry) {
|
||||
let f = foldedEntries.get(entry);
|
||||
if (!f) {
|
||||
f = { name: fold(entry.name), haystack: fold(entry.haystack) };
|
||||
foldedEntries.set(entry, f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
function tokenize(query) {
|
||||
return String(query || "").trim().toLowerCase().split(/\s+/).filter(Boolean);
|
||||
const tokens = [];
|
||||
for (const m of fold(query).matchAll(/"([^"]*)"|(\S+)/g)) {
|
||||
const token = (m[1] ?? m[2]).trim().replace(/\s+/g, " ");
|
||||
if (token) tokens.push(token);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const tokenPatterns = new Map(); // token -> RegExp, built once per distinct token
|
||||
|
||||
function tokenPattern(token) {
|
||||
let re = tokenPatterns.get(token);
|
||||
if (!re) {
|
||||
const words = [token, ...(SEARCH_ALSO[token] || [])].map(escapeRegExp);
|
||||
// 2.8.0: "boots" also finds a lone "boot". The singular must end its word, so
|
||||
// "pants" never reaches "panther"; "glasses" gains only "glasse", never "glass".
|
||||
if (/[a-z]{3}s$/.test(token) && !token.endsWith("ss")) {
|
||||
words.push(escapeRegExp(token.slice(0, -1)) + "(?![a-z0-9])");
|
||||
}
|
||||
re = new RegExp("(?:^|[^a-z0-9])(?:" + words.join("|") + ")");
|
||||
tokenPatterns.set(token, re);
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
function matchesQuery(entry, tokens) {
|
||||
if (!tokens.length) return true;
|
||||
return tokens.every((token) => entry.haystack.includes(token));
|
||||
const { name, haystack } = foldedEntry(entry);
|
||||
return tokens.every((token) => name.includes(token) || tokenPattern(token).test(haystack));
|
||||
}
|
||||
|
||||
// --- trait facets -------------------------------------------------------------
|
||||
@@ -176,8 +257,21 @@ function matchesGender(entry, gender) {
|
||||
}
|
||||
|
||||
// Franchise filter (2.2.0). Only cosplayers carry a franchise, so picking one
|
||||
// narrows to cosplayers. Options come from the loaded roster, grouped by category.
|
||||
const FRANCHISE_ALL = "All franchises";
|
||||
// narrows to cosplayers. 2.5.0: a type-to-filter box (there are hundreds of
|
||||
// franchises) with the franchises as suggestions. Text that names a franchise
|
||||
// exactly keeps only that one; any other text keeps every franchise containing it
|
||||
// ("star" -> Star Wars and Star Trek). Empty means all.
|
||||
const FRANCHISE_ALL = "";
|
||||
let pickerSerial = 0; // unique datalist ids, one per picker
|
||||
|
||||
function franchiseMatcher(text, entries) {
|
||||
const q = fold(text).trim();
|
||||
if (!q) return null;
|
||||
const exact = entries.some((e) => e.franchise && fold(e.franchise) === q);
|
||||
return exact
|
||||
? (e) => Boolean(e.franchise) && fold(e.franchise) === q
|
||||
: (e) => Boolean(e.franchise) && fold(e.franchise).includes(q);
|
||||
}
|
||||
|
||||
function franchiseGroups(entries) {
|
||||
const groups = new Map();
|
||||
@@ -217,19 +311,30 @@ function traitChips(entry) {
|
||||
// --- opt-in thumbnails --------------------------------------------------------
|
||||
//
|
||||
// Text-first, zero image payload by default. Enabling "Show preview images"
|
||||
// fetches the LIVE gh-pages gallery manifest for a kind with a plain, absolute
|
||||
// `fetch` -- explicitly not `api.fetchApi`, which targets the ComfyUI server,
|
||||
// not GitHub Pages -- and lazy-loads <img> tags via IntersectionObserver.
|
||||
// Gallery manifests are deployment output on gh-pages, not source artifacts
|
||||
// on main; only the published file is ever fetched here.
|
||||
// fetches the gallery manifest for a kind and lazy-loads <img> tags via
|
||||
// IntersectionObserver. 2.3.0: both go through the pack's own server routes
|
||||
// (nodes/gallery_cache.py), which fetch the gh-pages gallery and keep it on
|
||||
// disk -- ComfyUI's --offline CSP allows only the page's own origin, and the
|
||||
// cache also keeps previews showing after the network goes away. Gallery
|
||||
// manifests are deployment output on gh-pages, not source artifacts on main.
|
||||
|
||||
const GH_PAGES_GALLERY_ROOT = "https://enragedantelope.github.io/comfyui-identity-forge/gallery/";
|
||||
const PREVIEW_PREF_KEY = "identity_forge.picker.show_previews";
|
||||
|
||||
/** The public gallery page (the "Open the full gallery" links). */
|
||||
function galleryFolderURL(kind) {
|
||||
return GH_PAGES_GALLERY_ROOT + KIND_GALLERY_FOLDER[kind] + "/";
|
||||
}
|
||||
|
||||
/** The same folder through the server's cache, on ComfyUI's own origin. */
|
||||
function galleryCacheURL(kind) {
|
||||
return api.apiURL("/identity_forge/gallery/" + KIND_GALLERY_FOLDER[kind] + "/");
|
||||
}
|
||||
|
||||
function formatMegabytes(bytes) {
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
||||
}
|
||||
|
||||
function loadPreviewPref() {
|
||||
try {
|
||||
return window.localStorage.getItem(PREVIEW_PREF_KEY) === "1";
|
||||
@@ -246,6 +351,39 @@ function savePreviewPref(value) {
|
||||
}
|
||||
}
|
||||
|
||||
// --- starred entries (2.6.0) -------------------------------------------------
|
||||
// A per-browser favourites list, keyed "kind:name" so one set serves every
|
||||
// picker. localStorage can be missing or throw (private window, blocked site
|
||||
// data); stars then last only until the page reloads.
|
||||
|
||||
const STARRED_KEY = "identity_forge.picker.starred";
|
||||
let starred = null;
|
||||
|
||||
function starKey(entry) {
|
||||
return entry.kind + ":" + entry.name;
|
||||
}
|
||||
|
||||
function starredSet() {
|
||||
if (starred) return starred;
|
||||
starred = new Set();
|
||||
try {
|
||||
const saved = JSON.parse(window.localStorage.getItem(STARRED_KEY) || "[]");
|
||||
if (Array.isArray(saved)) for (const key of saved) if (typeof key === "string") starred.add(key);
|
||||
} catch (_) { /* unreadable or blocked storage: start empty */ }
|
||||
return starred;
|
||||
}
|
||||
|
||||
function toggleStar(entry) {
|
||||
const set = starredSet();
|
||||
const key = starKey(entry);
|
||||
if (set.has(key)) set.delete(key);
|
||||
else set.add(key);
|
||||
try {
|
||||
window.localStorage.setItem(STARRED_KEY, JSON.stringify([...set]));
|
||||
} catch (_) { /* best-effort, see above */ }
|
||||
return set.has(key);
|
||||
}
|
||||
|
||||
//: kind -> Promise<Map<name, image-relative-path>>, held ONLY while a fetch
|
||||
//: for that kind is in flight -- cleared the instant it settles, success or
|
||||
//: failure, via `.finally()`. This is deliberately NOT a cache of the
|
||||
@@ -278,7 +416,7 @@ const manifestFetches = new Map();
|
||||
|
||||
function loadManifest(kind) {
|
||||
if (manifestFetches.has(kind)) return manifestFetches.get(kind);
|
||||
const promise = fetch(galleryFolderURL(kind) + "manifest.json")
|
||||
const promise = fetch(galleryCacheURL(kind) + "manifest.json")
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error("HTTP " + response.status);
|
||||
return response.json();
|
||||
@@ -347,6 +485,7 @@ class IdentityForgePicker {
|
||||
this.facet = FACET_ALL;
|
||||
this.gender = GENDER_ANY;
|
||||
this.franchise = FRANCHISE_ALL;
|
||||
this.starredOnly = false;
|
||||
this.showPreviews = loadPreviewPref();
|
||||
this.focusIndex = 0;
|
||||
this.visible = [];
|
||||
@@ -358,6 +497,9 @@ class IdentityForgePicker {
|
||||
open() {
|
||||
if (this.overlay) return;
|
||||
this.previousFocus = document.activeElement;
|
||||
// 2.5.0: reopen on the node's current pick, so a long filtered list keeps
|
||||
// its place between picks instead of jumping back to the top.
|
||||
this._revealCurrent = true;
|
||||
try {
|
||||
this.build();
|
||||
document.body.appendChild(this.overlay);
|
||||
@@ -476,12 +618,7 @@ class IdentityForgePicker {
|
||||
search.setAttribute("aria-label", "Search the roster by name, franchise, or trait");
|
||||
search.addEventListener("input", (event) => {
|
||||
this.query = event.target.value || "";
|
||||
this.focusIndex = 0;
|
||||
if (this._searchTimer) clearTimeout(this._searchTimer);
|
||||
this._searchTimer = setTimeout(() => {
|
||||
this._searchTimer = null;
|
||||
this.renderGrid();
|
||||
}, 80);
|
||||
this.scheduleRender();
|
||||
});
|
||||
search.value = this.query; // restore the surviving query (see close())
|
||||
this.searchInput = search;
|
||||
@@ -525,15 +662,23 @@ class IdentityForgePicker {
|
||||
});
|
||||
this.genderSelect = genderSelect;
|
||||
|
||||
const franchiseSelect = document.createElement("select");
|
||||
franchiseSelect.className = "if-picker-facet";
|
||||
franchiseSelect.setAttribute("aria-label", "Filter by franchise");
|
||||
franchiseSelect.addEventListener("change", () => {
|
||||
this.franchise = franchiseSelect.value;
|
||||
this.focusIndex = 0;
|
||||
this.renderGrid();
|
||||
const franchiseInput = document.createElement("input");
|
||||
franchiseInput.type = "search";
|
||||
franchiseInput.className = "if-picker-facet if-picker-franchise";
|
||||
franchiseInput.placeholder = "Franchise...";
|
||||
franchiseInput.spellcheck = false;
|
||||
franchiseInput.autocomplete = "off";
|
||||
franchiseInput.setAttribute("aria-label", "Filter by franchise (type part of a name)");
|
||||
const franchiseList = document.createElement("datalist");
|
||||
franchiseList.id = "if-picker-franchises-" + ++pickerSerial;
|
||||
franchiseInput.setAttribute("list", franchiseList.id);
|
||||
franchiseInput.value = this.franchise;
|
||||
franchiseInput.addEventListener("input", () => {
|
||||
this.franchise = franchiseInput.value;
|
||||
this.scheduleRender();
|
||||
});
|
||||
this.franchiseSelect = franchiseSelect;
|
||||
this.franchiseInput = franchiseInput;
|
||||
this.franchiseList = franchiseList;
|
||||
this.fillFranchiseOptions();
|
||||
|
||||
const previewLabel = document.createElement("label");
|
||||
@@ -549,6 +694,20 @@ class IdentityForgePicker {
|
||||
previewLabel.append(previewCheckbox, document.createTextNode(" Show preview images"));
|
||||
this.previewCheckbox = previewCheckbox;
|
||||
|
||||
const starredLabel = document.createElement("label");
|
||||
starredLabel.className = "if-picker-preview-toggle";
|
||||
starredLabel.title = "Star an entry with the star on its card (or the S key).";
|
||||
const starredCheckbox = document.createElement("input");
|
||||
starredCheckbox.type = "checkbox";
|
||||
starredCheckbox.checked = this.starredOnly;
|
||||
starredCheckbox.addEventListener("change", () => {
|
||||
this.starredOnly = starredCheckbox.checked;
|
||||
this.focusIndex = 0;
|
||||
this.renderGrid();
|
||||
});
|
||||
starredLabel.append(starredCheckbox, document.createTextNode(" Starred only"));
|
||||
this.starredCheckbox = starredCheckbox;
|
||||
|
||||
const close = document.createElement("button");
|
||||
close.type = "button";
|
||||
close.className = "if-picker-btn if-picker-close";
|
||||
@@ -556,12 +715,70 @@ class IdentityForgePicker {
|
||||
close.setAttribute("aria-label", "Close (" + this.config.title + ")");
|
||||
close.addEventListener("click", () => this.close());
|
||||
|
||||
header.append(search, facet, genderSelect, franchiseSelect, count, previewLabel, close);
|
||||
// 2.5.0: queue one run per matching character, so a filtered set can be
|
||||
// cycled through in one go. Shown only while filtering (never the whole roster).
|
||||
const queueAll = document.createElement("button");
|
||||
queueAll.type = "button";
|
||||
queueAll.className = "if-picker-btn if-picker-queue-all";
|
||||
queueAll.title = "Queue one run for each matching entry, then put your current pick back.";
|
||||
queueAll.addEventListener("click", () => this.queueEach());
|
||||
this.queueAllButton = queueAll;
|
||||
|
||||
// 2.8.0: the lighter option - one run with one random matching entry, no prompt.
|
||||
const queueRandom = document.createElement("button");
|
||||
queueRandom.type = "button";
|
||||
queueRandom.className = "if-picker-btn if-picker-queue-random";
|
||||
queueRandom.textContent = "Queue random";
|
||||
queueRandom.title = "Queue one run with a random matching entry, then put your current pick back.";
|
||||
queueRandom.addEventListener("click", () => {
|
||||
const entries = this.queueableEntries();
|
||||
if (entries.length) this.queueEach([entries[Math.floor(Math.random() * entries.length)]], false);
|
||||
});
|
||||
this.queueRandomButton = queueRandom;
|
||||
|
||||
// 2.5.0: trait and franchise filters match cosplayers only, and creatures carry
|
||||
// no gender, so a node shows only the filters that can narrow what it can pick.
|
||||
const kind = this.config.kind;
|
||||
header.append(
|
||||
search,
|
||||
...(kind === "cosplayer" ? [facet] : []),
|
||||
...(kind !== "creature" ? [genderSelect] : []),
|
||||
...(kind === "cosplayer" ? [franchiseInput, franchiseList] : []),
|
||||
count, queueAll, queueRandom, starredLabel, previewLabel, close,
|
||||
);
|
||||
|
||||
const notice = document.createElement("div");
|
||||
notice.className = "if-picker-notice";
|
||||
notice.textContent =
|
||||
"Enabling previews fetches images from this project's GitHub Pages site (enragedantelope.github.io) — nothing else phones home.";
|
||||
"Enabling previews has the ComfyUI server fetch images from this project's GitHub Pages site " +
|
||||
"(enragedantelope.github.io) and keep them on disk, so they still show offline. Nothing else phones home. ";
|
||||
const clearCache = document.createElement("button");
|
||||
clearCache.type = "button";
|
||||
clearCache.className = "if-picker-btn if-picker-clear-cache";
|
||||
clearCache.textContent = "Clear cached previews";
|
||||
clearCache.addEventListener("click", async () => {
|
||||
try {
|
||||
const resp = await api.fetchApi("/identity_forge/gallery/cache/clear", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: "{}",
|
||||
});
|
||||
clearCache.textContent = resp.ok ? "Cached previews cleared" : "Could not clear the cache";
|
||||
} catch (_) {
|
||||
clearCache.textContent = "Could not clear the cache";
|
||||
}
|
||||
});
|
||||
// Best-effort size readout; the button works without it.
|
||||
api
|
||||
.fetchApi("/identity_forge/gallery/cache")
|
||||
.then((resp) => (resp.ok ? resp.json() : null))
|
||||
.then((data) => {
|
||||
if (data && typeof data.bytes === "number" && data.bytes > 0) {
|
||||
clearCache.textContent = "Clear cached previews (" + formatMegabytes(data.bytes) + ")";
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
notice.append(clearCache);
|
||||
|
||||
const links = document.createElement("div");
|
||||
links.className = "if-picker-links";
|
||||
@@ -589,7 +806,9 @@ class IdentityForgePicker {
|
||||
footer.className = "if-picker-footer";
|
||||
footer.textContent =
|
||||
"Searches roster entries (cosplayers, archetypes, creatures) — not the randomizable "
|
||||
+ "field pools on the main node. Arrow keys move, Enter selects, Escape closes.";
|
||||
+ "field pools on the main node. Words match from their start; \"quote a phrase\"; "
|
||||
+ "a few words also find synonyms (pants finds trousers). "
|
||||
+ "Arrow keys move, Enter selects, Escape closes.";
|
||||
|
||||
dialog.append(header, notice, links, tabs, grid, footer);
|
||||
overlay.appendChild(dialog);
|
||||
@@ -657,7 +876,16 @@ class IdentityForgePicker {
|
||||
else if (event.key === "ArrowUp") next = this.focusIndex - columns;
|
||||
else if (event.key === "Home") next = 0;
|
||||
else if (event.key === "End") next = lastIndex;
|
||||
else if (event.key === "Enter") {
|
||||
else if ((event.key === "s" || event.key === "S") && !/^(INPUT|SELECT|TEXTAREA)$/.test(event.target.tagName)) {
|
||||
const entry = this.visible[this.focusIndex];
|
||||
if (entry) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
toggleStar(entry);
|
||||
this.renderGrid();
|
||||
}
|
||||
return;
|
||||
} else if (event.key === "Enter") {
|
||||
const entry = this.visible[this.focusIndex];
|
||||
if (entry) {
|
||||
event.preventDefault();
|
||||
@@ -682,11 +910,11 @@ class IdentityForgePicker {
|
||||
return Math.max(1, Math.floor(width / 210));
|
||||
}
|
||||
|
||||
highlight() {
|
||||
highlight(block = "nearest") {
|
||||
if (!this.grid) return;
|
||||
const next = this.visible.length ? this.grid.children[this.focusIndex] || null : null;
|
||||
if (this._focused === next) {
|
||||
if (next && next.scrollIntoView) next.scrollIntoView({ block: "nearest" });
|
||||
if (next && next.scrollIntoView) next.scrollIntoView({ block });
|
||||
return;
|
||||
}
|
||||
if (this._focused) {
|
||||
@@ -697,7 +925,7 @@ class IdentityForgePicker {
|
||||
if (next) {
|
||||
next.classList.add("focused");
|
||||
next.setAttribute("aria-selected", "true");
|
||||
if (next.scrollIntoView) next.scrollIntoView({ block: "nearest" });
|
||||
if (next.scrollIntoView) next.scrollIntoView({ block });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,30 +984,103 @@ class IdentityForgePicker {
|
||||
if (this.gender !== GENDER_ANY) {
|
||||
list = list.filter((entry) => matchesGender(entry, this.gender));
|
||||
}
|
||||
if (this.franchise !== FRANCHISE_ALL) {
|
||||
list = list.filter((entry) => entry.franchise === this.franchise);
|
||||
const inFranchise = franchiseMatcher(this.franchise, roster);
|
||||
if (inFranchise) list = list.filter(inFranchise);
|
||||
if (this.starredOnly) {
|
||||
const set = starredSet();
|
||||
list = list.filter((entry) => set.has(starKey(entry)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** (Re)build the franchise dropdown; a no-op until the roster has loaded. */
|
||||
/** Fill the franchise suggestions (category as the label); a no-op until the roster has loaded. */
|
||||
fillFranchiseOptions() {
|
||||
const select = this.franchiseSelect;
|
||||
if (!select || (roster && select.options.length > 1)) return;
|
||||
const all = document.createElement("option");
|
||||
all.value = all.textContent = FRANCHISE_ALL;
|
||||
select.replaceChildren(all);
|
||||
for (const [category, names] of franchiseGroups(roster || [])) {
|
||||
const group = document.createElement("optgroup");
|
||||
group.label = category;
|
||||
const list = this.franchiseList;
|
||||
if (!list || !roster || list.options.length) return;
|
||||
for (const [category, names] of franchiseGroups(roster)) {
|
||||
for (const name of names) {
|
||||
const option = document.createElement("option");
|
||||
option.value = option.textContent = name;
|
||||
group.appendChild(option);
|
||||
option.value = name;
|
||||
option.label = category;
|
||||
list.appendChild(option);
|
||||
}
|
||||
select.appendChild(group);
|
||||
}
|
||||
select.value = this.franchise;
|
||||
}
|
||||
|
||||
/** Re-render shortly after typing stops, so each keystroke does not rebuild the grid. */
|
||||
scheduleRender() {
|
||||
this.focusIndex = 0;
|
||||
if (this._searchTimer) clearTimeout(this._searchTimer);
|
||||
this._searchTimer = setTimeout(() => {
|
||||
this._searchTimer = null;
|
||||
this.renderGrid();
|
||||
}, 80);
|
||||
}
|
||||
|
||||
/** The visible entries this node can take -- what "Queue each" runs. */
|
||||
queueableEntries() {
|
||||
return this.visible.filter((entry) => entry.kind === this.config.kind);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue one run per matching entry, then restore the node's own pick.
|
||||
* Each app.queuePrompt() call snapshots the graph, so setting the widget and
|
||||
* awaiting the call in turn gives one job per character.
|
||||
*/
|
||||
async queueEach(entries = this.queueableEntries(), ask = true) {
|
||||
const node = this.config.node;
|
||||
const widget = findWidget(node, this.config.targetWidgetName);
|
||||
if (!entries.length || !widget || this._queueing) return;
|
||||
if (typeof app.queuePrompt !== "function") {
|
||||
alert("This ComfyUI frontend does not expose app.queuePrompt, so runs cannot be queued from here.");
|
||||
return;
|
||||
}
|
||||
const noun = entries.length === 1 ? "run" : "runs";
|
||||
if (ask && !confirm("Queue " + entries.length + " " + noun + ", one for each matching entry?")) return;
|
||||
this._queueing = true;
|
||||
const original = widget.value;
|
||||
const button = this.queueAllButton;
|
||||
let queued = 0;
|
||||
try {
|
||||
for (const entry of entries) {
|
||||
widget.value = entry.name;
|
||||
// false = ComfyUI was already building another prompt and only queued ours
|
||||
// for later, when the widget would hold a different name. Stop rather than
|
||||
// queue the wrong character.
|
||||
if ((await app.queuePrompt(0, 1)) === false) break;
|
||||
queued += 1;
|
||||
if (button && button.isConnected) button.textContent = "Queued " + queued + " / " + entries.length;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[IdentityForgePicker] queueing failed", error);
|
||||
} finally {
|
||||
setWidgetValue(node, widget, original);
|
||||
this.resyncFranchiseFilter();
|
||||
if (typeof node.setDirtyCanvas === "function") node.setDirtyCanvas(true, true);
|
||||
this._queueing = false;
|
||||
if (queued < entries.length) {
|
||||
alert("Queued " + queued + " of " + entries.length + " runs; the rest were not queued.");
|
||||
}
|
||||
this.updateQueueButton();
|
||||
}
|
||||
}
|
||||
|
||||
updateQueueButton() {
|
||||
const button = this.queueAllButton;
|
||||
if (!button || this._queueing) return;
|
||||
const n = this.isFiltering() ? this.queueableEntries().length : 0;
|
||||
button.style.display = n ? "" : "none";
|
||||
button.textContent = "Queue each (" + n + ")";
|
||||
if (this.queueRandomButton) this.queueRandomButton.style.display = n > 1 ? "" : "none";
|
||||
}
|
||||
|
||||
/** Re-run franchise_filter's callback so the node's pick stays in its combo list. */
|
||||
resyncFranchiseFilter() {
|
||||
if (!this.config.franchiseFilterWidgetName) return;
|
||||
const filterWidget = findWidget(this.config.node, this.config.franchiseFilterWidgetName);
|
||||
if (filterWidget && typeof filterWidget.callback === "function") {
|
||||
filterWidget.callback(filterWidget.value);
|
||||
}
|
||||
}
|
||||
|
||||
/** The grid's contents: the query/facet matches, narrowed to the active tab. */
|
||||
@@ -801,7 +1102,7 @@ class IdentityForgePicker {
|
||||
/** True while anything is narrowing the roster -- when the counts are worth showing. */
|
||||
isFiltering() {
|
||||
return Boolean(tokenize(this.query).length) || this.facet !== FACET_ALL
|
||||
|| this.gender !== GENDER_ANY || this.franchise !== FRANCHISE_ALL;
|
||||
|| this.gender !== GENDER_ANY || Boolean(String(this.franchise).trim()) || this.starredOnly;
|
||||
}
|
||||
|
||||
renderGrid() {
|
||||
@@ -823,6 +1124,19 @@ class IdentityForgePicker {
|
||||
if (this.count) {
|
||||
this.count.textContent = this.visible.length + (this.visible.length === 1 ? " result" : " results");
|
||||
}
|
||||
this.updateQueueButton();
|
||||
|
||||
const current = findWidget(this.config.node, this.config.targetWidgetName)?.value;
|
||||
let reveal = false;
|
||||
// Only once the dialog is on the page: build() renders before it is attached.
|
||||
if (this._revealCurrent && this.overlay && this.overlay.isConnected) {
|
||||
this._revealCurrent = false;
|
||||
const index = this.visible.findIndex((e) => e.kind === this.config.kind && e.name === current);
|
||||
if (index > -1) {
|
||||
this.focusIndex = index;
|
||||
reveal = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.visible.length) {
|
||||
const empty = document.createElement("div");
|
||||
@@ -831,7 +1145,9 @@ class IdentityForgePicker {
|
||||
// answer -- say whether the same query hits another category, and make
|
||||
// getting there one click rather than a hunt across the tab strip.
|
||||
const elsewhere = this.activeTab === TAB_ALL ? 0 : matching.length;
|
||||
if (this.query && this.activeTab === TAB_ALL) {
|
||||
if (this.starredOnly && !starredSet().size) {
|
||||
empty.textContent = "Nothing starred yet. Click the star on a card (or press S) to keep it here.";
|
||||
} else if (this.query && this.activeTab === TAB_ALL) {
|
||||
empty.textContent = 'Nothing matches "' + this.query + '".';
|
||||
} else if (this.query) {
|
||||
empty.textContent = 'No ' + tabLabel(this.activeTab).toLowerCase()
|
||||
@@ -883,10 +1199,12 @@ class IdentityForgePicker {
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
this.visible.forEach((entry, index) => {
|
||||
fragment.appendChild(this.buildTile(entry, index));
|
||||
const tile = this.buildTile(entry, index);
|
||||
if (entry.kind === this.config.kind && entry.name === current) tile.classList.add("current");
|
||||
fragment.appendChild(tile);
|
||||
});
|
||||
this.grid.appendChild(fragment);
|
||||
this.highlight();
|
||||
this.highlight(reveal ? "center" : "nearest");
|
||||
|
||||
if (this.showPreviews) {
|
||||
// One manifest fetch per kind actually shown, not per card.
|
||||
@@ -909,7 +1227,10 @@ class IdentityForgePicker {
|
||||
if (!relative || el.querySelector("img")) continue;
|
||||
const img = document.createElement("img");
|
||||
img.alt = "";
|
||||
img.setAttribute("data-src", galleryFolderURL(kind) + relative);
|
||||
img.setAttribute(
|
||||
"data-src",
|
||||
galleryCacheURL(kind) + relative.split("/").map(encodeURIComponent).join("/"),
|
||||
);
|
||||
img.loading = "lazy";
|
||||
el.replaceChildren(img);
|
||||
if (this.imageObserver) this.imageObserver.observe(img);
|
||||
@@ -956,7 +1277,24 @@ class IdentityForgePicker {
|
||||
chips.appendChild(span);
|
||||
}
|
||||
|
||||
tile.append(art, name, sub, chips);
|
||||
const star = document.createElement("button");
|
||||
star.type = "button";
|
||||
star.tabIndex = -1; // keyboard users press S on the focused card instead
|
||||
star.className = "if-picker-star";
|
||||
const paintStar = (on) => {
|
||||
star.textContent = String.fromCharCode(on ? 0x2605 : 0x2606); // filled / outline star
|
||||
star.classList.toggle("on", on);
|
||||
star.setAttribute("aria-pressed", on ? "true" : "false");
|
||||
star.setAttribute("aria-label", (on ? "Unstar " : "Star ") + entry.name);
|
||||
};
|
||||
paintStar(starredSet().has(starKey(entry)));
|
||||
star.addEventListener("click", (event) => {
|
||||
event.stopPropagation(); // starring is not picking
|
||||
paintStar(toggleStar(entry));
|
||||
if (this.starredOnly) this.renderGrid();
|
||||
});
|
||||
|
||||
tile.append(art, star, name, sub, chips);
|
||||
|
||||
if (!selectable) {
|
||||
tile.title = "Browsing only — open the " + KIND_LABEL[entry.kind].slice(0, -1)
|
||||
@@ -983,12 +1321,7 @@ class IdentityForgePicker {
|
||||
// its own current value recomputes that rule with the new selection,
|
||||
// reusing the exact logic in identity_forge_cosplayer.js rather than
|
||||
// duplicating it.
|
||||
if (this.config.franchiseFilterWidgetName) {
|
||||
const filterWidget = findWidget(node, this.config.franchiseFilterWidgetName);
|
||||
if (filterWidget && typeof filterWidget.callback === "function") {
|
||||
filterWidget.callback(filterWidget.value);
|
||||
}
|
||||
}
|
||||
this.resyncFranchiseFilter();
|
||||
if (typeof node.setDirtyCanvas === "function") node.setDirtyCanvas(true, true);
|
||||
} catch (error) {
|
||||
console.error("[IdentityForgePicker] selection failed", error);
|
||||
@@ -1233,5 +1566,6 @@ export const __testing = {
|
||||
roster = null;
|
||||
rosterPromise = null;
|
||||
manifestFetches.clear();
|
||||
starred = null;
|
||||
},
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -26,6 +26,9 @@ const NO_CHARACTERS = "(no characters saved)";
|
||||
//: yet" are different situations that used to render identically, so a failed
|
||||
//: fetch was indistinguishable from an empty vault.
|
||||
const VAULT_UNAVAILABLE = "(vault unavailable — press Refresh)";
|
||||
//: 2.6.0: mirrors _RANDOM in nodes/identity_forge_vault_load.py; last option
|
||||
//: whenever the vault has entries, so Refresh must keep it.
|
||||
const RANDOM_CHARACTER = "(random saved character)";
|
||||
//: First widget this file adds; its presence is the re-entry guard in
|
||||
//: `setupVaultLoad`. See js/identity_forge.js.
|
||||
const REFRESH_LABEL = "🔄 Refresh";
|
||||
@@ -87,7 +90,7 @@ function updatePreview(node) {
|
||||
if (!el) return;
|
||||
const w = getCharacterWidget(node);
|
||||
const name = w && w.value;
|
||||
if (!name || name === NO_CHARACTERS) {
|
||||
if (!name || name === NO_CHARACTERS || name === RANDOM_CHARACTER) {
|
||||
el.style.display = "none";
|
||||
el.removeAttribute("src");
|
||||
return;
|
||||
@@ -104,10 +107,14 @@ function applyCharacterList(node, characters) {
|
||||
list = [VAULT_UNAVAILABLE];
|
||||
} else {
|
||||
const names = characters.map((c) => (typeof c === "string" ? c : c.name));
|
||||
list = names.length ? names : [NO_CHARACTERS];
|
||||
list = names.length ? [...names, RANDOM_CHARACTER] : [NO_CHARACTERS];
|
||||
}
|
||||
setComboValues(w, list);
|
||||
if (!list.includes(w.value)) w.value = list[0];
|
||||
// 2.8.0: only a placeholder moves to the first entry. A saved name this vault does
|
||||
// not list (a workflow from elsewhere, or a failed fetch) stays put: the node then
|
||||
// passes the upstream through with a warning instead of recalling someone else.
|
||||
const placeholder = !w.value || [NO_CHARACTERS, VAULT_UNAVAILABLE, RANDOM_CHARACTER].includes(w.value);
|
||||
if (!list.includes(w.value) && placeholder) w.value = list[0];
|
||||
updatePreview(node);
|
||||
node.setDirtyCanvas(true, true);
|
||||
}
|
||||
@@ -275,6 +282,10 @@ function openManager(node) {
|
||||
if (data && data.error) detail = data.error;
|
||||
} catch (parseError) { /* not JSON - keep the status */ }
|
||||
alert(`Delete failed: ${detail}`);
|
||||
} else {
|
||||
// Deleting the current pick hands the node the first remaining entry.
|
||||
const w = getCharacterWidget(node);
|
||||
if (w && names.includes(w.value)) w.value = "";
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[IdentityForge] delete failed:", e);
|
||||
@@ -293,6 +304,9 @@ function openManager(node) {
|
||||
});
|
||||
const data = await resp.json();
|
||||
if (!resp.ok) { alert(data.error || "Rename failed."); return; }
|
||||
// Renaming the current pick keeps it picked, under its new name.
|
||||
const w = getCharacterWidget(node);
|
||||
if (w && w.value === from && data.name) setSelection(node, data.name);
|
||||
} catch (e) {
|
||||
console.error("[IdentityForge] rename failed:", e);
|
||||
alert("Rename failed — see console.");
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
"""Server-side cache of the gh-pages gallery, for the roster picker's preview images (2.3.0).
|
||||
|
||||
The picker used to fetch the manifest and every thumbnail straight from GitHub Pages in
|
||||
the browser. ComfyUI's ``--offline`` flag sends a Content-Security-Policy of
|
||||
``img-src 'self'; connect-src 'self'``, which blocks exactly that, so previews never
|
||||
loaded there. Routing them through the pack's own routes puts them on ComfyUI's origin,
|
||||
and the server keeps what it fetched:
|
||||
|
||||
* **Lazy.** An image is downloaded the first time a card scrolls into view, never in
|
||||
bulk; the cache holds what this install has looked at (about 100 KiB an image).
|
||||
* **Revalidated, not trusted forever.** Re-renders keep their filename, so a cached
|
||||
file is checked again with its ETag after :data:`MANIFEST_MAX_AGE` (manifest) or
|
||||
:data:`IMAGE_MAX_AGE` (image); an unchanged file costs one 304.
|
||||
* **Offline-tolerant.** Any network failure serves the cached copy if there is one.
|
||||
|
||||
Only one host is ever contacted, and an image path is served only if the current
|
||||
manifest lists it, so a request cannot name an arbitrary URL or escape the cache
|
||||
directory. Nothing here runs until the user enables previews in the picker.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from typing import Callable
|
||||
|
||||
GALLERY_ROOT = "https://enragedantelope.github.io/comfyui-identity-forge/gallery/"
|
||||
#: Gallery folders on gh-pages (js KIND_GALLERY_FOLDER's values).
|
||||
KINDS: "frozenset[str]" = frozenset({"cosplay", "archetypes", "creatures"})
|
||||
|
||||
#: GitHub Pages serves both with ``max-age=600``; an image is re-checked weekly.
|
||||
MANIFEST_MAX_AGE = 600
|
||||
IMAGE_MAX_AGE = 7 * 24 * 3600
|
||||
#: Gallery images are optimized JPEGs of ~100 KiB; refuse anything absurd.
|
||||
MAX_IMAGE_BYTES = 5 * 1024 * 1024
|
||||
MAX_MANIFEST_BYTES = 8 * 1024 * 1024
|
||||
TIMEOUT = 15
|
||||
|
||||
_ETAG = ".etag"
|
||||
_RASTER = (".jpg", ".jpeg", ".png", ".webp")
|
||||
|
||||
|
||||
class GalleryError(Exception):
|
||||
"""A request that cannot be served: unknown kind/path, or nothing cached offline."""
|
||||
|
||||
|
||||
def default_root() -> Path:
|
||||
import folder_paths # type: ignore[import-not-found]
|
||||
|
||||
return Path(folder_paths.get_user_directory()) / "identity_forge" / "gallery_cache"
|
||||
|
||||
|
||||
def _urlopen(request: urllib.request.Request): # pragma: no cover - patched in tests
|
||||
return urllib.request.urlopen(request, timeout=TIMEOUT)
|
||||
|
||||
|
||||
def _write_atomic(path: Path, data: bytes) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
fd, tmp = tempfile.mkstemp(dir=path.parent, prefix=".tmp-")
|
||||
try:
|
||||
with os.fdopen(fd, "wb") as handle:
|
||||
handle.write(data)
|
||||
os.replace(tmp, path)
|
||||
except BaseException:
|
||||
Path(tmp).unlink(missing_ok=True)
|
||||
raise
|
||||
|
||||
|
||||
def _fetch(url: str, path: Path, max_age: float, limit: int,
|
||||
check: "Callable[[bytes, str], bool]", opener=None) -> Path:
|
||||
"""``path``, refreshed from ``url`` when older than ``max_age`` seconds.
|
||||
|
||||
A failed or rejected download keeps the cached copy; with none, GalleryError.
|
||||
"""
|
||||
opener = opener or _urlopen
|
||||
etag_path = path.with_name(path.name + _ETAG)
|
||||
if path.is_file() and time.time() - path.stat().st_mtime < max_age:
|
||||
return path
|
||||
request = urllib.request.Request(url, headers={"User-Agent": "comfyui-identity-forge"})
|
||||
if path.is_file() and etag_path.is_file():
|
||||
request.add_header("If-None-Match", etag_path.read_text(encoding="utf-8").strip())
|
||||
try:
|
||||
with opener(request) as response:
|
||||
data = response.read(limit + 1)
|
||||
content_type = response.headers.get("Content-Type", "")
|
||||
etag = response.headers.get("ETag", "")
|
||||
if len(data) > limit or not check(data, content_type):
|
||||
raise GalleryError(f"rejected response from {url}")
|
||||
_write_atomic(path, data)
|
||||
if etag:
|
||||
_write_atomic(etag_path, etag.encode("utf-8"))
|
||||
return path
|
||||
except urllib.error.HTTPError as exc:
|
||||
if exc.code == 304 and path.is_file():
|
||||
os.utime(path) # validated: fresh for another max_age
|
||||
return path
|
||||
failure: Exception = exc
|
||||
except (OSError, GalleryError, ValueError) as exc: # URLError is an OSError
|
||||
failure = exc
|
||||
if path.is_file():
|
||||
# Offline or failing: serve what we had, and wait out another max_age before
|
||||
# retrying, or every thumbnail request would wait out a timeout again (2.6.0).
|
||||
os.utime(path)
|
||||
return path
|
||||
raise GalleryError(f"{url} unavailable and not cached: {failure}")
|
||||
|
||||
|
||||
def _is_manifest(data: bytes, _content_type: str) -> bool:
|
||||
try:
|
||||
return isinstance(json.loads(data.decode("utf-8")).get("entries"), list)
|
||||
except (ValueError, AttributeError, UnicodeDecodeError):
|
||||
return False
|
||||
|
||||
|
||||
def _is_image(data: bytes, content_type: str) -> bool:
|
||||
return content_type.startswith("image/") and bool(data)
|
||||
|
||||
|
||||
def _check_kind(kind: str) -> None:
|
||||
if kind not in KINDS:
|
||||
raise GalleryError(f"unknown gallery {kind!r}")
|
||||
|
||||
|
||||
def manifest_path(kind: str, root: Path, opener=None) -> Path:
|
||||
_check_kind(kind)
|
||||
return _fetch(GALLERY_ROOT + kind + "/manifest.json", root / kind / "manifest.json",
|
||||
MANIFEST_MAX_AGE, MAX_MANIFEST_BYTES, _is_manifest, opener)
|
||||
|
||||
|
||||
#: kind -> (manifest mtime, image paths it lists); the manifest is ~400 KiB of JSON,
|
||||
#: too much to re-parse for every thumbnail request.
|
||||
_LISTED: "dict[tuple[Path, str], tuple[float, frozenset[str]]]" = {}
|
||||
|
||||
|
||||
def _listed_images(kind: str, root: Path, opener=None) -> "frozenset[str]":
|
||||
path = manifest_path(kind, root, opener)
|
||||
mtime = path.stat().st_mtime
|
||||
cached = _LISTED.get((root, kind))
|
||||
if cached and cached[0] == mtime:
|
||||
return cached[1]
|
||||
entries = json.loads(path.read_text(encoding="utf-8")).get("entries") or []
|
||||
images = frozenset(e["image"] for e in entries
|
||||
if isinstance(e, dict) and isinstance(e.get("image"), str))
|
||||
_LISTED[(root, kind)] = (mtime, images)
|
||||
return images
|
||||
|
||||
|
||||
def image_path(kind: str, relative: str, root: Path, opener=None) -> Path:
|
||||
"""The cached file for one manifest-listed image, downloading it if needed."""
|
||||
_check_kind(kind)
|
||||
# Served from ComfyUI's own origin, so only raster images: an SVG can carry script.
|
||||
if not relative.lower().endswith(_RASTER):
|
||||
raise GalleryError(f"{relative!r} is not a raster image")
|
||||
if relative not in _listed_images(kind, root, opener):
|
||||
raise GalleryError(f"{relative!r} is not in the {kind} manifest")
|
||||
target = (root / kind / relative).resolve()
|
||||
if not target.is_relative_to((root / kind).resolve()): # defence in depth
|
||||
raise GalleryError(f"{relative!r} escapes the cache")
|
||||
url = GALLERY_ROOT + kind + "/" + urllib.parse.quote(relative)
|
||||
return _fetch(url, target, IMAGE_MAX_AGE, MAX_IMAGE_BYTES, _is_image, opener)
|
||||
|
||||
|
||||
def cache_bytes(root: Path) -> int:
|
||||
if not root.is_dir():
|
||||
return 0
|
||||
return sum(p.stat().st_size for p in root.rglob("*") if p.is_file())
|
||||
|
||||
|
||||
def clear(root: Path) -> None:
|
||||
_LISTED.clear()
|
||||
if root.is_dir():
|
||||
shutil.rmtree(root)
|
||||
+55
-26
@@ -40,7 +40,7 @@ try:
|
||||
FIELD_DEFINITIONS, FIELD_FAMILIES, FIELD_HELP, OUTFIT_DESCRIPTIONS,
|
||||
SKIN_TONE_BANDS, ETHNICITY_REGION, OUTDOOR_LOCATIONS, STUDIO_BACKDROPS,
|
||||
HAIR_DEPENDENT_POSES, GARMENT_DEPENDENT_POSES, HAND_OCCUPIED_POSES,
|
||||
QUADRUPED_UNPERFORMABLE_POSES,
|
||||
QUADRUPED_UNPERFORMABLE_POSES, ONE_HAND_POSES,
|
||||
FURNITURE_DEPENDENT_POSES,
|
||||
PALETTE_ADJECTIVES, PATTERN_TAILS, WORN_ITEM_RES,
|
||||
SHOE_RE, COLOUR_WORD_RE, PATTERN_WORD_RE, LEADING_ARTICLE_RE,
|
||||
@@ -60,7 +60,7 @@ except ImportError: # pragma: no cover — standalone/test context
|
||||
FIELD_DEFINITIONS, FIELD_FAMILIES, FIELD_HELP, OUTFIT_DESCRIPTIONS,
|
||||
SKIN_TONE_BANDS, ETHNICITY_REGION, OUTDOOR_LOCATIONS, STUDIO_BACKDROPS,
|
||||
HAIR_DEPENDENT_POSES, GARMENT_DEPENDENT_POSES, HAND_OCCUPIED_POSES,
|
||||
QUADRUPED_UNPERFORMABLE_POSES,
|
||||
QUADRUPED_UNPERFORMABLE_POSES, ONE_HAND_POSES,
|
||||
FURNITURE_DEPENDENT_POSES,
|
||||
PALETTE_ADJECTIVES, PATTERN_TAILS, WORN_ITEM_RES,
|
||||
SHOE_RE, COLOUR_WORD_RE, PATTERN_WORD_RE, LEADING_ARTICLE_RE,
|
||||
@@ -152,6 +152,11 @@ _SELFIE_SHOT_TYPE: str = "selfie framing at arm's length"
|
||||
#: makeup_style) are affected; identical-pool fields already pass the gate.
|
||||
_GENDER_FLEXIBLE_GROUPS: frozenset[str] = frozenset({"Makeup"})
|
||||
|
||||
#: 2.4.0: eye cosmetics a LOCK keeps voiced on a bare face. A man's "no makeup"
|
||||
#: default hid an Emo's or a New Wave look's locked eyeliner; random men lock nothing,
|
||||
#: so their prose is unchanged. Lips, blush and contour stay hidden on purpose.
|
||||
_BARE_FACE_KEEPS: tuple[str, ...] = ("eye_makeup", "eyeliner")
|
||||
|
||||
#: ``set_all_fields`` control values. "All to None" omits every field still on
|
||||
#: "Random" (a blank-slate baseline) so only locked fields appear; a wired
|
||||
#: character's signature look is exempt (see :func:`resolve_locked_fields`).
|
||||
@@ -330,6 +335,10 @@ _VARIANTS_KEY = "__variants__"
|
||||
_FORM_ANTHRO = "Anthropomorphic"
|
||||
_FORM_FERAL = "Feral"
|
||||
_FORM_SUBTLE = "Subtle"
|
||||
#: Creature classes whose anatomy slots describe the whole body (undead, golems,
|
||||
#: aliens): the Anthropomorphic form calls them "humanoid", not a human "hybrid",
|
||||
#: and drops the human body proportions (2.4.0).
|
||||
_BODY_DEFINED_CLASSES = frozenset({"Monsters", "Aliens"})
|
||||
|
||||
#: Order anatomy slots are voiced / serialized in.
|
||||
_SPECIES_SLOT_ORDER: tuple[str, ...] = (
|
||||
@@ -1608,6 +1617,11 @@ _HAND_PROP_RE = re.compile(
|
||||
r"(?<=, )(?:holding|carrying|swirling|presenting|raising))\b",
|
||||
re.IGNORECASE)
|
||||
|
||||
#: 2.4.0: a held prop that fills both hands (twin pistols, a book in both hands).
|
||||
_BOTH_HANDS_PROP_RE = re.compile(
|
||||
r"\b(?:in each hand|in either hand|in the other(?: hand)?|in both hands|"
|
||||
r"with both hands|in two hands)\b", re.IGNORECASE)
|
||||
|
||||
|
||||
def _performable_poses(
|
||||
pool: list[str],
|
||||
@@ -1688,6 +1702,9 @@ def _performable_poses(
|
||||
if ((held and not _is_absent(held)) or resolved.get("shot_type") == _SELFIE_SHOT_TYPE
|
||||
or _HAND_PROP_RE.search(outfit)):
|
||||
excluded |= HAND_OCCUPIED_POSES
|
||||
# 2.4.0: a prop in each hand leaves none free ("adjusting one cuff" drew a third hand).
|
||||
if held and _BOTH_HANDS_PROP_RE.search(held):
|
||||
excluded |= ONE_HAND_POSES
|
||||
# 1.5.0 round 4: "adjusting one cuff" in a poncho, "touching the collar" in a harness
|
||||
# top. Only once a garment exists (inside the fill loop it does not yet).
|
||||
if outfit and not _CUFFED_RE.search(outfit):
|
||||
@@ -3148,7 +3165,15 @@ def _species_subject(species: dict, gender: str) -> str:
|
||||
"""
|
||||
base = species.get("creature_of") or "creature"
|
||||
form = species.get("form", "")
|
||||
if form == _FORM_ANTHRO:
|
||||
if form == _FORM_ANTHRO and species.get("anthro_subject"):
|
||||
# 2.4.0: a creature's own anthro lead noun, for bodies the model otherwise
|
||||
# draws whole beside a person (see data/creatures.py "anthro").
|
||||
noun = species["anthro_subject"]
|
||||
elif form == _FORM_ANTHRO and species.get("creature_class") in _BODY_DEFINED_CLASSES:
|
||||
# 2.4.0: "anthropomorphic skeleton hybrid" read as a human with skeleton
|
||||
# traits; a skeleton, ghost or golem is already person-shaped.
|
||||
noun = f"humanoid {base}"
|
||||
elif form == _FORM_ANTHRO:
|
||||
noun = f"anthropomorphic {base} hybrid"
|
||||
elif form == _FORM_FERAL:
|
||||
creature_class = species.get("creature_class", "")
|
||||
@@ -3189,6 +3214,7 @@ def _format_prose(
|
||||
feet_visible: bool = True, # APPENDED (1.7.0): see _FEET_OUT_OF_FRAME_SHOTS
|
||||
subject_only: bool = False, # APPENDED (1.8.0): person + outfit, no pose/scene
|
||||
subject_override: str | None = None, # APPENDED (2.1.0): see _SUBJECT_NOUN_KEY
|
||||
kept_cosmetics: "tuple[str, ...]" = (), # APPENDED (2.4.0): see _BARE_FACE_KEEPS
|
||||
) -> str:
|
||||
"""Build a natural-language description from resolved field values.
|
||||
|
||||
@@ -3337,7 +3363,9 @@ def _format_prose(
|
||||
eye_desc = _words(g("eye_color"), g("eye_shape"))
|
||||
features.append(eye_desc if _EYE_PART_RE.search(eye_desc) else f"{eye_desc} eyes")
|
||||
if g("nose"):
|
||||
features.append(_an(g("nose"), "nose"))
|
||||
# "wide with flared nostrils" -> "a wide nose with flared nostrils", not "...nostrils nose".
|
||||
shape, sep, rest = g("nose").partition(" with ")
|
||||
features.append(_an(shape, "nose") + (sep + rest if sep else ""))
|
||||
if g("lips"):
|
||||
features.append(g("lips") + " lips")
|
||||
if g("eyebrows"):
|
||||
@@ -3459,8 +3487,12 @@ def _format_prose(
|
||||
# (field, noun, stem) — append " noun" only when the value doesn't already
|
||||
# carry the category (stem), avoiding "ombre lip lip colour" / "… liner
|
||||
# eyeliner" style doubling.
|
||||
if g("makeup_style"):
|
||||
makeup = [g("makeup_style")]
|
||||
# 2.4.0: with no style (a man's bare-faced default), only the locked eye fields in
|
||||
# ``kept_cosmetics`` are voiced; the random rest stays hidden as before.
|
||||
style = g("makeup_style")
|
||||
kept = () if style else tuple(f for f in kept_cosmetics if g(f))
|
||||
if style or kept:
|
||||
makeup = [style] if style else []
|
||||
for field, noun, stem in (
|
||||
("eye_makeup", "eyeshadow", "shadow"), ("eyeliner", "eyeliner", "liner"),
|
||||
("lashes", "lashes", "lash"), ("lips_makeup", "lip colour", "lip"),
|
||||
@@ -3469,7 +3501,7 @@ def _format_prose(
|
||||
("skin_finish", "finish", "finish"),
|
||||
):
|
||||
val = g(field)
|
||||
if val:
|
||||
if val and (style or field in kept):
|
||||
makeup.append(_OBJECT_TOKEN_CLAUSES.get((field, val))
|
||||
or (val if stem in val else f"{val} {noun}"))
|
||||
sentences.append(f"{subj} {wears} " + _join(makeup))
|
||||
@@ -3837,7 +3869,7 @@ def _format_json(
|
||||
if slots:
|
||||
# ``size`` belongs with them: it prefixes the subject noun ("A towering lion"),
|
||||
# so leaving it out recalled a towering creature as a plain one.
|
||||
for key in ("creature_of", "creature_class", "form", "size"):
|
||||
for key in ("creature_of", "creature_class", "form", "size", "anthro_subject"):
|
||||
if species.get(key):
|
||||
meta[key] = species[key]
|
||||
# The suppression lists travel with the form, for the same reason the five
|
||||
@@ -4561,11 +4593,12 @@ def generate_character(
|
||||
# 2.0.0: a skirt length the frame cannot show is dropped from the prose too.
|
||||
trimmed = _LENGTH_WORD_RE.sub("", prose_fields.get("outfit_description") or "")
|
||||
prose_fields = {**prose_fields, "outfit_description": trimmed}
|
||||
kept_cosmetics = tuple(f for f in _BARE_FACE_KEEPS if f in locked_clean)
|
||||
prose = _format_prose(prose_fields, gender, cosplay_label, species,
|
||||
hands_visible=not hands_covered, mask_text=mask_text,
|
||||
anatomy_note=anatomy_note, presentation=presentation,
|
||||
subject_override=subject_noun,
|
||||
feet_visible=feet_visible)
|
||||
feet_visible=feet_visible, kept_cosmetics=kept_cosmetics)
|
||||
# Fields a preset or a widget deliberately locked ABSENT. They are stripped from
|
||||
# the group output (``group_fields`` drops "None"), so without recording them the
|
||||
# document cannot round-trip through the vault -- a recalled She-Hulk grew a
|
||||
@@ -4590,7 +4623,8 @@ def generate_character(
|
||||
hands_visible=not hands_covered, mask_text=mask_text,
|
||||
anatomy_note=anatomy_note, presentation=presentation,
|
||||
subject_override=subject_noun,
|
||||
feet_visible=True, subject_only=True)
|
||||
feet_visible=True, subject_only=True,
|
||||
kept_cosmetics=kept_cosmetics)
|
||||
return prose, json_output, subject
|
||||
return prose, json_output
|
||||
|
||||
@@ -4749,7 +4783,7 @@ def _parse_archetype_json(raw: str) -> dict[str, Any]:
|
||||
if isinstance(form, str) and form:
|
||||
species = flat.setdefault(_SPECIES_KEY, {})
|
||||
species["form"] = form
|
||||
for str_key in ("creature_of", "creature_class", "size"):
|
||||
for str_key in ("creature_of", "creature_class", "size", "anthro_subject"):
|
||||
if isinstance(meta.get(str_key), str):
|
||||
species[str_key] = meta[str_key]
|
||||
for list_key in ("suppress_groups", "suppress_fields"):
|
||||
@@ -4894,9 +4928,11 @@ def roll_field_values(widgets: dict[str, Any], seed: int) -> dict[str, str]:
|
||||
|
||||
1.7.0: "Roll + lock all" used to pick each dropdown uniformly in JS, so it ignored
|
||||
the weights and could lock a pair the engine forbids. Fields the run left absent
|
||||
are omitted; the frontend locks those to "None".
|
||||
are omitted; the frontend locks those to "None". Every input the button sends is a
|
||||
dropdown, so non-text values are dropped (2.6.0: ``{"age": 3.5}`` raised a 500).
|
||||
"""
|
||||
_, json_output, _ = run_identity_forge({**widgets, "seed": seed})
|
||||
text = {name: value for name, value in widgets.items() if isinstance(value, str)}
|
||||
_, json_output, _ = run_identity_forge({**text, "seed": seed})
|
||||
return {name: value for name, value in _parse_archetype_json(json_output).items()
|
||||
if name in FIELD_DEFINITIONS and name not in _HIDDEN_FIELDS
|
||||
and name not in _CONTROL_FIELDS}
|
||||
@@ -5070,23 +5106,16 @@ if _COMFY_AVAILABLE:
|
||||
"natural-language prose and structured JSON.",
|
||||
inputs=inputs,
|
||||
outputs=[
|
||||
io.String.Output(display_name="prompt_text"),
|
||||
io.String.Output(display_name="prompt_json"),
|
||||
io.String.Output(display_name="prompt_text",
|
||||
tooltip="The full description as prose. Wire into CLIPTextEncode."),
|
||||
io.String.Output(display_name="prompt_json",
|
||||
tooltip="The resolved character as JSON. Wire into a sheet node, Vault Save, or another Identity Forge's 'archetype_json' to reuse the person."),
|
||||
# Appended last (1.8.0) so links on slots 0 and 1 stay intact.
|
||||
io.String.Output(display_name="subject_text"),
|
||||
io.String.Output(display_name="subject_text",
|
||||
tooltip="The person and outfit only, without the scene, lighting or framing."),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, **kwargs: Any) -> float:
|
||||
# Force a fresh roll on every queue. ComfyUI can serve a stale cached
|
||||
# result when control_after_generate auto-advances the seed (ComfyUI
|
||||
# #11905); returning a never-equal value (NaN) makes this node's cache
|
||||
# signature always differ, so it re-executes and reads the new seed.
|
||||
# Pure cache control -- no RNG here, so a fixed seed still reproduces
|
||||
# exactly and nothing biases the randomization.
|
||||
return float("nan")
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
return io.NodeOutput(*run_identity_forge(kwargs))
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
"""IdentityForgeAgeProgression node - one resolved character at several ages.
|
||||
|
||||
A sibling of :mod:`nodes.identity_forge_turnaround` (read its docstring first): it
|
||||
takes a **resolved** character (Identity Forge's ``prompt_json``), re-runs the engine
|
||||
over it once per life stage and emits the prompts as a **list**.
|
||||
|
||||
**Ownership line.** This node owns ``age``, and only what age forces:
|
||||
|
||||
* **Fields a live rule refuses at that age** are released and redrawn by the engine
|
||||
(``lock_clash``): laugh lines at 20, "porcelain smooth" skin at 70, pigtails from
|
||||
45, an undercut from 55. When the refused field is ``outfit_style`` the whole
|
||||
outfit goes with it, because the outfit text was written for that style.
|
||||
* **Hair greys forward, never back.** Under "Natural only" hair, a stage at 55 or
|
||||
older than the character turns natural colour grey (salt and pepper for dark hair,
|
||||
silver otherwise, silver for everyone from 70); a stage younger than a grey-haired
|
||||
character, and under 55, gets one natural colour drawn once for the whole sheet, so
|
||||
the person does not change hair colour between their twenties and forties. Dye
|
||||
(Full spectrum), a cosplayer's canon hair and covered hair are left alone.
|
||||
|
||||
Everything else (face, build, outfit, scene) is the document's, unchanged.
|
||||
Every stage is an exact ``age`` pool value, so the youngest is 18 by construction.
|
||||
A face-covering character, or a form with no age, emits one view.
|
||||
|
||||
Text-only, zero new dependencies, no RNG of its own.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from comfy_api.latest import io # type: ignore[import-not-found]
|
||||
_COMFY_AVAILABLE: bool = True
|
||||
except ImportError: # pragma: no cover - exercised only outside ComfyUI
|
||||
_COMFY_AVAILABLE = False
|
||||
|
||||
try:
|
||||
from ..data.constraints import FIELD_FAMILIES, lock_clash
|
||||
from .identity_forge import FIELD_DEFINITIONS
|
||||
from .identity_forge_turnaround import (
|
||||
_FRAMINGS, _forge_class, _unwrap, document_fields, document_meta,
|
||||
character_seed, parse_document, pin_framing, release_fields, replay_base,
|
||||
)
|
||||
except ImportError: # pragma: no cover - standalone/test context
|
||||
from data.constraints import FIELD_FAMILIES, lock_clash
|
||||
from nodes.identity_forge import FIELD_DEFINITIONS
|
||||
from nodes.identity_forge_turnaround import (
|
||||
_FRAMINGS, _forge_class, _unwrap, document_fields, document_meta,
|
||||
character_seed, parse_document, pin_framing, release_fields, replay_base,
|
||||
)
|
||||
|
||||
_LOG = logging.getLogger(__name__)
|
||||
|
||||
#: The selectable progressions, in display order. Exact ``age`` pool values.
|
||||
_STAGES: "dict[str, tuple[str, ...]]" = {
|
||||
"Life stages (4)": ("20", "35", "50", "70"),
|
||||
"Decades (6)": ("20", "30", "40", "50", "60", "70"),
|
||||
"Young and old (2)": ("25", "70"),
|
||||
}
|
||||
|
||||
_CLOTHING: "frozenset[str]" = frozenset(
|
||||
name for name, field in FIELD_DEFINITIONS.items() if field.get("group") == "Clothing")
|
||||
|
||||
_GREY: "frozenset[str]" = frozenset(FIELD_FAMILIES["hair_color"]["gray_white"]["variants"])
|
||||
_DARK: "frozenset[str]" = frozenset(
|
||||
FIELD_FAMILIES["hair_color"]["black"]["variants"]
|
||||
+ FIELD_FAMILIES["hair_color"]["brunette"]["variants"])
|
||||
|
||||
#: From this age natural hair is grey more often than not (the engine's own
|
||||
#: ``_GREY_BY_AGE`` crosses one half at 55), so a progression shows it grey.
|
||||
_GREYS_AT = 55
|
||||
_SILVER_AT = 70
|
||||
|
||||
|
||||
def _stage_hair(original: str, character_age: int, stage: int, natural: str) -> str:
|
||||
"""The hair colour at ``stage``: greying forward from the character, never back."""
|
||||
if original in _GREY:
|
||||
return original if stage >= min(character_age, _GREYS_AT) else natural
|
||||
if stage > character_age and stage >= _GREYS_AT:
|
||||
return "salt and pepper" if original in _DARK and stage < _SILVER_AT else "silver"
|
||||
return original
|
||||
|
||||
|
||||
def _aged_view(
|
||||
document: "dict[str, Any]", base: "dict[str, Any]", pins: "dict[str, str]",
|
||||
also: "frozenset[str]" = frozenset(),
|
||||
) -> "dict[str, Any]":
|
||||
"""Replay kwargs with ``pins`` locked, and everything they refuse (laugh lines at
|
||||
20, highlights in grey hair) released, plus ``also``, for the engine to redraw."""
|
||||
fields = document_fields(document)
|
||||
refused = set(also) | {
|
||||
name for name, value in fields.items() if name not in pins
|
||||
and any(lock_clash(pin, pinned, {name: value}) for pin, pinned in pins.items())}
|
||||
if "outfit_style" in refused:
|
||||
refused |= _CLOTHING
|
||||
view_document = json.loads(json.dumps(document))
|
||||
release_fields(view_document, refused)
|
||||
return {**base, **pins, "archetype_json": json.dumps(view_document)}
|
||||
|
||||
|
||||
def _natural_colour(document: "dict[str, Any]", base: "dict[str, Any]") -> str:
|
||||
"""The colour a grey-haired character had young: one engine draw at age 20."""
|
||||
kwargs = _aged_view(document, base, {"age": "20"}, frozenset({"hair_color"}))
|
||||
resolved = parse_document(str(_unwrap(_forge_class().execute(**kwargs))[1]))
|
||||
return document_fields(resolved).get("hair_color", "")
|
||||
|
||||
|
||||
def resolve_age_progression(
|
||||
character_json: str, stages_name: str, framing_name: str,
|
||||
) -> "tuple[list[str], list[str]]":
|
||||
"""Render one resolved character once per age. Returns ``(prompts, labels)``."""
|
||||
forge = _forge_class()
|
||||
document = parse_document(character_json)
|
||||
meta = document_meta(document)
|
||||
fields = document_fields(document)
|
||||
base = replay_base(character_json)
|
||||
# A close-up refuses a horizon-line composition and a full-standing pose. 2.6.0:
|
||||
# the one-view path below replays the released document too, not the original.
|
||||
pin_framing(base, document, character_json, _FRAMINGS.get(framing_name, ""))
|
||||
# Released fields (skin detail at 70, say) redraw per character, not one shared draw.
|
||||
base["seed"] = character_seed(character_json, "age")
|
||||
|
||||
character_age = fields.get("age", "")
|
||||
if meta.get("covers_face") or not character_age.isdigit():
|
||||
_LOG.warning("This character shows no age (a covered face, or a form without "
|
||||
"one); emitting one view.")
|
||||
return [str(_unwrap(forge.execute(**base))[0])], ["1-as-resolved"]
|
||||
|
||||
hair = fields.get("hair_color", "")
|
||||
greys = bool(hair and base.get("hair_color_scope") == "Natural only"
|
||||
and not meta.get("cosplay_of") and not meta.get("covers_hair"))
|
||||
natural = ""
|
||||
if greys and hair in _GREY:
|
||||
natural = _natural_colour(document, base) or hair
|
||||
|
||||
prompts: "list[str]" = []
|
||||
labels: "list[str]" = []
|
||||
for position, stage in enumerate(_STAGES.get(stages_name, _STAGES["Life stages (4)"]),
|
||||
start=1):
|
||||
pins = {"age": stage}
|
||||
if greys:
|
||||
pins["hair_color"] = _stage_hair(hair, int(character_age), int(stage), natural)
|
||||
view = _aged_view(document, base, pins)
|
||||
prompts.append(str(_unwrap(forge.execute(**view))[0]))
|
||||
labels.append(f"{position}-age-{stage}")
|
||||
return prompts, labels
|
||||
|
||||
|
||||
if _COMFY_AVAILABLE:
|
||||
|
||||
class IdentityForgeAgeProgression(io.ComfyNode): # type: ignore[misc, valid-type]
|
||||
"""Emit one resolved character at several ages, as a list."""
|
||||
|
||||
@classmethod
|
||||
def define_schema(cls) -> "io.Schema":
|
||||
return io.Schema(
|
||||
node_id="IdentityForgeAgeProgression",
|
||||
display_name="Identity Forge Age Progression",
|
||||
category="conditioning/character",
|
||||
description=(
|
||||
"One character at several ages, from a single queue. Wire Identity "
|
||||
"Forge's 'prompt_json' in; the 'prompt' output is a LIST, so "
|
||||
"everything downstream runs once per age. The face, build, outfit "
|
||||
"and scene stay as resolved; hair greys with age, and anything "
|
||||
"that reads wrong at an age (laugh lines at 20, pigtails at 70) is "
|
||||
"redrawn."
|
||||
),
|
||||
inputs=[
|
||||
io.String.Input(
|
||||
"character_json",
|
||||
default="",
|
||||
force_input=True,
|
||||
tooltip="Connect Identity Forge's 'prompt_json' output. Every "
|
||||
"view is the same person at a different age. A "
|
||||
"face-covering character (mascot head, full helmet) "
|
||||
"emits one view.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"stages",
|
||||
options=list(_STAGES),
|
||||
default="Life stages (4)",
|
||||
tooltip="Which ages to emit, and so how many images one queue "
|
||||
"makes. Life stages (4) = 20, 35, 50, 70; Decades (6) = "
|
||||
"20 to 70 in tens; Young and old (2) = 25 and 70.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"framing",
|
||||
options=list(_FRAMINGS),
|
||||
default="Head and shoulders",
|
||||
tooltip="How much of the subject each view frames. 'Head and "
|
||||
"shoulders' keeps the face, where age shows, large. "
|
||||
"'Unspecified' keeps the character's own framing.",
|
||||
),
|
||||
],
|
||||
outputs=[
|
||||
io.String.Output(
|
||||
display_name="prompt",
|
||||
is_output_list=True,
|
||||
tooltip="One prompt per age, as a list. Wire into "
|
||||
"CLIPTextEncode.",
|
||||
),
|
||||
io.String.Output(
|
||||
display_name="view_label",
|
||||
is_output_list=True,
|
||||
tooltip="Matching list of sortable names ('1-age-20', "
|
||||
"'2-age-35', ...). Wire into Save Image's "
|
||||
"filename_prefix.",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
# No fingerprint_inputs: no RNG and no auto-advancing widget (see Turnaround).
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
prompts, labels = resolve_age_progression(
|
||||
kwargs.get("character_json", ""),
|
||||
kwargs.get("stages", "Life stages (4)"),
|
||||
kwargs.get("framing", "Head and shoulders"),
|
||||
)
|
||||
return io.NodeOutput(prompts, labels)
|
||||
@@ -269,19 +269,12 @@ if _COMFY_AVAILABLE:
|
||||
"through unchanged.",
|
||||
),
|
||||
],
|
||||
outputs=[io.String.Output(display_name="character_json")],
|
||||
outputs=[io.String.Output(
|
||||
display_name="character_json",
|
||||
tooltip="The preset as JSON. Wire into Identity Forge's 'archetype_json', or into another preset's 'upstream' to stack them.",
|
||||
)],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, **kwargs: Any) -> float:
|
||||
# Force a fresh roll on every queue. ComfyUI can serve a stale cached
|
||||
# result when control_after_generate auto-advances the seed (ComfyUI
|
||||
# #11905); returning a never-equal value (NaN) makes this node's cache
|
||||
# signature always differ, so it re-executes and reads the new seed.
|
||||
# Pure cache control -- no RNG here, so a fixed seed still reproduces
|
||||
# exactly and nothing biases the randomization.
|
||||
return float("nan")
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
own = build_archetype_json(
|
||||
|
||||
@@ -1035,23 +1035,12 @@ if _COMFY_AVAILABLE:
|
||||
"a specific character is picked.",
|
||||
),
|
||||
],
|
||||
outputs=[io.String.Output(display_name="character_json")],
|
||||
outputs=[io.String.Output(
|
||||
display_name="character_json",
|
||||
tooltip="The preset as JSON. Wire into Identity Forge's 'archetype_json', or into another preset's 'upstream' to stack them.",
|
||||
)],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, **kwargs: Any) -> float:
|
||||
# Force a fresh roll on every queue. ComfyUI can serve a stale cached
|
||||
# result when control_after_generate auto-advances the seed (ComfyUI
|
||||
# #11905); returning a never-equal value (NaN) makes this node's cache
|
||||
# signature always differ, so it re-executes and reads the new seed.
|
||||
# Pure cache control -- no RNG here, so a fixed seed still reproduces
|
||||
# exactly and nothing biases the randomization. Unconditional (ignores
|
||||
# kwargs entirely), so a new widget such as random_pool needs no entry
|
||||
# here: caching is already bypassed for every input, not enumerated
|
||||
# per-field -- see docs/architecture.md "Seeded nodes re-roll every
|
||||
# queue".
|
||||
return float("nan")
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
own = build_cosplayer_json(
|
||||
|
||||
@@ -52,7 +52,7 @@ try:
|
||||
)
|
||||
from .identity_forge import (
|
||||
merge_preset_documents, _prepend_descriptor, _SPECIES_GROUP,
|
||||
_FORM_ANTHRO, _FORM_FERAL, _FORM_SUBTLE,
|
||||
_FORM_ANTHRO, _FORM_FERAL, _FORM_SUBTLE, _BODY_DEFINED_CLASSES,
|
||||
)
|
||||
except ImportError: # pragma: no cover — standalone/test context
|
||||
from data.creatures import (
|
||||
@@ -61,7 +61,7 @@ except ImportError: # pragma: no cover — standalone/test context
|
||||
)
|
||||
from nodes.identity_forge import (
|
||||
merge_preset_documents, _prepend_descriptor, _SPECIES_GROUP,
|
||||
_FORM_ANTHRO, _FORM_FERAL, _FORM_SUBTLE,
|
||||
_FORM_ANTHRO, _FORM_FERAL, _FORM_SUBTLE, _BODY_DEFINED_CLASSES,
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -124,8 +124,13 @@ _FORM_SUPPRESS_GROUPS: dict[str, set[str]] = {
|
||||
#: but ``fitness_level``'s low values state a human *lifestyle* — a fire elemental
|
||||
#: described as "sedentary" or "lightly active" is asserting gym habits for a being that
|
||||
#: has none. Shape stays, lifestyle goes.
|
||||
#:
|
||||
#: 2.4.0: Anthro drops ``fitness_level`` for the same reason ("a nautilus hybrid with a
|
||||
#: sedentary physique"). An Anthro Monster or Alien also drops the human proportions
|
||||
#: (see _BODY_DEFINED_CLASSES): its anatomy slots already ARE the body.
|
||||
_HUMAN_PROPORTION_FIELDS = {"bust", "waist", "hips", "shoulder_width", "neck_length"}
|
||||
_FORM_SUPPRESS_FIELDS: dict[str, set[str]] = {
|
||||
_FORM_ANTHRO: set(),
|
||||
_FORM_ANTHRO: {"fitness_level"},
|
||||
_FORM_FERAL: {"bust", "waist", "hips", "shoulder_width", "neck_length", "posture",
|
||||
"fitness_level"},
|
||||
_FORM_SUBTLE: set(),
|
||||
@@ -179,14 +184,22 @@ def _resolve_creature(creature: str, rng: random.Random) -> str | None:
|
||||
return creature
|
||||
|
||||
|
||||
def _slot_text(entry: dict, slot: str, anthro: bool):
|
||||
"""The entry's text for ``slot``; in Anthro form its ``anthro`` text wins ("" drops it)."""
|
||||
rewrites = entry.get("anthro") or {}
|
||||
return rewrites[slot] if anthro and slot in rewrites else entry.get(slot)
|
||||
|
||||
|
||||
def _resolve_slot(
|
||||
slot: str, base_name: str | None, selection: str, rng: random.Random
|
||||
slot: str, base_name: str | None, selection: str, rng: random.Random,
|
||||
anthro: bool = False,
|
||||
) -> tuple[str | None, str | None]:
|
||||
"""Resolve one slot to ``(value, source_creature)``.
|
||||
|
||||
``Follow base`` uses the base creature; ``Random`` picks any creature for that
|
||||
slot; a name uses that creature. Returns ``(None, None)`` when nothing applies
|
||||
(e.g. the source creature does not fill that slot).
|
||||
(e.g. the source creature does not fill that slot). ``anthro`` prefers the
|
||||
source's ``anthro`` text for the slot (2.4.0; no extra draw, so seed-safe).
|
||||
"""
|
||||
if selection == _FOLLOW:
|
||||
source = base_name
|
||||
@@ -199,7 +212,7 @@ def _resolve_slot(
|
||||
source = None
|
||||
if not source:
|
||||
return None, None
|
||||
value = get_creature(source).get(slot)
|
||||
value = _slot_text(get_creature(source), slot, anthro)
|
||||
return (value if isinstance(value, str) and value else None), source
|
||||
|
||||
|
||||
@@ -229,10 +242,13 @@ def _parse_more_features(text: str, slots: "OrderedDict[str, str]") -> list[str]
|
||||
return extras
|
||||
|
||||
|
||||
def _suppression(form_token: str, slots: "OrderedDict[str, str]") -> tuple[list[str], list[str]]:
|
||||
def _suppression(form_token: str, slots: "OrderedDict[str, str]",
|
||||
creature_class: str = "") -> tuple[list[str], list[str]]:
|
||||
"""Return ``(suppress_groups, suppress_fields)`` for the form and filled slots."""
|
||||
groups = set(_FORM_SUPPRESS_GROUPS.get(form_token, set()))
|
||||
fields = set(_FORM_SUPPRESS_FIELDS.get(form_token, set()))
|
||||
if form_token == _FORM_ANTHRO and creature_class in _BODY_DEFINED_CLASSES:
|
||||
fields |= _HUMAN_PROPORTION_FIELDS
|
||||
if form_token != _FORM_SUBTLE: # Subtle keeps the human; its creature bits are accents
|
||||
for slot in slots:
|
||||
groups |= _SLOT_CONCEAL_GROUPS.get(slot, set())
|
||||
@@ -284,11 +300,12 @@ def build_creature_json(
|
||||
integument_source = base_name
|
||||
for slot in CREATURE_SLOTS:
|
||||
if slot in _OVERRIDE_SLOTS:
|
||||
value, source = _resolve_slot(slot, base_name, overrides[slot], rng)
|
||||
value, source = _resolve_slot(slot, base_name, overrides[slot], rng,
|
||||
anthro=form_token == _FORM_ANTHRO)
|
||||
if slot == "integument" and source:
|
||||
integument_source = source
|
||||
elif base_name: # base-only slots (extras)
|
||||
raw = get_creature(base_name).get(slot)
|
||||
raw = _slot_text(get_creature(base_name), slot, form_token == _FORM_ANTHRO)
|
||||
value = raw if isinstance(raw, str) and raw else None
|
||||
else:
|
||||
value = None
|
||||
@@ -338,7 +355,10 @@ def build_creature_json(
|
||||
meta["form"] = form_token
|
||||
if size:
|
||||
meta["size"] = size
|
||||
suppress_groups, suppress_fields = _suppression(form_token, slots)
|
||||
anthro_subject = (get_creature(base_name).get("anthro") or {}).get("subject") if base_name else None
|
||||
if form_token == _FORM_ANTHRO and anthro_subject:
|
||||
meta["anthro_subject"] = anthro_subject
|
||||
suppress_groups, suppress_fields = _suppression(form_token, slots, meta["creature_class"])
|
||||
meta["suppress_groups"] = suppress_groups
|
||||
meta["suppress_fields"] = suppress_fields
|
||||
|
||||
@@ -457,19 +477,12 @@ if _COMFY_AVAILABLE:
|
||||
"upstream through unchanged.",
|
||||
),
|
||||
],
|
||||
outputs=[io.String.Output(display_name="character_json")],
|
||||
outputs=[io.String.Output(
|
||||
display_name="character_json",
|
||||
tooltip="The preset as JSON. Wire into Identity Forge's 'archetype_json', or into another preset's 'upstream' to stack them.",
|
||||
)],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, **kwargs: Any) -> float:
|
||||
# Force a fresh roll on every queue. ComfyUI can serve a stale cached
|
||||
# result when control_after_generate auto-advances the seed (ComfyUI
|
||||
# #11905); returning a never-equal value (NaN) makes this node's cache
|
||||
# signature always differ, so it re-executes and reads the new seed.
|
||||
# Pure cache control -- no RNG here, so a fixed seed still reproduces
|
||||
# exactly and nothing biases the randomization.
|
||||
return float("nan")
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
own = build_creature_json(
|
||||
|
||||
@@ -35,11 +35,11 @@ except ImportError: # pragma: no cover - exercised only outside ComfyUI
|
||||
|
||||
try:
|
||||
from .identity_forge_turnaround import (
|
||||
_FRAMINGS, _REPLAY_SEED, _forge_class, _unwrap, replay_steering,
|
||||
_FRAMINGS, _forge_class, _unwrap, parse_document, pin_framing, replay_base,
|
||||
)
|
||||
except ImportError: # pragma: no cover - standalone/test context
|
||||
from nodes.identity_forge_turnaround import (
|
||||
_FRAMINGS, _REPLAY_SEED, _forge_class, _unwrap, replay_steering,
|
||||
_FRAMINGS, _forge_class, _unwrap, parse_document, pin_framing, replay_base,
|
||||
)
|
||||
|
||||
_LOG = logging.getLogger(__name__)
|
||||
@@ -90,17 +90,11 @@ def resolve_expression_sheet(
|
||||
) -> "tuple[list[str], list[str]]":
|
||||
"""Render one resolved character once per expression. Returns ``(prompts, labels)``."""
|
||||
forge = _forge_class()
|
||||
# Schema defaults for every input, then the document: the Turnaround's recipe, and
|
||||
# its long note on why defaults (not "Random" everywhere) are load-bearing.
|
||||
base: "dict[str, Any]" = {
|
||||
spec.id: getattr(spec, "default", None) for spec in forge.define_schema().inputs
|
||||
}
|
||||
base["seed"] = _REPLAY_SEED
|
||||
base["archetype_json"] = character_json or ""
|
||||
base.update(replay_steering(character_json))
|
||||
framing = _FRAMINGS.get(framing_name, "")
|
||||
if framing:
|
||||
base["shot_type"] = framing
|
||||
# The Turnaround's replay recipe (schema defaults, then the document).
|
||||
base = replay_base(character_json)
|
||||
# 2.6.0: a close-up refuses a standing pose; release it rather than voice both.
|
||||
pin_framing(base, parse_document(character_json), character_json,
|
||||
_FRAMINGS.get(framing_name, ""))
|
||||
if gaze_name in _GAZES and gaze_name != _KEEP_GAZE:
|
||||
base["gaze"] = gaze_name
|
||||
|
||||
@@ -193,7 +187,6 @@ if _COMFY_AVAILABLE:
|
||||
],
|
||||
)
|
||||
|
||||
# No fingerprint_inputs: no RNG and no auto-advancing widget (see Turnaround).
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
|
||||
@@ -228,7 +228,10 @@ if _COMFY_AVAILABLE:
|
||||
"signature prop. Leave empty for none.",
|
||||
),
|
||||
],
|
||||
outputs=[io.String.Output(display_name="character_json")],
|
||||
outputs=[io.String.Output(
|
||||
display_name="character_json",
|
||||
tooltip="The preset as JSON. Wire into Identity Forge's 'archetype_json', or into another preset's 'upstream' to stack them.",
|
||||
)],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
"""IdentityForgeOutfitSheet node - one resolved character, a row of outfits.
|
||||
|
||||
The wardrobe-side sibling of :mod:`nodes.identity_forge_turnaround` and
|
||||
:mod:`nodes.identity_forge_expression_sheet`, built the same way (read the Turnaround's
|
||||
docstring first): it takes a **resolved** character (Identity Forge's ``prompt_json``),
|
||||
re-runs the engine over it once per view and emits the prompts as a **list**.
|
||||
|
||||
**Ownership line.** This node owns only the clothes. Each view pins one
|
||||
``outfit_style`` and *releases* every Clothing field from the document, so the engine
|
||||
dresses the same person again under its own rules (season, place, age, body). The
|
||||
other sheets pin fixed values instead; that cannot work here, because an outfit is a
|
||||
dozen fields that have to agree with each other, and only the engine can draw them.
|
||||
|
||||
Each view replays on its own seed, derived from the style (not the position), so a
|
||||
style dresses the person the same way in every sheet that contains it, and two views
|
||||
do not share one colour draw.
|
||||
|
||||
A style a live rule refuses (``lock_clash``) is handled by what refuses it. Styling
|
||||
that changes with the occasion (makeup, jewellery, hair styling, see
|
||||
:data:`_RESTYLED`) is released and redrawn for that view. Anything else (edgy
|
||||
alternative at 60+, resort wear in winter, a style the kept scene excludes) skips the
|
||||
style rather than voicing a contradiction, and logs it. A cosplayer wears their costume, so
|
||||
a cosplay or a body-covering character emits one view, as does one with no clothing.
|
||||
|
||||
Text-only, zero new dependencies.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from comfy_api.latest import io # type: ignore[import-not-found]
|
||||
_COMFY_AVAILABLE: bool = True
|
||||
except ImportError: # pragma: no cover - exercised only outside ComfyUI
|
||||
_COMFY_AVAILABLE = False
|
||||
|
||||
try:
|
||||
from ..data.constraints import lock_clash
|
||||
from .identity_forge import FIELD_DEFINITIONS
|
||||
from .identity_forge_turnaround import (
|
||||
_FRAMINGS, _KEEP_POSE, _NEUTRAL_POSES, _forge_class, _unwrap, document_fields,
|
||||
character_seed, document_meta, parse_document, pin_framing, release_fields, replay_base,
|
||||
)
|
||||
except ImportError: # pragma: no cover - standalone/test context
|
||||
from data.constraints import lock_clash
|
||||
from nodes.identity_forge import FIELD_DEFINITIONS
|
||||
from nodes.identity_forge_turnaround import (
|
||||
_FRAMINGS, _KEEP_POSE, _NEUTRAL_POSES, _forge_class, _unwrap, document_fields,
|
||||
character_seed, document_meta, parse_document, pin_framing, release_fields, replay_base,
|
||||
)
|
||||
|
||||
_LOG = logging.getLogger(__name__)
|
||||
|
||||
#: Every Clothing field, derived so a field added later is released too.
|
||||
_CLOTHING: "frozenset[str]" = frozenset(
|
||||
name for name, field in FIELD_DEFINITIONS.items() if field.get("group") == "Clothing")
|
||||
|
||||
_STYLES: "list[str]" = list(FIELD_DEFINITIONS["outfit_style"]["female_options"])
|
||||
|
||||
#: The selectable sheets, in display order. Exact ``outfit_style`` pool values.
|
||||
_SHEETS: "dict[str, tuple[str, ...]]" = {
|
||||
"Range (6)": ("casual", "smart casual", "business formal", "evening formal",
|
||||
"athletic", "resort vacation"),
|
||||
"Everyday (4)": ("casual", "smart casual", "streetwear", "athletic"),
|
||||
"Work to evening (4)": ("business casual", "business formal", "cocktail semi-formal",
|
||||
"evening formal"),
|
||||
"Every style (15)": tuple(_STYLES),
|
||||
}
|
||||
|
||||
_KEEP_SCENE = "Keep the character's scene"
|
||||
|
||||
#: Backdrop label -> exact ``location`` pool value ("" keeps the scene). A plain
|
||||
#: backdrop is the reference-sheet default: no place for a style to clash with.
|
||||
_BACKDROPS: "dict[str, str]" = {
|
||||
"Grey studio backdrop": "seamless grey studio backdrop",
|
||||
"White studio backdrop": "solid white studio backdrop",
|
||||
"Black studio backdrop": "solid black studio backdrop",
|
||||
_KEEP_SCENE: "",
|
||||
}
|
||||
|
||||
#: Scene fields drawn against the place; released with it when a backdrop replaces it
|
||||
#: (studio light at a backdrop, not the park's afternoon sun; a backdrop has no season,
|
||||
#: by the engine's own location -> season rule).
|
||||
_SCENE: "frozenset[str]" = frozenset({"location", "lighting", "composition", "season"})
|
||||
|
||||
#: Styling a person changes with the occasion. The engine gates most of it on
|
||||
#: ``outfit_style`` (mismatched earrings with business dress, a pearl necklace with
|
||||
#: athletic wear, a scrunchie with evening dress); measured over 60 seeds, skipping
|
||||
#: on these instead left most backdrop sheets with one or two views. So a style that
|
||||
#: refuses one of them restyles it; a style refused by anything else (age, season,
|
||||
#: the kept place) is skipped.
|
||||
_RESTYLED: "frozenset[str]" = frozenset(
|
||||
name for name, field in FIELD_DEFINITIONS.items()
|
||||
if field.get("group") in ("Makeup", "Jewelry & Nails")
|
||||
) | {"hair_accessory", "hair_style"}
|
||||
|
||||
|
||||
def _single_view(meta: "dict[str, Any]") -> bool:
|
||||
"""A character whose outfit is not the engine's to redraw."""
|
||||
suppressed_groups = meta.get("suppress_groups") or ()
|
||||
suppressed_fields = meta.get("suppress_fields") or ()
|
||||
return bool(meta.get("cosplay_of") or meta.get("covers_body")
|
||||
or "Clothing" in suppressed_groups or "outfit_description" in suppressed_fields)
|
||||
|
||||
|
||||
def resolve_outfit_sheet(
|
||||
character_json: str, sheet_name: str, backdrop_name: str, framing_name: str,
|
||||
pose_name: str, outfit_seed: int = 0,
|
||||
) -> "tuple[list[str], list[str]]":
|
||||
"""Render one resolved character once per outfit style. Returns ``(prompts, labels)``."""
|
||||
forge = _forge_class()
|
||||
document = parse_document(character_json)
|
||||
meta = document_meta(document)
|
||||
base = replay_base(character_json)
|
||||
# 2.6.0: released before the one-view path below, which used to replay the
|
||||
# framing's clashes (a standing pose in a close-up) unchanged.
|
||||
pin_framing(base, document, character_json, _FRAMINGS.get(framing_name, ""))
|
||||
if pose_name != _KEEP_POSE:
|
||||
base["pose"] = pose_name
|
||||
|
||||
if not document or _single_view(meta):
|
||||
_LOG.warning("This character's outfit is a costume or a body form, not a "
|
||||
"wardrobe; emitting one view.")
|
||||
return [str(_unwrap(forge.execute(**base))[0])], ["1-as-resolved"]
|
||||
|
||||
released = set(_CLOTHING)
|
||||
backdrop = _BACKDROPS.get(backdrop_name, "")
|
||||
if backdrop:
|
||||
released |= _SCENE
|
||||
base["location"] = backdrop
|
||||
release_fields(document, released)
|
||||
base["archetype_json"] = json.dumps(document)
|
||||
# What the outfit must agree with: everything the replay keeps, plus the pins.
|
||||
context = document_fields(document)
|
||||
context.update({k: base[k] for k in ("location", "pose") if k in base
|
||||
and base[k] not in ("Random", None)})
|
||||
|
||||
names = _SHEETS.get(sheet_name, _SHEETS["Range (6)"])
|
||||
prompts: "list[str]" = []
|
||||
labels: "list[str]" = []
|
||||
for style in names:
|
||||
refused = {name for name, value in context.items()
|
||||
if lock_clash("outfit_style", style, {name: value})}
|
||||
if refused - _RESTYLED:
|
||||
_LOG.info("Outfit sheet: skipping '%s', which this character's %s refuses.",
|
||||
style, ", ".join(sorted(refused - _RESTYLED)))
|
||||
continue
|
||||
view = {**base, "outfit_style": style,
|
||||
"seed": character_seed(character_json, f"{outfit_seed}|{style}")}
|
||||
if refused:
|
||||
restyled = json.loads(json.dumps(document))
|
||||
release_fields(restyled, refused)
|
||||
view["archetype_json"] = json.dumps(restyled)
|
||||
prompts.append(str(_unwrap(forge.execute(**view))[0]))
|
||||
labels.append(f"{len(prompts)}-{style.replace(' ', '-')}")
|
||||
if not prompts:
|
||||
_LOG.warning("Every style in this sheet clashes with the character; "
|
||||
"emitting one view as resolved.")
|
||||
return [str(_unwrap(forge.execute(**replay_base(character_json)))[0])], \
|
||||
["1-as-resolved"]
|
||||
return prompts, labels
|
||||
|
||||
|
||||
if _COMFY_AVAILABLE:
|
||||
|
||||
class IdentityForgeOutfitSheet(io.ComfyNode): # type: ignore[misc, valid-type]
|
||||
"""Emit one resolved character in several outfits, as a list."""
|
||||
|
||||
@classmethod
|
||||
def define_schema(cls) -> "io.Schema":
|
||||
return io.Schema(
|
||||
node_id="IdentityForgeOutfitSheet",
|
||||
display_name="Identity Forge Outfit Sheet",
|
||||
category="conditioning/character",
|
||||
description=(
|
||||
"One character, several outfits, from a single queue: a wardrobe "
|
||||
"sheet. Wire Identity Forge's 'prompt_json' in; the 'prompt' "
|
||||
"output is a LIST, so everything downstream runs once per outfit. "
|
||||
"Only the clothes change - the person stays exactly as resolved."
|
||||
),
|
||||
inputs=[
|
||||
io.String.Input(
|
||||
"character_json",
|
||||
default="",
|
||||
force_input=True,
|
||||
tooltip="Connect Identity Forge's 'prompt_json' output. Every "
|
||||
"view is the same person; each one is dressed again "
|
||||
"in one outfit style. A cosplayer wears their costume, "
|
||||
"so a cosplay character emits one view.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"sheet",
|
||||
options=list(_SHEETS),
|
||||
default="Range (6)",
|
||||
tooltip="Which outfit styles to emit, and so how many images one "
|
||||
"queue makes. Range (6) = casual, smart casual, business "
|
||||
"formal, evening formal, athletic, resort vacation. A "
|
||||
"style that clashes with the character (edgy "
|
||||
"alternative at 60+, for example) is skipped.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"backdrop",
|
||||
options=list(_BACKDROPS),
|
||||
default="Grey studio backdrop",
|
||||
tooltip="Where each outfit is shown. A plain studio backdrop "
|
||||
"suits every style; 'Keep the character's scene' keeps "
|
||||
"the place, lighting and composition, and skips any "
|
||||
"style that place refuses (no evening gown on a hiking "
|
||||
"trail).",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"framing",
|
||||
options=list(_FRAMINGS),
|
||||
default="Full body",
|
||||
tooltip="How much of the subject each view frames. 'Full body' "
|
||||
"shows the whole outfit, shoes included. 'Unspecified' "
|
||||
"keeps the character's own framing.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"pose",
|
||||
options=list(_NEUTRAL_POSES) + [_KEEP_POSE],
|
||||
default=_NEUTRAL_POSES[0],
|
||||
tooltip="Pins a standing stance so every outfit is shown the "
|
||||
"same way. Choose 'Keep the character's pose' to keep "
|
||||
"it (a seated pose hides much of an outfit).",
|
||||
),
|
||||
io.Int.Input(
|
||||
"outfit_seed",
|
||||
default=0,
|
||||
min=0,
|
||||
max=0xFFFFFFFFFFFFFFFF,
|
||||
control_after_generate=True,
|
||||
tooltip="Rolls a different outfit in every style for the same "
|
||||
"character. Outfits already differ from one character "
|
||||
"to the next; change this to re-dress the same person. "
|
||||
"Set the control to 'randomize' for new outfits every "
|
||||
"queue.",
|
||||
),
|
||||
],
|
||||
outputs=[
|
||||
io.String.Output(
|
||||
display_name="prompt",
|
||||
is_output_list=True,
|
||||
tooltip="One prompt per outfit, as a list. Wire into "
|
||||
"CLIPTextEncode.",
|
||||
),
|
||||
io.String.Output(
|
||||
display_name="view_label",
|
||||
is_output_list=True,
|
||||
tooltip="Matching list of sortable names ('1-casual', "
|
||||
"'2-smart-casual', ...). Wire into Save Image's "
|
||||
"filename_prefix.",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
prompts, labels = resolve_outfit_sheet(
|
||||
kwargs.get("character_json", ""),
|
||||
kwargs.get("sheet", "Range (6)"),
|
||||
kwargs.get("backdrop", "Grey studio backdrop"),
|
||||
kwargs.get("framing", "Full body"),
|
||||
kwargs.get("pose", _NEUTRAL_POSES[0]),
|
||||
int(kwargs.get("outfit_seed", 0) or 0),
|
||||
)
|
||||
return io.NodeOutput(prompts, labels)
|
||||
@@ -0,0 +1,204 @@
|
||||
"""IdentityForgeSceneSheet node - one resolved character, a row of places (2.6.0).
|
||||
|
||||
The location-side sibling of :mod:`nodes.identity_forge_outfit_sheet`, built the same
|
||||
way (read the Turnaround's docstring first): it takes a **resolved** character
|
||||
(Identity Forge's ``prompt_json``), re-runs the engine over it once per place and
|
||||
emits the prompts as a **list**.
|
||||
|
||||
**Ownership line.** This node owns the place. Each view pins one ``location`` and
|
||||
releases the scene drawn against the old one (lighting, composition, season), so the
|
||||
engine lights and dates the new place itself. The person never changes.
|
||||
|
||||
A place a live rule refuses (``lock_clash``) is handled by what refuses it, as in the
|
||||
Outfit Sheet: stance and styling a person changes with the setting (pose, gaze,
|
||||
framing, makeup, jewellery, hair styling, see :data:`_RESTAGED`) are released and
|
||||
redrawn for that view; anything else (age, body, a locked held item) skips the place
|
||||
and logs it. Clothing follows the ``clothes`` input: by default every place dresses
|
||||
the person again (beach clothes on the beach, office clothes in the office); "Keep the
|
||||
outfit" keeps it and skips a place that refuses it. A cosplayer or a body-covering
|
||||
character always keeps their costume.
|
||||
|
||||
Text-only, zero new dependencies.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from comfy_api.latest import io # type: ignore[import-not-found]
|
||||
_COMFY_AVAILABLE: bool = True
|
||||
except ImportError: # pragma: no cover - exercised only outside ComfyUI
|
||||
_COMFY_AVAILABLE = False
|
||||
|
||||
try:
|
||||
from ..data.constraints import lock_clash
|
||||
from .identity_forge_outfit_sheet import _CLOTHING, _RESTYLED, _single_view
|
||||
from .identity_forge_turnaround import (
|
||||
_FRAMINGS, _forge_class, _unwrap, character_seed, document_fields, document_meta,
|
||||
parse_document, release_fields, replay_base,
|
||||
)
|
||||
except ImportError: # pragma: no cover - standalone/test context
|
||||
from data.constraints import lock_clash
|
||||
from nodes.identity_forge_outfit_sheet import _CLOTHING, _RESTYLED, _single_view
|
||||
from nodes.identity_forge_turnaround import (
|
||||
_FRAMINGS, _forge_class, _unwrap, character_seed, document_fields, document_meta,
|
||||
parse_document, release_fields, replay_base,
|
||||
)
|
||||
|
||||
_LOG = logging.getLogger(__name__)
|
||||
|
||||
#: The selectable sheets, in display order. Exact ``location`` pool values.
|
||||
_SHEETS: "dict[str, tuple[str, ...]]" = {
|
||||
"Everyday (6)": ("sunny city park", "cozy corner coffee shop",
|
||||
"modern open-concept living room", "corporate open office",
|
||||
"wide sandy beach", "forest trail"),
|
||||
"Indoors (4)": ("cozy corner coffee shop", "modern open-concept living room",
|
||||
"cozy bookstore with reading nooks", "dimly lit cocktail lounge"),
|
||||
"Outdoors (4)": ("sunny city park", "wide sandy beach", "forest trail",
|
||||
"neon-lit city street"),
|
||||
"Studio backdrops (3)": ("seamless grey studio backdrop", "solid white studio backdrop",
|
||||
"solid black studio backdrop"),
|
||||
}
|
||||
|
||||
_DRESS = "Dress for each place"
|
||||
_KEEP_OUTFIT = "Keep the outfit (skip places that refuse it)"
|
||||
|
||||
#: Drawn against the place, so released with it (``location_setting`` too: a recorded
|
||||
#: "Indoor" must not fight a pinned beach).
|
||||
_SCENE: "frozenset[str]" = frozenset(
|
||||
{"location", "location_setting", "lighting", "composition", "season"})
|
||||
|
||||
#: What a person changes with the setting; a place that refuses one of these redraws
|
||||
#: it for that view instead of being skipped.
|
||||
_RESTAGED: "frozenset[str]" = _RESTYLED | {"pose", "gaze", "shot_type"}
|
||||
|
||||
|
||||
def resolve_scene_sheet(
|
||||
character_json: str, sheet_name: str, framing_name: str, clothes: str = _DRESS,
|
||||
) -> "tuple[list[str], list[str]]":
|
||||
"""Render one resolved character once per place. Returns ``(prompts, labels)``."""
|
||||
forge = _forge_class()
|
||||
document = parse_document(character_json)
|
||||
base = replay_base(character_json)
|
||||
if not document:
|
||||
return [str(_unwrap(forge.execute(**base))[0])], ["1-as-resolved"]
|
||||
|
||||
framing = _FRAMINGS.get(framing_name, "")
|
||||
if framing:
|
||||
base["shot_type"] = framing
|
||||
redress = clothes != _KEEP_OUTFIT and not _single_view(document_meta(document))
|
||||
release_fields(document, set(_SCENE) | (set(_CLOTHING) if redress else set()))
|
||||
# What the place must agree with: everything the replay keeps, plus the framing pin.
|
||||
context = document_fields(document)
|
||||
pinned = {"shot_type": framing} if framing else {}
|
||||
context.update(pinned)
|
||||
|
||||
prompts: "list[str]" = []
|
||||
labels: "list[str]" = []
|
||||
for place in _SHEETS.get(sheet_name, _SHEETS["Everyday (6)"]):
|
||||
refused = {name for name, value in context.items()
|
||||
if lock_clash("location", place, {name: value})}
|
||||
blocked = (refused - _RESTAGED) | (refused & set(pinned))
|
||||
if blocked:
|
||||
_LOG.info("Scene sheet: skipping '%s', which this character's %s refuses.",
|
||||
place, ", ".join(sorted(blocked)))
|
||||
continue
|
||||
view_document = json.loads(json.dumps(document))
|
||||
release_fields(view_document, refused)
|
||||
view = {**base, "location": place, "archetype_json": json.dumps(view_document),
|
||||
"seed": character_seed(character_json, f"scene|{place}")}
|
||||
prompts.append(str(_unwrap(forge.execute(**view))[0]))
|
||||
labels.append(f"{len(prompts)}-{place.replace(' ', '-')}")
|
||||
if not prompts:
|
||||
_LOG.warning("Every place in this sheet clashes with the character; "
|
||||
"emitting one view as resolved.")
|
||||
return [str(_unwrap(forge.execute(**replay_base(character_json)))[0])], \
|
||||
["1-as-resolved"]
|
||||
return prompts, labels
|
||||
|
||||
|
||||
if _COMFY_AVAILABLE:
|
||||
|
||||
class IdentityForgeSceneSheet(io.ComfyNode): # type: ignore[misc, valid-type]
|
||||
"""Emit one resolved character in several places, as a list."""
|
||||
|
||||
@classmethod
|
||||
def define_schema(cls) -> "io.Schema":
|
||||
return io.Schema(
|
||||
node_id="IdentityForgeSceneSheet",
|
||||
display_name="Identity Forge Scene Sheet",
|
||||
category="conditioning/character",
|
||||
description=(
|
||||
"One character, several places, from a single queue. Wire Identity "
|
||||
"Forge's 'prompt_json' in; the 'prompt' output is a LIST, so "
|
||||
"everything downstream runs once per place. The person stays "
|
||||
"exactly as resolved; the place, its light and season change, and "
|
||||
"by default the clothes are chosen again to suit each place."
|
||||
),
|
||||
inputs=[
|
||||
io.String.Input(
|
||||
"character_json",
|
||||
default="",
|
||||
force_input=True,
|
||||
tooltip="Connect Identity Forge's 'prompt_json' output. Every "
|
||||
"view is the same person, shown in a different place.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"sheet",
|
||||
options=list(_SHEETS),
|
||||
default="Everyday (6)",
|
||||
tooltip="Which places to emit, and so how many images one queue "
|
||||
"makes. Everyday (6) = city park, coffee shop, living "
|
||||
"room, office, beach, forest trail. A place that clashes "
|
||||
"with the character is skipped.",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"framing",
|
||||
options=list(_FRAMINGS),
|
||||
default="Cowboy (mid-thigh up)",
|
||||
tooltip="How much of the subject each view frames. A wider "
|
||||
"shot shows more of the place. 'Unspecified' keeps the "
|
||||
"character's own framing (redrawn where a place "
|
||||
"refuses it).",
|
||||
),
|
||||
io.Combo.Input(
|
||||
"clothes",
|
||||
options=[_DRESS, _KEEP_OUTFIT],
|
||||
default=_DRESS,
|
||||
tooltip="'Dress for each place' picks a new outfit that suits "
|
||||
"every place. 'Keep the outfit' keeps the character's "
|
||||
"clothes and skips any place they do not fit (no "
|
||||
"evening gown on a forest trail). A cosplayer always "
|
||||
"keeps their costume.",
|
||||
),
|
||||
],
|
||||
outputs=[
|
||||
io.String.Output(
|
||||
display_name="prompt",
|
||||
is_output_list=True,
|
||||
tooltip="One prompt per place, as a list. Wire into "
|
||||
"CLIPTextEncode.",
|
||||
),
|
||||
io.String.Output(
|
||||
display_name="view_label",
|
||||
is_output_list=True,
|
||||
tooltip="Matching list of sortable names ('1-sunny-city-park', "
|
||||
"...). Wire into Save Image's filename_prefix.",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
# No fingerprint_inputs: every seed is derived, nothing auto-advances (see
|
||||
# Turnaround), so the node is a pure function of its inputs.
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
prompts, labels = resolve_scene_sheet(
|
||||
kwargs.get("character_json", ""),
|
||||
kwargs.get("sheet", "Everyday (6)"),
|
||||
kwargs.get("framing", "Cowboy (mid-thigh up)"),
|
||||
kwargs.get("clothes", _DRESS),
|
||||
)
|
||||
return io.NodeOutput(prompts, labels)
|
||||
@@ -31,9 +31,6 @@ Why a list output rather than an auto-incrementing ``index`` widget:
|
||||
downstream once per element (``execution.py`` -> ``merge_result_data``), and
|
||||
shorter inputs — the negative prompt, the model, the latent — broadcast off
|
||||
their last element, so an ordinary graph needs no rewiring.
|
||||
* **No cache hack.** With no auto-advancing widget and no RNG this node is a pure
|
||||
function of its inputs, so it needs no ``fingerprint_inputs`` (contrast the
|
||||
four seeded nodes — architecture.md -> "Seeded nodes re-roll every queue").
|
||||
|
||||
Why the resolved document is enough to re-render from: ``prompt_json`` is
|
||||
self-describing by contract — it is exactly what Vault Save writes and Vault Load
|
||||
@@ -47,6 +44,7 @@ Text-only, zero new dependencies, no IMAGE anywhere.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import zlib
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
@@ -57,9 +55,11 @@ except ImportError: # pragma: no cover — exercised only outside ComfyUI
|
||||
|
||||
|
||||
try:
|
||||
from ..data.constraints import lock_clash
|
||||
from ..data.cosplayers import COSPLAYERS
|
||||
from .identity_forge import FIELD_DEFINITIONS
|
||||
except ImportError: # pragma: no cover — standalone/test context
|
||||
from data.constraints import lock_clash
|
||||
from data.cosplayers import COSPLAYERS
|
||||
from nodes.identity_forge import FIELD_DEFINITIONS
|
||||
|
||||
@@ -230,6 +230,92 @@ def replay_steering(character_json: str) -> "dict[str, str]":
|
||||
}
|
||||
|
||||
|
||||
def replay_base(character_json: str) -> "dict[str, Any]":
|
||||
"""Main-node kwargs that replay ``character_json`` unchanged: every input on its
|
||||
schema default, the replay seed, the document, and its recorded steering. See
|
||||
:func:`resolve_turnaround` for why the defaults (not "Random") are load-bearing."""
|
||||
forge = _forge_class()
|
||||
base: "dict[str, Any]" = {
|
||||
spec.id: getattr(spec, "default", None) for spec in forge.define_schema().inputs
|
||||
}
|
||||
base["seed"] = _REPLAY_SEED
|
||||
base["archetype_json"] = character_json or ""
|
||||
base.update(replay_steering(character_json))
|
||||
return base
|
||||
|
||||
|
||||
def character_seed(character_json: str, salt: str = "") -> int:
|
||||
"""A replay seed for sheets that RELEASE fields (Outfit Sheet, Age Progression).
|
||||
|
||||
The fixed :data:`_REPLAY_SEED` is right for a replay that redraws nothing, but a
|
||||
released field redrawn from it lands on the same value for every character (2.3.0:
|
||||
40 characters' casual views shared four outfits). Hashing the document makes the
|
||||
redraw differ between characters and repeat for the same one.
|
||||
"""
|
||||
return zlib.crc32(f"{salt}|{character_json or ''}".encode("utf-8"))
|
||||
|
||||
|
||||
def parse_document(character_json: str) -> "dict[str, Any]":
|
||||
"""The resolved document as a dict, or ``{}`` for anything malformed."""
|
||||
try:
|
||||
document = json.loads(character_json or "{}")
|
||||
except (ValueError, TypeError):
|
||||
return {}
|
||||
return document if isinstance(document, dict) else {}
|
||||
|
||||
|
||||
def document_meta(document: "dict[str, Any]") -> "dict[str, Any]":
|
||||
meta = document.get("_meta")
|
||||
return meta if isinstance(meta, dict) else {}
|
||||
|
||||
|
||||
def document_fields(document: "dict[str, Any]") -> "dict[str, str]":
|
||||
"""Every concrete field value in the document, flattened out of its groups."""
|
||||
return {
|
||||
name: value
|
||||
for key, group in document.items() if key != "_meta" and isinstance(group, dict)
|
||||
for name, value in group.items()
|
||||
if name in FIELD_DEFINITIONS and isinstance(value, str)
|
||||
}
|
||||
|
||||
|
||||
def release_fields(document: "dict[str, Any]", names: "set[str]") -> None:
|
||||
"""Unlock ``names`` in place, so a replay draws them again under the engine's rules.
|
||||
|
||||
A field is locked twice over in a resolved document: by its value in a group, and,
|
||||
when it was deliberately absent, by ``_meta.omitted`` (re-injected as a "None"
|
||||
lock). Both have to go or the field stays pinned.
|
||||
"""
|
||||
for key, group in document.items():
|
||||
if key != "_meta" and isinstance(group, dict):
|
||||
for name in names:
|
||||
group.pop(name, None)
|
||||
meta = document_meta(document)
|
||||
if isinstance(meta.get("omitted"), list):
|
||||
meta["omitted"] = [n for n in meta["omitted"] if n not in names]
|
||||
|
||||
|
||||
def pin_framing(base: "dict[str, Any]", document: "dict[str, Any]", character_json: str,
|
||||
framing: str) -> None:
|
||||
"""Pin ``framing`` on the replay kwargs and release every kept field it refuses.
|
||||
|
||||
2.6.0: a sheet that pins a framing must also let go of what the framing excludes
|
||||
(a standing pose in a close-up, "the subject small in the frame" at chest height),
|
||||
or the replay voices both. Released fields redraw from a per-character seed, so
|
||||
every character does not land on the same replacement pose. ``document`` is
|
||||
released in place and becomes the replayed preset.
|
||||
"""
|
||||
if not framing:
|
||||
return
|
||||
base["shot_type"] = framing
|
||||
refused = {name for name, value in document_fields(document).items()
|
||||
if lock_clash("shot_type", framing, {name: value})}
|
||||
if refused:
|
||||
release_fields(document, refused)
|
||||
base["archetype_json"] = json.dumps(document)
|
||||
base["seed"] = character_seed(character_json, "framing")
|
||||
|
||||
|
||||
#: Rotations that show the costume's back, where a roster entry's ``costume_back``
|
||||
#: replaces its front-facing costume text (2.0.0).
|
||||
_BACK_OF_COSTUME: "frozenset[str]" = frozenset({_BACK, _REAR_THREE_QUARTER})
|
||||
@@ -293,12 +379,7 @@ def resolve_turnaround(
|
||||
# engine re-rolled it, turning a woman into a man between the main node and the
|
||||
# turnaround. Defaults also mean a control added to the main node later is
|
||||
# deferred to correctly here without this node knowing it exists.
|
||||
base: "dict[str, Any]" = {
|
||||
spec.id: getattr(spec, "default", None) for spec in forge.define_schema().inputs
|
||||
}
|
||||
base["seed"] = _REPLAY_SEED
|
||||
base["archetype_json"] = character_json or ""
|
||||
base.update(replay_steering(character_json))
|
||||
base = replay_base(character_json)
|
||||
if pose_name != _KEEP_POSE:
|
||||
base["pose"] = pose_name
|
||||
# A neutral stance faces the way the camera says; a gaze ("looking over one
|
||||
@@ -445,11 +526,6 @@ if _COMFY_AVAILABLE:
|
||||
],
|
||||
)
|
||||
|
||||
# No fingerprint_inputs on purpose. The four seeded nodes need one because
|
||||
# control_after_generate silently advances a widget between queues
|
||||
# (ComfyUI#11905); this node has no such widget and no RNG, so it is a
|
||||
# pure function of its inputs and ComfyUI's normal caching is correct.
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
prompts, labels = resolve_turnaround(
|
||||
|
||||
@@ -26,6 +26,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
import json
|
||||
import random
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -58,6 +59,21 @@ except ImportError: # pragma: no cover — exercised only outside ComfyUI
|
||||
#: Shown in the combo when the vault is empty (kept stable so saved workflows match).
|
||||
_NO_CHARACTERS = "(no characters saved)"
|
||||
|
||||
#: 2.6.0: last combo option when the vault has entries; ``seed`` picks one of them.
|
||||
#: Appended, never first, so the default (the first saved name) is unchanged.
|
||||
_RANDOM = "(random saved character)"
|
||||
|
||||
|
||||
def resolve_selection(vault_root: Path | str, character: str, seed: int) -> str:
|
||||
"""The entry name ``character`` stands for: itself, or a seeded pick for
|
||||
:data:`_RANDOM` (the same seed and vault give the same pick)."""
|
||||
if character != _RANDOM:
|
||||
return character
|
||||
names = list_character_names(vault_root)
|
||||
if not names:
|
||||
return _NO_CHARACTERS
|
||||
return names[random.Random(seed).randrange(len(names))]
|
||||
|
||||
|
||||
def _is_entry(path: Path) -> bool:
|
||||
"""A folder is a character iff it holds a ``character.json``."""
|
||||
@@ -175,9 +191,18 @@ def rename_character(vault_root: Path | str, old: str, new: str) -> str:
|
||||
if not sanitize_name(new):
|
||||
raise ValueError(f"Unusable new name: {new!r}.")
|
||||
dst = _entry_dir(root, new)
|
||||
if dst.exists() and dst != src:
|
||||
wanted = sanitize_name(new)
|
||||
if dst == src and src.name != wanted:
|
||||
# 2.6.0: a case-only rename ("bob" -> "Bob") on a case-insensitive filesystem
|
||||
# resolves to the same folder, so a direct rename did nothing; go via a temp name.
|
||||
dst = src.with_name(wanted)
|
||||
hop = src.with_name(f".{src.name}.renaming")
|
||||
src.rename(hop)
|
||||
hop.rename(dst)
|
||||
elif dst.exists() and dst != src:
|
||||
raise ValueError(f"A character named {dst.name!r} already exists.")
|
||||
src.rename(dst)
|
||||
else:
|
||||
src.rename(dst)
|
||||
# Keep the sidecar's display_name in step with the folder.
|
||||
meta_path = dst / _META_FILE
|
||||
try:
|
||||
@@ -207,8 +232,7 @@ def _character_fingerprint(vault_root: Path | str, name: str) -> Any:
|
||||
cached ``character_json`` instead of re-reading the file. Folding the
|
||||
selected entry's mtime + size into :meth:`fingerprint_inputs` makes a
|
||||
changed (or now-missing) file force a cache miss; an unchanged file still
|
||||
caches normally, unlike the NaN pattern the other preset nodes use (which
|
||||
disables caching on every queue, not only on a real change).
|
||||
caches normally.
|
||||
"""
|
||||
try:
|
||||
entry = _entry_dir(Path(vault_root), name)
|
||||
@@ -235,7 +259,8 @@ if _COMFY_AVAILABLE:
|
||||
|
||||
@classmethod
|
||||
def define_schema(cls) -> "io.Schema":
|
||||
names = list_character_names(_vault_root()) or [_NO_CHARACTERS]
|
||||
saved = list_character_names(_vault_root())
|
||||
names = saved + [_RANDOM] if saved else [_NO_CHARACTERS]
|
||||
return io.Schema(
|
||||
node_id="IdentityForgeVaultLoad",
|
||||
display_name="Identity Forge Vault Load",
|
||||
@@ -252,7 +277,8 @@ if _COMFY_AVAILABLE:
|
||||
options=names,
|
||||
default=names[0],
|
||||
tooltip="Saved character to recall. Click Refresh after saving new "
|
||||
"ones, or Manage Vault to browse with thumbnails.",
|
||||
"ones, or Manage Vault to browse with thumbnails. "
|
||||
"'(random saved character)' picks one by 'seed'.",
|
||||
),
|
||||
io.String.Input(
|
||||
"upstream",
|
||||
@@ -262,20 +288,48 @@ if _COMFY_AVAILABLE:
|
||||
tooltip="Optional: connect another preset's character_json here to "
|
||||
"stack presets. This saved character wins on overlap.",
|
||||
),
|
||||
# 2.6.0: appended last so older workflows' widgets_values still line up.
|
||||
io.Int.Input(
|
||||
"seed",
|
||||
default=0,
|
||||
min=0,
|
||||
max=0xFFFFFFFFFFFFFFFF,
|
||||
control_after_generate=True,
|
||||
tooltip="Only used with '(random saved character)': picks which "
|
||||
"saved character to recall. Set the control to "
|
||||
"'randomize' for a different one every queue.",
|
||||
),
|
||||
],
|
||||
outputs=[io.String.Output(display_name="character_json")],
|
||||
outputs=[io.String.Output(
|
||||
display_name="character_json",
|
||||
tooltip="The preset as JSON. Wire into Identity Forge's 'archetype_json', or into another preset's 'upstream' to stack them.",
|
||||
)],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate_inputs(cls, character: Any = None) -> bool:
|
||||
# 2.8.0: the vault is per-machine, so a workflow can name an entry that was
|
||||
# deleted, renamed or never saved here, or still hold "(no characters saved)"
|
||||
# after the first save. ComfyUI's combo check rejected those before execute()
|
||||
# could pass the upstream through as documented; naming the input here skips it.
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def fingerprint_inputs(cls, **kwargs: Any) -> Any:
|
||||
# 1.5.5: see _character_fingerprint. Folds the SELECTED entry's
|
||||
# mtime+size into the cache key so an Overwrite/rename/delete that
|
||||
# left the `character` widget unchanged still invalidates the cache.
|
||||
return _character_fingerprint(_vault_root(), kwargs.get("character", _NO_CHARACTERS))
|
||||
# 2.7.1: a random pick folds in WHICH entry the seed lands on, so a save or
|
||||
# delete that moves the pick re-runs; the seed itself is already in the key.
|
||||
root = _vault_root()
|
||||
name = resolve_selection(root, kwargs.get("character", _NO_CHARACTERS),
|
||||
int(kwargs.get("seed", 0) or 0))
|
||||
return (name, _character_fingerprint(root, name))
|
||||
|
||||
@classmethod
|
||||
def execute(cls, **kwargs: Any) -> "io.NodeOutput":
|
||||
character = kwargs.get("character", _NO_CHARACTERS)
|
||||
character = resolve_selection(_vault_root(), kwargs.get("character", _NO_CHARACTERS),
|
||||
int(kwargs.get("seed", 0) or 0))
|
||||
own = "{}"
|
||||
if character and character != _NO_CHARACTERS:
|
||||
own, _ = load_character(_vault_root(), character)
|
||||
|
||||
@@ -92,7 +92,9 @@ def sanitize_name(raw: str) -> str:
|
||||
name = re.sub(r"\s+", " ", name).strip().strip(".").strip()
|
||||
if name in {"", ".", ".."}:
|
||||
return ""
|
||||
name = name[:120].strip()
|
||||
# 2.6.0: re-strip dots after the cut too; Windows drops a trailing dot from a
|
||||
# folder name, so the saved folder and the returned name used to differ.
|
||||
name = name[:120].rstrip(". ")
|
||||
if name.split(".", 1)[0].upper() in _WINDOWS_RESERVED_NAMES:
|
||||
name += "_"
|
||||
return name
|
||||
|
||||
+7
-2
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-identity-forge"
|
||||
version = "2.2.0"
|
||||
description = "Create believable, coherent people, cosplayers and creatures from dropdowns - no prompt engineering required. A constraint engine keeps every trait sensible and a seed makes any result reproducible. Cosplay characters carry a hand-written, canon-checked costume description - garments, colours, masks, markings, signature props - that renders on any checkpoint, and are searchable from an in-node picker with trait facets, gender and franchise filters, and thumbnail previews. A Turnaround node builds a one-queue reference sheet: front, three-quarter, profile and back views of the same resolved character. Public galleries showcase every entry with a sample render and its exact workflow. Optional preset layers add themed archetypes, creature/monster/alien hybridization, per-element style modifiers, and a save/load character vault."
|
||||
version = "2.8.0"
|
||||
description = "Create believable, coherent people, cosplayers and creatures from dropdowns - no prompt engineering required. A constraint engine keeps every trait sensible and a seed makes any result reproducible. Cosplay characters carry a hand-written, canon-checked costume description - garments, colours, masks, markings, signature props - that renders on any checkpoint, and are searchable from an in-node picker with trait facets, gender and franchise filters, and thumbnail previews that also show offline. Sheet nodes build one-queue reference sets of the same resolved character: Turnaround (camera views), Expression Sheet, Outfit Sheet, Scene Sheet (several places) and Age Progression. Public galleries showcase every entry with a sample render and its exact workflow. Optional preset layers add themed archetypes, creature/monster/alien hybridization, per-element style modifiers, and a save/load character vault."
|
||||
license = { text = "MIT" }
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
@@ -20,6 +20,11 @@ PublisherId = "enragedantelope"
|
||||
DisplayName = "Identity Forge"
|
||||
requires-comfyui = ">=0.25.0"
|
||||
|
||||
[tool.ruff]
|
||||
# Matches the version CI installs (.github/workflows/ci.yml); a different local ruff
|
||||
# reports a different rule set, so it refuses to run instead. Bump both together.
|
||||
required-version = "==0.15.11"
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# The test and preview scripts prepend the repo root onto sys.path so they can be
|
||||
# run standalone (``python tests/...``); those imports necessarily follow the shim,
|
||||
|
||||
@@ -47,6 +47,9 @@ from nodes.identity_forge_creature import IdentityForgeCreature # noqa: E402
|
||||
from nodes.identity_forge_modifier import IdentityForgeModifier # noqa: E402
|
||||
from nodes.identity_forge_turnaround import IdentityForgeTurnaround # noqa: E402
|
||||
from nodes.identity_forge_expression_sheet import IdentityForgeExpressionSheet # noqa: E402
|
||||
from nodes.identity_forge_outfit_sheet import IdentityForgeOutfitSheet # noqa: E402
|
||||
from nodes.identity_forge_scene_sheet import IdentityForgeSceneSheet # noqa: E402
|
||||
from nodes.identity_forge_age_progression import IdentityForgeAgeProgression # noqa: E402
|
||||
from nodes.identity_forge_vault_load import ( # noqa: E402
|
||||
IdentityForgeVaultLoad, _NO_CHARACTERS,
|
||||
)
|
||||
@@ -63,6 +66,9 @@ _NODE_CLASSES = {
|
||||
"IdentityForgeModifier": IdentityForgeModifier,
|
||||
"IdentityForgeTurnaround": IdentityForgeTurnaround,
|
||||
"IdentityForgeExpressionSheet": IdentityForgeExpressionSheet,
|
||||
"IdentityForgeOutfitSheet": IdentityForgeOutfitSheet,
|
||||
"IdentityForgeSceneSheet": IdentityForgeSceneSheet,
|
||||
"IdentityForgeAgeProgression": IdentityForgeAgeProgression,
|
||||
"IdentityForgeVaultLoad": IdentityForgeVaultLoad,
|
||||
"IdentityForgeVaultSave": IdentityForgeVaultSave,
|
||||
}
|
||||
|
||||
@@ -251,6 +251,17 @@ def _cosplayer_traits(entry: dict) -> list[str]:
|
||||
return traits
|
||||
|
||||
|
||||
def _text_leaves(value) -> list[str]:
|
||||
"""Every string inside a nested dict/list value, in order."""
|
||||
if isinstance(value, str):
|
||||
return [value]
|
||||
if isinstance(value, dict):
|
||||
value = list(value.values())
|
||||
if isinstance(value, list):
|
||||
return [s for v in value for s in _text_leaves(v)]
|
||||
return []
|
||||
|
||||
|
||||
def _cosplayer_roster_entry(
|
||||
name: str, entry: dict, franchise_categories: dict[str, str], default_category: str,
|
||||
) -> dict:
|
||||
@@ -270,6 +281,10 @@ def _cosplayer_roster_entry(
|
||||
aliases = entry.get("aliases")
|
||||
if aliases:
|
||||
haystack_parts.extend(aliases)
|
||||
# 2.5.0: every other piece of descriptive text is searchable too, including
|
||||
# each alternate look in `costumes`.
|
||||
for key in ("eyes", "subject", "skin", "costume_back", "prop_costume", "anatomy", "costumes"):
|
||||
haystack_parts.extend(_text_leaves(entry.get(key)))
|
||||
roster = {
|
||||
"kind": "cosplayer",
|
||||
"name": name,
|
||||
|
||||
+126
-19
@@ -1,7 +1,8 @@
|
||||
"""Render, record and publish the gallery images for roster entries.
|
||||
|
||||
The three galleries show one image per cosplayer, archetype and creature.
|
||||
Keeping ~2,200 of those honest by hand is not possible, so the build is
|
||||
The galleries show one image per cosplayer, archetype and creature, plus a set
|
||||
of fixed-seed people from the plain Identity Forge node (``PEOPLE``).
|
||||
Keeping thousands of those honest by hand is not possible, so the build is
|
||||
content-addressed: every image records a hash of the prose that produced it,
|
||||
and an entry whose prose has changed (its own text, or an engine change) is
|
||||
reported stale until it is re-rendered.
|
||||
@@ -77,7 +78,24 @@ SEED_FORMULA = "int(sha256(name)[:15], 16)"
|
||||
#: workflow uses, so originals land beside their hand-run renders.
|
||||
ORIGINALS_PREFIX = "identityforge"
|
||||
|
||||
KINDS = ("cosplay", "archetypes", "creatures")
|
||||
KINDS = ("cosplay", "archetypes", "creatures", "people")
|
||||
|
||||
#: The people gallery (2.7.0): the plain Identity Forge node, no preset node, every
|
||||
#: widget at its schema default except the gender. Seeds were scouted so the set
|
||||
#: spans age, outfit style and indoor/outdoor places; an engine change can move what
|
||||
#: a seed draws, and the prose hash then reports the tile stale. No gallery pins
|
||||
#: apply, so a card's seed and gender reproduce its prompt on a fresh node.
|
||||
PEOPLE: dict[str, dict[str, Any]] = {
|
||||
f"Sample {number:02d}": {"seed": seed, "widgets": {"gender": gender}}
|
||||
for number, (seed, gender) in enumerate((
|
||||
(43, "Female"), (82, "Male"), (4, "Female"), (59, "Male"),
|
||||
(7, "Female"), (73, "Male"), (11, "Female"), (76, "Male"),
|
||||
(50, "Female"), (61, "Male"), (58, "Female"), (83, "Male"),
|
||||
(27, "Female"), (30, "Male"), (19, "Female"), (37, "Male"),
|
||||
(6, "Female"), (86, "Male"), (70, "Female"), (74, "Male"),
|
||||
(62, "Female"), (46, "Male"), (52, "Female"), (23, "Male"),
|
||||
), 1)
|
||||
}
|
||||
|
||||
#: Widget values, mirrored from the workflows the gallery images were rendered
|
||||
#: with. Every one is checked against the node's own option list before use, so
|
||||
@@ -165,15 +183,40 @@ def _gallery_shot(seed: int) -> str | None:
|
||||
#: not in the manifest hash.
|
||||
_GALLERY_GENDER: dict[str, dict[str, str]] = {
|
||||
"archetypes": {"Carhop": "Female", "Cheerleader": "Female",
|
||||
"Irish Step Dancer": "Female"},
|
||||
"Irish Step Dancer": "Female",
|
||||
# 2.3.0: the toga is the look people expect; the stola variant stays.
|
||||
"Ancient Roman Patrician": "Male"},
|
||||
"creatures": {"leprechaun": "Male"}, # 2.2.0: the folklore leprechaun is a bearded man
|
||||
}
|
||||
|
||||
#: Gallery-only Archetype lock level, same terms as _GALLERY_GENDER: a period look whose
|
||||
#: ethnicity is part of the look renders at "Full preset" so the sample shows it as
|
||||
#: intended (2.3.0: at "Essentials" the Aztec Noble sample drew a random ethnicity).
|
||||
_GALLERY_LOCK_LEVEL: dict[str, str] = {
|
||||
"Aztec Noble": "Full preset",
|
||||
# 2.4.0: looks named for a people (the Maasai sample drew a German woman).
|
||||
"Maasai": "Full preset", "Tuareg": "Full preset", "Sami Gakti": "Full preset",
|
||||
}
|
||||
|
||||
#: Gallery-only pose pins, same terms as _GALLERY_GENDER: a sample whose defining
|
||||
#: feature only shows in one pose (Black Bolt's underarm wings spread only with the arms
|
||||
#: raised; at his sides they rendered as a cape).
|
||||
_GALLERY_POSE: dict[str, dict[str, str]] = {
|
||||
"cosplay": {"Black Bolt": "stretching both arms overhead"},
|
||||
"cosplay": {"Black Bolt": "stretching both arms overhead",
|
||||
# 2.4.0: seated, the board fused into his shoulder; standing keeps it apart.
|
||||
"Silver Surfer": "standing with feet planted wide",
|
||||
# 2.4.0: seated with two sabers, she drew a third hand.
|
||||
"Ahsoka Tano": "standing with feet planted wide",
|
||||
"Bayonetta": "standing with feet planted wide",
|
||||
# Reclining, the plate pulled apart and bared the body under it.
|
||||
"Praetorian Guard": "standing with feet planted wide",
|
||||
# Seated or kneeling, the drawn swords went to the floor or into one hand.
|
||||
"Kirito": "standing with feet planted wide",
|
||||
# Seated, her hands relaxed and the knuckle claws never drew.
|
||||
"X-23": "standing with feet planted wide",
|
||||
"Roronoa Zoro": "standing with feet planted wide"},
|
||||
# 2.4.0: a hands-in-pockets pose fought her rigid outstretched arms.
|
||||
"creatures": {"jiangshi": "standing with feet planted wide"},
|
||||
}
|
||||
|
||||
#: Gallery-only framing pins, same terms: a sample whose defining feature is below
|
||||
@@ -269,6 +312,10 @@ def read_render_settings(overrides: dict[str, Any] | None = None) -> dict[str, A
|
||||
"denoise": _one(groups, "KSampler", 6, "denoise"),
|
||||
"style_prefix": _style_prefix(groups),
|
||||
"style_delimiter": _style_delimiter(groups),
|
||||
# Optional Krea2T Enhancer (custom node) between the LoRA and the sampler.
|
||||
# 0 = off. At 1.5 creatures stopped rendering as a person in a costume (2.4.0).
|
||||
"enhancer_text_scale": 0,
|
||||
"enhancer_strength": 1.0,
|
||||
}
|
||||
|
||||
if LOCAL_CONFIG.is_file():
|
||||
@@ -339,6 +386,8 @@ def entries_for(kind: str) -> dict[str, dict]:
|
||||
from data.creatures import CREATURES
|
||||
|
||||
return CREATURES
|
||||
if kind == "people":
|
||||
return PEOPLE
|
||||
raise RenderError(f"Unknown kind: {kind!r}")
|
||||
|
||||
|
||||
@@ -367,12 +416,12 @@ def entry_hash(kind: str, name: str, reroll: int = 0) -> str:
|
||||
return hashlib.sha256(payload.encode("utf-8")).hexdigest()[:16]
|
||||
|
||||
|
||||
def record_reroll(name: str, record: dict) -> int:
|
||||
def record_reroll(kind: str, name: str, record: dict) -> int:
|
||||
"""The ``--reroll`` a manifest record was rendered with (0 when it has no seed)."""
|
||||
return record.get("seed", entry_seed(name)) - entry_seed(name)
|
||||
return record.get("seed", entry_seed(kind, name)) - entry_seed(kind, name)
|
||||
|
||||
|
||||
def entry_seed(name: str, reroll: int = 0) -> int:
|
||||
def entry_seed(kind: str, name: str, reroll: int = 0) -> int:
|
||||
"""Deterministic per entry, so the same entry always re-renders the same person.
|
||||
|
||||
``reroll`` re-draws a single bad tile without touching the data. The seed
|
||||
@@ -381,7 +430,11 @@ def entry_seed(name: str, reroll: int = 0) -> int:
|
||||
in profile against a window shows neither the mask nor the face. A non-zero
|
||||
reroll is recorded in the manifest as an explicit ``seed``, because a tile
|
||||
nobody can reproduce is worse than a tile nobody likes.
|
||||
|
||||
A people sample's seed is its own fixed one, shown on its card.
|
||||
"""
|
||||
if kind == "people":
|
||||
return PEOPLE[name]["seed"] + reroll
|
||||
return int(hashlib.sha256(name.encode("utf-8")).hexdigest()[:15], 16) + reroll
|
||||
|
||||
|
||||
@@ -439,7 +492,7 @@ def survey(kinds: tuple[str, ...] = KINDS) -> dict[str, dict[str, list[str]]]:
|
||||
record = recorded.get(name)
|
||||
if record is None:
|
||||
missing.append(name)
|
||||
elif record.get("hash") != entry_hash(kind, name, record_reroll(name, record)):
|
||||
elif record.get("hash") != entry_hash(kind, name, record_reroll(kind, name, record)):
|
||||
stale.append(name)
|
||||
# 1.10.0: rendered but never pushed to gh-pages, which --check used to
|
||||
# pass. A record without the key predates it: published.
|
||||
@@ -537,7 +590,14 @@ def resolve_prose(kind: str, name: str, reroll: int = 0) -> str:
|
||||
from nodes.identity_forge_cosplayer import IdentityForgeCosplayer
|
||||
from nodes.identity_forge_creature import IdentityForgeCreature
|
||||
|
||||
seed = entry_seed(name, reroll)
|
||||
seed = entry_seed(kind, name, reroll)
|
||||
if kind == "people":
|
||||
widgets = PEOPLE[name]["widgets"]
|
||||
_check_options(IdentityForge, widgets)
|
||||
forge_kwargs = {spec.id: spec.default for spec in IdentityForge.define_schema().inputs
|
||||
if hasattr(spec, "default")}
|
||||
forge_kwargs.update(seed=seed, archetype_json="", **widgets)
|
||||
return _forged_prose(IdentityForge, forge_kwargs, kind, name)
|
||||
if kind == "cosplay":
|
||||
_check_options(IdentityForgeCosplayer, COSPLAYER_WIDGETS)
|
||||
preset = IdentityForgeCosplayer.execute(
|
||||
@@ -546,7 +606,8 @@ def resolve_prose(kind: str, name: str, reroll: int = 0) -> str:
|
||||
elif kind == "archetypes":
|
||||
_check_options(IdentityForgeArchetype, ARCHETYPE_WIDGETS)
|
||||
preset = IdentityForgeArchetype.execute(
|
||||
archetype=name, seed=seed, upstream="", **ARCHETYPE_WIDGETS
|
||||
archetype=name, seed=seed, upstream="",
|
||||
**{**ARCHETYPE_WIDGETS, "lock_level": _GALLERY_LOCK_LEVEL.get(name, "Essentials")},
|
||||
)
|
||||
elif kind == "creatures":
|
||||
_check_options(IdentityForgeCreature, CREATURE_WIDGETS)
|
||||
@@ -565,13 +626,30 @@ def resolve_prose(kind: str, name: str, reroll: int = 0) -> str:
|
||||
forge_kwargs["gender"] = _GALLERY_GENDER[kind][name]
|
||||
if name in _GALLERY_POSE.get(kind, {}):
|
||||
forge_kwargs["pose"] = _GALLERY_POSE[kind][name]
|
||||
forged = IdentityForge.execute(**forge_kwargs)
|
||||
prose = _unwrap(forged)[0]
|
||||
return _forged_prose(IdentityForge, forge_kwargs, kind, name)
|
||||
|
||||
|
||||
def _forged_prose(forge_class: Any, forge_kwargs: dict[str, Any], kind: str, name: str) -> str:
|
||||
prose = _unwrap(forge_class.execute(**forge_kwargs))[0]
|
||||
if not isinstance(prose, str) or not prose.strip():
|
||||
raise RenderError(f"{kind}/{name}: the engine produced no prose")
|
||||
return prose
|
||||
|
||||
|
||||
def people_card(name: str) -> dict[str, Any]:
|
||||
"""A people sample's card: its seed, the widgets it pins, and its full prompt.
|
||||
|
||||
Read by ``gallery/people/build_manifest.py``. Honours a recorded ``--reroll``, so
|
||||
the card always names the seed its image was rendered with.
|
||||
"""
|
||||
record = load_manifest()["entries"].get("people", {}).get(name, {})
|
||||
reroll = record_reroll("people", name, record)
|
||||
seed = entry_seed("people", name, reroll)
|
||||
pins = ", ".join(f"{key} {value}" for key, value in PEOPLE[name]["widgets"].items())
|
||||
return {"seed": seed, "settings": f"seed {seed}, {pins}",
|
||||
"prompt": resolve_prose("people", name, reroll)}
|
||||
|
||||
|
||||
def positive_prompt(prose: str, settings: dict[str, Any]) -> str:
|
||||
"""Style prefix first: a trailing noun-phrase style gets drawn as scene content."""
|
||||
return f"{settings['style_prefix']}{settings['style_delimiter']}{prose}"
|
||||
@@ -581,6 +659,9 @@ def positive_prompt(prose: str, settings: dict[str, Any]) -> str:
|
||||
# The API graph - no Identity Forge nodes, the text is already resolved
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
ENHANCER_NODE = "Krea2T-Enhancer-Advanced"
|
||||
|
||||
|
||||
def build_graph(positive: str, seed: int, settings: dict[str, Any],
|
||||
save_originals: bool, filename_stem: str) -> dict:
|
||||
graph = {
|
||||
@@ -618,6 +699,13 @@ def build_graph(positive: str, seed: int, settings: dict[str, Any],
|
||||
"9": {"class_type": "VAEDecode",
|
||||
"inputs": {"samples": ["8", 0], "vae": ["3", 0]}},
|
||||
}
|
||||
if settings.get("enhancer_text_scale"):
|
||||
graph["11"] = {"class_type": ENHANCER_NODE,
|
||||
"inputs": {"model": ["4", 0], "enabled": True,
|
||||
"strength": settings["enhancer_strength"],
|
||||
"text_scale": settings["enhancer_text_scale"],
|
||||
"debug": False}}
|
||||
graph["8"]["inputs"]["model"] = ["11", 0]
|
||||
if save_originals:
|
||||
# SaveImage numbers from the highest existing counter, so it adds files
|
||||
# and never replaces one already in the output folder.
|
||||
@@ -738,6 +826,14 @@ def preflight(client: ComfyClient, settings: dict[str, Any]) -> bool:
|
||||
print(f" available: {available[:12]}"
|
||||
f"{' ...' if len(available) > 12 else ''}")
|
||||
ok = False
|
||||
if settings.get("enhancer_text_scale"):
|
||||
try:
|
||||
found = bool(client._get_json(f"/object_info/{ENHANCER_NODE}"))
|
||||
except (OSError, ValueError):
|
||||
found = False
|
||||
if not found:
|
||||
print(f" {ENHANCER_NODE} is not installed there (enhancer_text_scale is set).")
|
||||
ok = False
|
||||
return ok
|
||||
|
||||
|
||||
@@ -767,7 +863,7 @@ def render_one(client: ComfyClient, kind: str, name: str, settings: dict[str, An
|
||||
stem = normalize_name(name)
|
||||
prose = resolve_prose(kind, name, reroll)
|
||||
graph = build_graph(
|
||||
positive_prompt(prose, settings), entry_seed(name, reroll), settings,
|
||||
positive_prompt(prose, settings), entry_seed(kind, name, reroll), settings,
|
||||
save_originals, stem,
|
||||
)
|
||||
prompt_id = client.submit(graph, front=front)
|
||||
@@ -984,6 +1080,10 @@ def main(argv: list[str] | None = None) -> int:
|
||||
if not pending:
|
||||
print("Nothing unpublished.")
|
||||
return 0
|
||||
if args.dry_run:
|
||||
for kind, names in sorted(pending.items()):
|
||||
print(f" {kind}: would publish {', '.join(names)}")
|
||||
return 0
|
||||
for kind, names in sorted(pending.items()):
|
||||
if not publish_kind(kind, names):
|
||||
return 1
|
||||
@@ -1003,7 +1103,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
record = recorded.get(name)
|
||||
if record is None:
|
||||
continue
|
||||
fresh = entry_hash(kind, name, record_reroll(name, record))
|
||||
fresh = entry_hash(kind, name, record_reroll(kind, name, record))
|
||||
if record.get("hash") != fresh:
|
||||
record["hash"] = fresh
|
||||
moved += 1
|
||||
@@ -1048,12 +1148,12 @@ def main(argv: list[str] | None = None) -> int:
|
||||
if args.dry_run:
|
||||
for kind, name in targets:
|
||||
prose = resolve_prose(kind, name, args.reroll)
|
||||
print(f"\n=== {kind} / {name} (seed {entry_seed(name, args.reroll)}) ===")
|
||||
print(f"\n=== {kind} / {name} (seed {entry_seed(kind, name, args.reroll)}) ===")
|
||||
print(positive_prompt(prose, settings))
|
||||
print(f"\n--- graph for {targets[0][1]} ---")
|
||||
print(json.dumps(
|
||||
build_graph(positive_prompt(resolve_prose(*targets[0], args.reroll), settings),
|
||||
entry_seed(targets[0][1], args.reroll), settings,
|
||||
entry_seed(*targets[0], args.reroll), settings,
|
||||
args.save_originals, targets[0][1]),
|
||||
indent=2,
|
||||
))
|
||||
@@ -1072,6 +1172,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
print(f" {settings['unet_name']} + {settings['lora_name']}, "
|
||||
f"{settings['steps']} steps, {settings['sampler_name']}/"
|
||||
f"{settings['scheduler']}, {settings['width']}x{settings['height']}")
|
||||
if settings.get("enhancer_text_scale"):
|
||||
print(f" {ENHANCER_NODE}, text_scale {settings['enhancer_text_scale']}")
|
||||
if args.save_originals:
|
||||
print(f" originals kept on the instance under {ORIGINALS_PREFIX}/")
|
||||
|
||||
@@ -1082,7 +1184,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
manifest["render"] = {
|
||||
key: settings[key] for key in
|
||||
("unet_name", "lora_name", "steps", "cfg", "sampler_name",
|
||||
"scheduler", "width", "height")
|
||||
"scheduler", "width", "height", "enhancer_text_scale")
|
||||
}
|
||||
today = _datetime.date.today().isoformat()
|
||||
done = failed = 0
|
||||
@@ -1095,7 +1197,12 @@ def main(argv: list[str] | None = None) -> int:
|
||||
record = {"hash": entry_hash(kind, name, args.reroll), "rendered": today,
|
||||
"published": False}
|
||||
if args.reroll:
|
||||
record["seed"] = entry_seed(name, args.reroll)
|
||||
record["seed"] = entry_seed(kind, name, args.reroll)
|
||||
# Reload first: another run may have saved since this one started, and
|
||||
# writing back a stale copy would drop its records (2.4.0).
|
||||
fresh = load_manifest()
|
||||
fresh["render"] = manifest["render"]
|
||||
manifest = fresh
|
||||
manifest["entries"].setdefault(kind, {})[name] = record
|
||||
touched.setdefault(kind, []).append(name)
|
||||
done += 1
|
||||
|
||||
+1662
-1651
File diff suppressed because it is too large
Load Diff
@@ -1610,6 +1610,10 @@
|
||||
"the Great Wall of China ramparts",
|
||||
"the Machu Picchu terraces",
|
||||
"the Victoria Falls gorge rim",
|
||||
"wrestling ring under arena lights",
|
||||
"outdoor tennis court with a net",
|
||||
"racetrack pit lane",
|
||||
"racecourse paddock with a white rail",
|
||||
"None"
|
||||
]
|
||||
},
|
||||
@@ -2209,6 +2213,7 @@
|
||||
"Astronaut",
|
||||
"Astronomer",
|
||||
"Athlete",
|
||||
"Aztec Noble",
|
||||
"B-Boy / B-Girl",
|
||||
"Babushka",
|
||||
"Backyard Country Casual",
|
||||
@@ -2545,6 +2550,7 @@
|
||||
"Aleta Ogord",
|
||||
"Alice",
|
||||
"Alice Nakiri",
|
||||
"Alisa Bosconovitch",
|
||||
"Alita",
|
||||
"All Might",
|
||||
"Allen the Alien",
|
||||
@@ -2678,6 +2684,7 @@
|
||||
"Beast (X-Men)",
|
||||
"Beast Boy",
|
||||
"Beast Man",
|
||||
"Beatrix (Final Fantasy)",
|
||||
"Beerus",
|
||||
"Beetlejuice",
|
||||
"Bellatrix Lestrange",
|
||||
@@ -2816,8 +2823,10 @@
|
||||
"Catwoman",
|
||||
"Cecil Harvey",
|
||||
"Celes Chere",
|
||||
"Celestia Ludenberg",
|
||||
"Cell",
|
||||
"Celty Sturluson",
|
||||
"Cerebella",
|
||||
"Cersei Lannister",
|
||||
"Cervantes de Leon",
|
||||
"Cetrion",
|
||||
@@ -2843,6 +2852,7 @@
|
||||
"Chiaki Nanami",
|
||||
"Chiana",
|
||||
"Chief Chirpa",
|
||||
"Chisato Nishikigi",
|
||||
"Chizuru Mizuhara",
|
||||
"Chocobo",
|
||||
"Chopper",
|
||||
@@ -2855,6 +2865,7 @@
|
||||
"Ciel Phantomhive",
|
||||
"Cinder",
|
||||
"Cinderella",
|
||||
"Cindy Aurum",
|
||||
"Circe",
|
||||
"Ciri",
|
||||
"Claire Redfield",
|
||||
@@ -3010,6 +3021,7 @@
|
||||
"Dupli-Kate",
|
||||
"Duros",
|
||||
"E. Honda",
|
||||
"EVA (Metal Gear)",
|
||||
"EVE (Stellar Blade)",
|
||||
"Eda Clawthorne",
|
||||
"Edelgard",
|
||||
@@ -3068,6 +3080,7 @@
|
||||
"Etrigan the Demon",
|
||||
"Eureka",
|
||||
"Evelynn",
|
||||
"Evie Frye",
|
||||
"Evil Queen",
|
||||
"Evil-Lyn",
|
||||
"Eyedol",
|
||||
@@ -3217,6 +3230,7 @@
|
||||
"Guy Gardner",
|
||||
"Gwen (League of Legends)",
|
||||
"Gwen Tennyson",
|
||||
"Gwenpool",
|
||||
"Gyarados",
|
||||
"Gypsy",
|
||||
"Hades",
|
||||
@@ -3241,6 +3255,7 @@
|
||||
"Hawks",
|
||||
"Hayate",
|
||||
"He-Man",
|
||||
"Heather Mason",
|
||||
"Heavy (Team Fortress 2)",
|
||||
"Hector Barbossa",
|
||||
"Hector Rivera",
|
||||
@@ -3268,6 +3283,7 @@
|
||||
"Hit-Girl",
|
||||
"Hitagi Senjougahara",
|
||||
"Hitomi",
|
||||
"Hitori Gotoh",
|
||||
"Hoggish Greedly",
|
||||
"Holli Would",
|
||||
"Holo",
|
||||
@@ -3310,6 +3326,7 @@
|
||||
"Ino Yamanaka",
|
||||
"Inosuke Hashibira",
|
||||
"Inspector Gadget",
|
||||
"Integra Hellsing",
|
||||
"Inuyasha",
|
||||
"Invincible",
|
||||
"Invisible Woman",
|
||||
@@ -3404,6 +3421,7 @@
|
||||
"Jubilee",
|
||||
"Judge Anderson",
|
||||
"Judge Dredd",
|
||||
"Judith (Tales)",
|
||||
"Judy Alvarez",
|
||||
"Judy Hopps",
|
||||
"Judy Jetson",
|
||||
@@ -3420,6 +3438,7 @@
|
||||
"Jyn Erso",
|
||||
"K'",
|
||||
"K-2SO",
|
||||
"KOS-MOS",
|
||||
"Ka D'Argo",
|
||||
"Kabal",
|
||||
"Kabuki",
|
||||
@@ -3509,6 +3528,7 @@
|
||||
"Krusty the Clown",
|
||||
"Krystalin",
|
||||
"Kuiil",
|
||||
"Kula Diamond",
|
||||
"Kung Lao",
|
||||
"Kurapika",
|
||||
"Kuromi",
|
||||
@@ -3625,6 +3645,7 @@
|
||||
"Lumine",
|
||||
"Luna (Sailor Moon)",
|
||||
"Luna Lovegood",
|
||||
"Lunafreya Nox Fleuret",
|
||||
"Lune",
|
||||
"Lurch",
|
||||
"Lust",
|
||||
@@ -3759,6 +3780,7 @@
|
||||
"Miles Morales",
|
||||
"Milim Nava",
|
||||
"Millia Rage",
|
||||
"Mina Ashido",
|
||||
"Minato Namikaze",
|
||||
"Minerva McGonagall",
|
||||
"Ming the Merciless",
|
||||
@@ -3770,6 +3792,7 @@
|
||||
"Mirabel Madrigal",
|
||||
"Mirajane Strauss",
|
||||
"Miranda Lawson",
|
||||
"Miriam (Bloodstained)",
|
||||
"Mirko",
|
||||
"Misa Amane",
|
||||
"Misaka Mikoto",
|
||||
@@ -3938,6 +3961,7 @@
|
||||
"Panty Anarchy",
|
||||
"Papa Smurf",
|
||||
"Papyrus",
|
||||
"Parasoul",
|
||||
"Patrick Star",
|
||||
"Paul Atreides",
|
||||
"Paul Bunyan",
|
||||
@@ -3950,6 +3974,7 @@
|
||||
"Peggy Carter",
|
||||
"Pennywise",
|
||||
"Peridot",
|
||||
"Perona",
|
||||
"Peter Griffin",
|
||||
"Peter Pan",
|
||||
"Phantom Lady (Dee Tyler)",
|
||||
@@ -4089,6 +4114,7 @@
|
||||
"Rikuo",
|
||||
"Rin Tohsaka",
|
||||
"Rindou Kobayashi",
|
||||
"Rinoa Heartilly",
|
||||
"Riptide",
|
||||
"River Tam",
|
||||
"Rivet",
|
||||
@@ -4213,6 +4239,7 @@
|
||||
"Seong Mi-na",
|
||||
"Sephiroth",
|
||||
"Seraphine",
|
||||
"Seras Victoria",
|
||||
"Serena",
|
||||
"Sersi",
|
||||
"Serval (Kemono Friends)",
|
||||
@@ -4234,6 +4261,7 @@
|
||||
"She-Hulk",
|
||||
"She-Ra",
|
||||
"Sheena",
|
||||
"Sheena Fujibayashi",
|
||||
"Sheeva",
|
||||
"Shego",
|
||||
"Sheik",
|
||||
@@ -4406,6 +4434,7 @@
|
||||
"The 50 Foot Woman",
|
||||
"The Atom",
|
||||
"The BFG",
|
||||
"The Boss",
|
||||
"The Bride (Beatrix Kiddo)",
|
||||
"The Cat in the Hat",
|
||||
"The Comedian",
|
||||
@@ -4464,6 +4493,7 @@
|
||||
"Tina Belcher",
|
||||
"Tinker Bell",
|
||||
"Tiny Tina",
|
||||
"Tira",
|
||||
"Titania",
|
||||
"Toad",
|
||||
"Tohka Yatogami",
|
||||
@@ -4528,6 +4558,7 @@
|
||||
"Vegeta",
|
||||
"Velma Dinkley",
|
||||
"Velocity",
|
||||
"Velvet Crowe",
|
||||
"Venom",
|
||||
"Venti",
|
||||
"Venus (Marvel)",
|
||||
@@ -4599,6 +4630,7 @@
|
||||
"Xena",
|
||||
"Xenomorph",
|
||||
"Xianghua",
|
||||
"Y'shtola Rhul",
|
||||
"Yae Miko",
|
||||
"Yamada Asaemon Sagiri",
|
||||
"Yamato (One Piece)",
|
||||
@@ -4728,6 +4760,7 @@
|
||||
"Franchise: TMNT",
|
||||
"Franchise: Tekken",
|
||||
"Franchise: The Boys",
|
||||
"Franchise: The King of Fighters",
|
||||
"Franchise: The Legend of Zelda",
|
||||
"Franchise: The Lord of the Rings",
|
||||
"Franchise: The Sandman",
|
||||
@@ -7472,6 +7505,131 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"IdentityForgeOutfitSheet": [
|
||||
{
|
||||
"name": "sheet",
|
||||
"default": "Range (6)",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Range (6)",
|
||||
"Everyday (4)",
|
||||
"Work to evening (4)",
|
||||
"Every style (15)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "backdrop",
|
||||
"default": "Grey studio backdrop",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Grey studio backdrop",
|
||||
"White studio backdrop",
|
||||
"Black studio backdrop",
|
||||
"Keep the character's scene"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "framing",
|
||||
"default": "Full body",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Full body",
|
||||
"Cowboy (mid-thigh up)",
|
||||
"Waist up",
|
||||
"Chest up",
|
||||
"Head and shoulders",
|
||||
"Unspecified"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pose",
|
||||
"default": "standing with arms relaxed at the sides",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"standing with arms relaxed at the sides",
|
||||
"standing naturally",
|
||||
"standing tall with shoulders back",
|
||||
"standing with feet planted wide",
|
||||
"Keep the character's pose"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "outfit_seed",
|
||||
"default": 0,
|
||||
"type": "INT"
|
||||
},
|
||||
{
|
||||
"name": "control_after_generate",
|
||||
"type": "combo",
|
||||
"default": "randomize",
|
||||
"options": [
|
||||
"fixed",
|
||||
"increment",
|
||||
"decrement",
|
||||
"randomize"
|
||||
]
|
||||
}
|
||||
],
|
||||
"IdentityForgeSceneSheet": [
|
||||
{
|
||||
"name": "sheet",
|
||||
"default": "Everyday (6)",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Everyday (6)",
|
||||
"Indoors (4)",
|
||||
"Outdoors (4)",
|
||||
"Studio backdrops (3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "framing",
|
||||
"default": "Cowboy (mid-thigh up)",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Full body",
|
||||
"Cowboy (mid-thigh up)",
|
||||
"Waist up",
|
||||
"Chest up",
|
||||
"Head and shoulders",
|
||||
"Unspecified"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "clothes",
|
||||
"default": "Dress for each place",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Dress for each place",
|
||||
"Keep the outfit (skip places that refuse it)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"IdentityForgeAgeProgression": [
|
||||
{
|
||||
"name": "stages",
|
||||
"default": "Life stages (4)",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Life stages (4)",
|
||||
"Decades (6)",
|
||||
"Young and old (2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "framing",
|
||||
"default": "Head and shoulders",
|
||||
"type": "combo",
|
||||
"options": [
|
||||
"Full body",
|
||||
"Cowboy (mid-thigh up)",
|
||||
"Waist up",
|
||||
"Chest up",
|
||||
"Head and shoulders",
|
||||
"Unspecified"
|
||||
]
|
||||
}
|
||||
],
|
||||
"IdentityForgeVaultLoad": [
|
||||
{
|
||||
"name": "character",
|
||||
@@ -7480,6 +7638,22 @@
|
||||
"options": [
|
||||
"(no characters saved)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seed",
|
||||
"default": 0,
|
||||
"type": "INT"
|
||||
},
|
||||
{
|
||||
"name": "control_after_generate",
|
||||
"type": "combo",
|
||||
"default": "randomize",
|
||||
"options": [
|
||||
"fixed",
|
||||
"increment",
|
||||
"decrement",
|
||||
"randomize"
|
||||
]
|
||||
}
|
||||
],
|
||||
"IdentityForgeVaultSave": [
|
||||
|
||||
+225
-14
@@ -48,7 +48,7 @@ function rosterOkHandler(url) {
|
||||
if (url.endsWith("identity_forge_roster.json")) {
|
||||
return { ok: true, json: async () => REAL_ROSTER };
|
||||
}
|
||||
if (url.includes("github.io")) {
|
||||
if (url.includes("/identity_forge/gallery/")) {
|
||||
return { ok: true, json: async () => ({ entries: [] }) };
|
||||
}
|
||||
return { ok: false, status: 404 };
|
||||
@@ -281,30 +281,207 @@ test("the gender filter keeps that gender plus entries that suit either", async
|
||||
}
|
||||
});
|
||||
|
||||
test("the franchise filter lists roster franchises by category and keeps only that franchise", async () => {
|
||||
test("starring a card keeps it under Starred only, persists, and never picks it (2.6.0)", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
window.localStorage.removeItem("identity_forge.picker.starred");
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
try {
|
||||
const picker = await openPicker();
|
||||
const widget = picker.config.node.widgets.find((w) => w.name === picker.config.targetWidgetName);
|
||||
const before = widget.value;
|
||||
const tile = picker.grid.children[1];
|
||||
const name = tile.dataset.ifName;
|
||||
tile.querySelector(".if-picker-star").click();
|
||||
assert.equal(widget.value, before, "the star click must not select the entry");
|
||||
assert.equal(tile.querySelector(".if-picker-star").getAttribute("aria-pressed"), "true");
|
||||
assert.deepEqual(JSON.parse(window.localStorage.getItem("identity_forge.picker.starred")),
|
||||
[picker.config.kind + ":" + name]);
|
||||
|
||||
picker.starredCheckbox.click();
|
||||
assert.deepEqual(picker.visible.map((e) => e.name), [name]);
|
||||
assert.ok(picker.isFiltering());
|
||||
|
||||
// A fresh session reads the stars back from storage.
|
||||
__testing.__resetForTests();
|
||||
picker.close();
|
||||
const again = await openPicker();
|
||||
again.starredOnly = true;
|
||||
again.renderGrid();
|
||||
assert.deepEqual(again.visible.map((e) => e.name), [name]);
|
||||
again.grid.children[0].querySelector(".if-picker-star").click(); // unstar
|
||||
assert.equal(again.visible.length, 0);
|
||||
assert.match(again.grid.textContent, /Nothing starred yet/);
|
||||
again.close();
|
||||
} finally {
|
||||
window.localStorage.removeItem("identity_forge.picker.starred");
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("the franchise box suggests every franchise, keeps an exact name only, and part of a name broadly", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
try {
|
||||
const picker = await openPicker();
|
||||
const select = picker.franchiseSelect;
|
||||
assert.ok(select.querySelectorAll("optgroup").length > 1, "options are grouped by category");
|
||||
const franchise = REAL_ROSTER.find((e) => e.franchise).franchise;
|
||||
assert.ok([...select.options].some((o) => o.value === franchise));
|
||||
select.value = franchise;
|
||||
select.dispatchEvent(new window.Event("change"));
|
||||
const franchises = new Set(REAL_ROSTER.filter((e) => e.franchise).map((e) => e.franchise));
|
||||
assert.equal(picker.franchiseList.options.length, franchises.size, "one suggestion per franchise");
|
||||
assert.ok(picker.franchiseList.options[0].label, "suggestions carry their category");
|
||||
|
||||
const input = picker.franchiseInput;
|
||||
input.value = "star wars";
|
||||
input.dispatchEvent(new window.Event("input"));
|
||||
picker.renderGrid();
|
||||
assert.ok(picker.visible.length > 0);
|
||||
assert.ok(picker.visible.every((e) => e.franchise === franchise));
|
||||
assert.ok(picker.visible.every((e) => e.franchise === "Star Wars"), "an exact name (any case) keeps that franchise only");
|
||||
|
||||
picker.franchise = "star";
|
||||
picker.renderGrid();
|
||||
const hit = new Set(picker.visible.map((e) => e.franchise));
|
||||
assert.ok(hit.has("Star Wars") && hit.has("Star Trek"), "part of a name keeps every franchise containing it");
|
||||
|
||||
picker.close();
|
||||
picker.open();
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
assert.equal(picker.franchiseSelect.value, franchise, "the choice survives a reopen");
|
||||
await flush();
|
||||
assert.equal(picker.franchiseInput.value, "star", "the text survives a reopen");
|
||||
picker.close();
|
||||
} finally {
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("archetype and creature pickers hide the cosplayer-only filters", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
try {
|
||||
for (const [kind, widget, gender] of [["archetype", "archetype", true], ["creature", "creature", false]]) {
|
||||
const picker = await openPicker(kind, widget);
|
||||
const header = picker.overlay.querySelector(".if-picker-header");
|
||||
assert.ok(!header.contains(picker.franchiseInput), kind + ": no franchise box");
|
||||
assert.ok(!header.contains(picker.facetSelect), kind + ": no trait facet");
|
||||
assert.equal(header.contains(picker.genderSelect), gender, kind + ": gender only where entries have one");
|
||||
picker.close();
|
||||
}
|
||||
const cos = await openPicker();
|
||||
const header = cos.overlay.querySelector(".if-picker-header");
|
||||
assert.ok(header.contains(cos.franchiseInput) && header.contains(cos.facetSelect) && header.contains(cos.genderSelect));
|
||||
cos.close();
|
||||
} finally {
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("search matches from a word's start, quoted phrases, and the SEARCH_ALSO synonyms", () => {
|
||||
const find = (q) => REAL_ROSTER.filter((e) => __testing.matchesQuery(e, __testing.tokenize(q)));
|
||||
const elbowOnly = (e) => /elbow|rainbow/.test(e.haystack) && !/(^|[^a-z0-9])bow/.test(e.haystack)
|
||||
&& !e.name.toLowerCase().includes("bow");
|
||||
assert.ok(REAL_ROSTER.some(elbowOnly), "sanity: some entries mention bow only inside elbow/rainbow");
|
||||
assert.ok(!find("bow").some(elbowOnly), '"bow" must not match inside "elbow" or "rainbow"');
|
||||
assert.ok(find("man").some((e) => e.name === "Batman"), "a name still matches anywhere");
|
||||
assert.deepEqual(__testing.tokenize('red "bow tie"'), ["red", "bow tie"]);
|
||||
for (const q of ["dia de los", "día", "DÍA"]) {
|
||||
assert.ok(find(q).some((e) => e.name === "Día de los Muertos"), `"${q}" finds Día de los Muertos`);
|
||||
}
|
||||
assert.equal(__testing.tokenize("Øyvind Straße")[1], "strasse");
|
||||
assert.ok(find('"bow tie"').length > 0 && find('"bow tie"').length < find("bow").length);
|
||||
const trousersOnly = REAL_ROSTER.filter((e) => /(^|[^a-z0-9])trousers/.test(e.haystack) && !/pants/.test(e.haystack));
|
||||
assert.ok(trousersOnly.length > 0, "sanity");
|
||||
const pants = new Set(find("pants"));
|
||||
assert.ok(trousersOnly.every((e) => pants.has(e)), '"pants" finds trousers');
|
||||
assert.ok(find("suit").some((e) => /bodysuit/.test(e.haystack) && !/(^|[^a-z0-9])suit/.test(e.haystack)),
|
||||
'"suit" finds bodysuits');
|
||||
});
|
||||
|
||||
test("a plural query also finds the lone singular, and only as a whole word (2.8.0)", () => {
|
||||
const find = (q) => REAL_ROSTER.filter((e) => __testing.matchesQuery(e, __testing.tokenize(q)));
|
||||
const lone = (word) => (e) => new RegExp("(^|[^a-z0-9])" + word + "([^a-z0-9]|$)").test(e.haystack);
|
||||
const bootOnly = REAL_ROSTER.filter((e) => lone("boot")(e) && !/boots/.test(e.haystack));
|
||||
assert.ok(bootOnly.length > 0, "sanity: some entries say boot, never boots");
|
||||
assert.ok(bootOnly.every((e) => find("boots").includes(e)), '"boots" finds a lone "boot"');
|
||||
const pantherOnly = (e) => /panther/.test(e.haystack) && !/pant/.test(e.haystack.replace(/panther/g, ""))
|
||||
&& !/trousers|slacks|jeans|sweatpants|breeches/.test(e.haystack) && !e.name.toLowerCase().includes("pants");
|
||||
assert.ok(!find("pants").some(pantherOnly), '"pants" must not reach "panther"');
|
||||
assert.ok(!find("glasses").some((e) => lone("glass")(e) && !/glasses|sunglasses|spectacles|eyeglasses/.test(e.haystack)
|
||||
&& !e.name.toLowerCase().includes("glasses")), '"glasses" must not find "glass"');
|
||||
});
|
||||
|
||||
test("reopening lands on the node's current pick, marked, instead of the top of the list", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
try {
|
||||
const picker = await openPicker();
|
||||
const target = picker.visible[40];
|
||||
picker.select(target);
|
||||
picker.open();
|
||||
await flush();
|
||||
assert.equal(picker.visible[picker.focusIndex].name, target.name);
|
||||
const tile = picker.grid.children[picker.focusIndex];
|
||||
assert.ok(tile.classList.contains("current") && tile.classList.contains("focused"));
|
||||
picker.close();
|
||||
} finally {
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("Queue each queues one run per matching entry, then restores the pick", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
const seen = [];
|
||||
try {
|
||||
const picker = await openPicker();
|
||||
assert.equal(picker.queueAllButton.style.display, "none", "hidden with no filter: never the whole roster");
|
||||
const widget = picker.config.node.widgets.find((w) => w.name === "character");
|
||||
widget.value = "None";
|
||||
app.queuePrompt = async () => { seen.push(widget.value); return true; };
|
||||
picker.franchise = "Star Wars";
|
||||
picker.tabs.querySelector('[data-tab="__all__"]').click(); // mixed kinds: only cosplayers queue
|
||||
const expected = picker.visible.filter((e) => e.kind === "cosplayer").map((e) => e.name);
|
||||
assert.ok(expected.length > 1);
|
||||
assert.equal(picker.queueAllButton.textContent, "Queue each (" + expected.length + ")");
|
||||
await picker.queueEach();
|
||||
assert.deepEqual(seen, expected);
|
||||
assert.equal(widget.value, "None", "the original pick is put back");
|
||||
picker.close();
|
||||
} finally {
|
||||
delete app.queuePrompt;
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("Queue random queues one matching entry without asking, then restores the pick (2.8.0)", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
const seen = [];
|
||||
const originalConfirm = globalThis.confirm;
|
||||
globalThis.confirm = () => { throw new Error("Queue random must not ask"); };
|
||||
try {
|
||||
const picker = await openPicker();
|
||||
assert.equal(picker.queueRandomButton.style.display, "none", "hidden with no filter");
|
||||
const widget = picker.config.node.widgets.find((w) => w.name === "character");
|
||||
widget.value = "None";
|
||||
app.queuePrompt = async () => { seen.push(widget.value); return true; };
|
||||
picker.franchise = "Star Wars";
|
||||
picker.renderGrid();
|
||||
assert.equal(picker.queueRandomButton.style.display, "");
|
||||
const names = picker.queueableEntries().map((e) => e.name);
|
||||
picker.queueRandomButton.click();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
assert.equal(seen.length, 1);
|
||||
assert.ok(names.includes(seen[0]), "the pick comes from the filtered set");
|
||||
assert.equal(widget.value, "None", "the original pick is put back");
|
||||
picker.close();
|
||||
} finally {
|
||||
globalThis.confirm = originalConfirm;
|
||||
delete app.queuePrompt;
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("while filtering, every tab shows its own match count so other kinds stay discoverable", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
@@ -515,7 +692,7 @@ test("thumbnails stay off (no gallery fetch) until the preview toggle is enabled
|
||||
picker.open();
|
||||
await flush();
|
||||
assert.ok(
|
||||
!stub.calls.some((u) => u.includes("github.io")),
|
||||
!stub.calls.some((u) => u.includes("/identity_forge/gallery/") || u.includes("github.io")),
|
||||
"no gallery manifest request must happen before the toggle is enabled",
|
||||
);
|
||||
|
||||
@@ -523,8 +700,42 @@ test("thumbnails stay off (no gallery fetch) until the preview toggle is enabled
|
||||
picker.previewCheckbox.dispatchEvent(new window.Event("change"));
|
||||
await flush();
|
||||
assert.ok(
|
||||
stub.calls.some((u) => u.includes("github.io") && u.includes("manifest.json")),
|
||||
"enabling the toggle must fetch the live gh-pages manifest for the visible kind(s)",
|
||||
stub.calls.some((u) => u.startsWith("/identity_forge/gallery/") && u.includes("manifest.json")),
|
||||
"enabling the toggle must fetch the manifest for the visible kind(s) through the server's cache",
|
||||
);
|
||||
// 2.3.0: --offline's CSP allows only ComfyUI's own origin, so nothing may go to GitHub.
|
||||
assert.ok(
|
||||
!stub.calls.some((u) => u.includes("github.io")),
|
||||
"the browser must never fetch the gallery from GitHub directly",
|
||||
);
|
||||
picker.close();
|
||||
} finally {
|
||||
stub.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("preview images load from the server's cache route, path segments encoded", async () => {
|
||||
resetDom();
|
||||
__testing.__resetForTests();
|
||||
const stub = installFetchStub(rosterOkHandler);
|
||||
try {
|
||||
const node = makeFakeNode("IdentityForgeCosplayer");
|
||||
const picker = new __testing.IdentityForgePicker({
|
||||
kind: "cosplayer",
|
||||
targetWidgetName: "character",
|
||||
title: "test",
|
||||
node,
|
||||
});
|
||||
picker.open();
|
||||
await flush();
|
||||
const art = picker.grid.querySelector('[data-if-kind="cosplayer"] .if-picker-art');
|
||||
assert.ok(art, "a cosplayer card must be on screen");
|
||||
const name = art.getAttribute("data-if-name");
|
||||
picker.applyManifest("cosplayer", new Map([[name, "images/" + name + " #1.jpeg"]]));
|
||||
const src = art.querySelector("img").getAttribute("data-src");
|
||||
assert.equal(
|
||||
src,
|
||||
"/identity_forge/gallery/cosplay/images/" + encodeURIComponent(name + " #1.jpeg"),
|
||||
);
|
||||
picker.close();
|
||||
} finally {
|
||||
|
||||
@@ -64,11 +64,12 @@ test("both picker buttons and the inline preview DOM widget are present, buttons
|
||||
assert.equal(preview.options?.serialize, false);
|
||||
});
|
||||
|
||||
test("refresh populates the character combo from the vault characters route", async () => {
|
||||
test("refresh populates the character combo, keeping the random option last (2.6.0)", async () => {
|
||||
const node = await setup();
|
||||
const charW = node.widgets.find((w) => w.name === "character");
|
||||
assert.ok(charW);
|
||||
assert.deepEqual(charW.options.values, SAMPLE_CHARACTERS.map((c) => c.name));
|
||||
assert.deepEqual(charW.options.values,
|
||||
[...SAMPLE_CHARACTERS.map((c) => c.name), "(random saved character)"]);
|
||||
});
|
||||
|
||||
test("an empty vault falls back to the no-characters sentinel, matching the Python default", async () => {
|
||||
@@ -127,6 +128,68 @@ test("delete posts to the delete route with a JSON content type", async () => {
|
||||
});
|
||||
|
||||
|
||||
/* --- A refresh never swaps the pick for another character (2.8.0) -------- */
|
||||
test("a saved name this vault lacks survives a refresh; a placeholder moves to the first entry", async () => {
|
||||
const node = await setup();
|
||||
const charW = node.widgets.find((w) => w.name === "character");
|
||||
const refreshBtn = node.widgets.find((w) => w.name === "🔄 Refresh");
|
||||
charW.value = "From another machine";
|
||||
refreshBtn.callback();
|
||||
await flush();
|
||||
assert.equal(charW.value, "From another machine", "must not silently recall someone else");
|
||||
charW.value = "(no characters saved)";
|
||||
refreshBtn.callback();
|
||||
await flush();
|
||||
assert.equal(charW.value, SAMPLE_CHARACTERS[0].name);
|
||||
});
|
||||
|
||||
test("a failed refresh keeps the current pick", async () => {
|
||||
const node = await setup();
|
||||
const charW = node.widgets.find((w) => w.name === "character");
|
||||
charW.value = SAMPLE_CHARACTERS[1].name;
|
||||
__setFetchApiHandler(async () => { throw new Error("connection refused"); });
|
||||
node.widgets.find((w) => w.name === "🔄 Refresh").callback();
|
||||
await flush();
|
||||
assert.deepEqual(charW.options.values, ["(vault unavailable — press Refresh)"]);
|
||||
assert.equal(charW.value, SAMPLE_CHARACTERS[1].name);
|
||||
});
|
||||
|
||||
test("renaming the current pick follows it; deleting it moves to the first entry", async () => {
|
||||
const node = await setup();
|
||||
const charW = node.widgets.find((w) => w.name === "character");
|
||||
charW.value = SAMPLE_CHARACTERS[1].name;
|
||||
let characters = SAMPLE_CHARACTERS;
|
||||
__setFetchApiHandler(async (route, opts) => {
|
||||
if (route === "/identity_forge/vault/rename") {
|
||||
const { to } = JSON.parse(opts.body);
|
||||
characters = [SAMPLE_CHARACTERS[0], { ...SAMPLE_CHARACTERS[1], name: to }];
|
||||
return { ok: true, json: async () => ({ name: to }) };
|
||||
}
|
||||
if (route === "/identity_forge/vault/delete") {
|
||||
const { names } = JSON.parse(opts.body);
|
||||
characters = characters.filter((c) => !names.includes(c.name));
|
||||
return { ok: true, json: async () => ({ characters: characters.map((c) => c.name) }) };
|
||||
}
|
||||
return { ok: true, json: async () => ({ characters }) };
|
||||
});
|
||||
const originals = { prompt: globalThis.prompt, confirm: globalThis.confirm };
|
||||
globalThis.prompt = () => "Renamed";
|
||||
globalThis.confirm = () => true;
|
||||
try {
|
||||
node.widgets.find((w) => w.name === "🗂 Manage Vault…").callback();
|
||||
await flush();
|
||||
const overlay = document.body.firstElementChild;
|
||||
[...overlay.querySelectorAll("button")].filter((b) => b.title === "Rename")[1].click();
|
||||
await flush();
|
||||
assert.equal(charW.value, "Renamed");
|
||||
[...overlay.querySelectorAll("button")].filter((b) => b.title === "Delete")[1].click();
|
||||
await flush();
|
||||
assert.equal(charW.value, SAMPLE_CHARACTERS[0].name);
|
||||
} finally {
|
||||
Object.assign(globalThis, originals);
|
||||
}
|
||||
});
|
||||
|
||||
/* --- Re-entry guard (0.97.0) --------------------------------------------- */
|
||||
test("a second onNodeCreated adds no second Refresh, Manage or preview widget", async () => {
|
||||
resetDom();
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
"""Tests for the IdentityForgeAgeProgression node (2.3.0).
|
||||
|
||||
Contract: one resolved character at several adult ages; hair greys forward, never back;
|
||||
nothing an age refuses is voiced.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
from data.fields import FIELD_DEFINITIONS
|
||||
from nodes.identity_forge_age_progression import (
|
||||
_STAGES, IdentityForgeAgeProgression, _stage_hair, resolve_age_progression,
|
||||
)
|
||||
from nodes.identity_forge_cosplayer import IdentityForgeCosplayer
|
||||
from tests.test_outfit_sheet import _Conflicts, _forge
|
||||
|
||||
|
||||
class VocabularyTests(unittest.TestCase):
|
||||
def test_every_stage_is_an_adult_pool_age(self):
|
||||
for name, stages in _STAGES.items():
|
||||
self.assertEqual(list(stages), sorted(stages, key=int), name)
|
||||
for stage in stages:
|
||||
self.assertIn(stage, FIELD_DEFINITIONS["age"]["female_options"])
|
||||
self.assertIn(stage, FIELD_DEFINITIONS["age"]["male_options"])
|
||||
self.assertGreaterEqual(int(stage), 18)
|
||||
|
||||
|
||||
class HairTests(unittest.TestCase):
|
||||
def test_greys_forward(self):
|
||||
self.assertEqual(_stage_hair("jet black", 30, 50, ""), "jet black")
|
||||
self.assertEqual(_stage_hair("jet black", 30, 60, ""), "salt and pepper")
|
||||
self.assertEqual(_stage_hair("jet black", 30, 70, ""), "silver")
|
||||
self.assertEqual(_stage_hair("golden blonde", 30, 60, ""), "silver")
|
||||
# Younger than the character: the colour they have now.
|
||||
self.assertEqual(_stage_hair("jet black", 50, 20, ""), "jet black")
|
||||
|
||||
def test_never_back(self):
|
||||
# Grey at 45 stays grey at 50 even though most 50-year-olds are not.
|
||||
self.assertEqual(_stage_hair("silver", 45, 50, "dark brown"), "silver")
|
||||
self.assertEqual(_stage_hair("silver", 45, 40, "dark brown"), "dark brown")
|
||||
self.assertEqual(_stage_hair("salt and pepper", 70, 60, "dark brown"),
|
||||
"salt and pepper")
|
||||
self.assertEqual(_stage_hair("salt and pepper", 70, 20, "dark brown"), "dark brown")
|
||||
|
||||
def test_stage_colours_are_live_options(self):
|
||||
for colour in ("salt and pepper", "silver"):
|
||||
self.assertIn(colour, FIELD_DEFINITIONS["hair_color"]["female_options"])
|
||||
self.assertIn(colour, FIELD_DEFINITIONS["hair_color"]["male_options"])
|
||||
|
||||
|
||||
class ProgressionTests(unittest.TestCase):
|
||||
def test_same_person_at_each_age(self):
|
||||
document = _forge(23)
|
||||
prompts, labels = resolve_age_progression(document, "Decades (6)", "Unspecified")
|
||||
self.assertEqual(labels, [f"{i}-age-{a}" for i, a in
|
||||
enumerate(_STAGES["Decades (6)"], start=1)])
|
||||
for prompt, stage in zip(prompts, _STAGES["Decades (6)"]):
|
||||
self.assertIn(f"{stage}-year-old", prompt)
|
||||
# Only the age moves in the identity sentence.
|
||||
heads = {p.split(". ")[0].replace(f"{a}-year-old", "AGE")
|
||||
for p, a in zip(prompts, _STAGES["Decades (6)"])}
|
||||
self.assertEqual(len(heads), 1, heads)
|
||||
|
||||
def test_no_stage_voices_a_contradiction(self):
|
||||
handler = _Conflicts()
|
||||
root = logging.getLogger()
|
||||
old_level = root.level
|
||||
root.addHandler(handler)
|
||||
root.setLevel(logging.INFO)
|
||||
try:
|
||||
for seed in range(30):
|
||||
document = _forge(seed)
|
||||
handler.messages.clear()
|
||||
resolve_age_progression(document, "Decades (6)", "Head and shoulders")
|
||||
self.assertEqual(handler.messages, [], f"seed {seed}")
|
||||
finally:
|
||||
root.removeHandler(handler)
|
||||
root.setLevel(old_level)
|
||||
|
||||
def test_a_masked_character_emits_one_view(self):
|
||||
kwargs = {spec.id: getattr(spec, "default", None)
|
||||
for spec in IdentityForgeCosplayer.define_schema().inputs}
|
||||
kwargs.update(character="Grimace", seed=7, upstream="")
|
||||
document = _forge(7, IdentityForgeCosplayer.execute(**kwargs).args[0])
|
||||
self.assertTrue(json.loads(document)["_meta"].get("covers_face"))
|
||||
prompts, labels = resolve_age_progression(document, "Decades (6)", "Unspecified")
|
||||
self.assertEqual((len(prompts), labels), (1, ["1-as-resolved"]))
|
||||
|
||||
|
||||
class SchemaTests(unittest.TestCase):
|
||||
def test_outputs_are_lists(self):
|
||||
schema = IdentityForgeAgeProgression.define_schema()
|
||||
self.assertEqual(schema.node_id, "IdentityForgeAgeProgression")
|
||||
self.assertEqual(schema.category, "conditioning/character")
|
||||
self.assertTrue(all(output.is_output_list for output in schema.outputs))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -3,7 +3,7 @@
|
||||
Scans README.md and docs/*.md (excluding docs/worklog/, which is gitignored
|
||||
and so would make this test behave differently locally than on a fresh
|
||||
clone) for `[text](path)` links, and checks that every relative path
|
||||
resolves to a real file. External links (http(s)://, mailto:) and same-file
|
||||
resolves to a real file or folder. External links (http(s)://, mailto:) and same-file
|
||||
anchor links (`#section`) are skipped; an anchor fragment on a cross-file
|
||||
link (`architecture.md#some-heading`) is stripped before checking, since
|
||||
verifying the fragment itself actually exists in the target file is not
|
||||
@@ -39,7 +39,7 @@ class RelativeDocLinksTests(unittest.TestCase):
|
||||
broken = []
|
||||
for doc_path, path_part in _iter_relative_links():
|
||||
resolved = (doc_path.parent / path_part).resolve()
|
||||
if not resolved.is_file():
|
||||
if not resolved.exists(): # a folder link (example_workflows/) is valid too
|
||||
broken.append(f"{doc_path.relative_to(ROOT)} -> {path_part}")
|
||||
self.assertFalse(
|
||||
broken,
|
||||
|
||||
+136
-17
@@ -265,6 +265,27 @@ class GenderTests(unittest.TestCase):
|
||||
self.assertEqual(flat.get(field), value, field)
|
||||
|
||||
|
||||
class LockedEyeMakeupOnBareFaceTests(unittest.TestCase):
|
||||
"""2.4.0: a man's "no makeup" default hid an archetype's locked eyeliner (Emo,
|
||||
Indie Sleaze, 1980s New Wave). Locked eye fields are voiced; random cosmetics and
|
||||
lips stay hidden."""
|
||||
|
||||
def test_emo_man_keeps_his_eyeliner_only(self):
|
||||
for seed in range(10):
|
||||
flat = _parse_archetype_json(build_archetype_json("Emo", seed, "Essentials"))
|
||||
gv = flat.pop(_VARIANTS_KEY, None)
|
||||
prose, _ = generate_character(seed, "Male", flat, gender_variants=gv)
|
||||
self.assertIn("He wears smoky black eyeshadow and smudged kohl eyeliner.",
|
||||
prose, f"seed {seed}")
|
||||
for word in ("lip colour", "blush", "mascara", "highlighter", "finish"):
|
||||
self.assertNotIn(word, prose, f"'{word}' on seed {seed}")
|
||||
|
||||
def test_random_man_stays_bare_faced(self):
|
||||
for seed in range(30):
|
||||
prose, _ = generate_character(seed, "Male", {})
|
||||
self.assertNotIn("eyeliner", prose, f"seed {seed}")
|
||||
|
||||
|
||||
class ERNurseGenderMakeupTests(unittest.TestCase):
|
||||
"""0.67.0: ER Nurse is a unisex archetype whose only per-gender difference is
|
||||
makeup. It carries a costume-less ``variants`` block (Female -> soft natural
|
||||
@@ -2640,6 +2661,45 @@ class UserPresetExtensionTests(unittest.TestCase):
|
||||
self.assertNotIn("Broken", store)
|
||||
self.assertNotIn("Empty", store)
|
||||
|
||||
def test_archetypes_keep_list_values_and_variants(self):
|
||||
# 2.6.0: both are built-in shapes; they used to be dropped silently.
|
||||
from data.user_options import apply_user_archetypes
|
||||
store = {}
|
||||
f = self._write({"archetypes": {
|
||||
"Listy": {"gender": "Female", "hair_color": ["copper", 7, "auburn"], "x": []},
|
||||
"Paired": {"variants": {"Female": {"age": "25"}, "Male": {"age": "30"},
|
||||
"Other": {"age": "40"}}},
|
||||
}})
|
||||
with self.assertLogs("data.user_options", "WARNING") as logs:
|
||||
self.assertEqual(apply_user_archetypes(store, path=f), 2)
|
||||
self.assertEqual(store["Listy"], {"gender": "Female", "hair_color": ["copper", "auburn"]})
|
||||
self.assertEqual(store["Paired"],
|
||||
{"variants": {"Female": {"age": "25"}, "Male": {"age": "30"}}})
|
||||
self.assertIn("'Listy': ignored x", logs.output[0])
|
||||
|
||||
def test_cosplayers_keep_alternates_back_and_subject(self):
|
||||
from data.user_options import apply_user_cosplayers
|
||||
store = {}
|
||||
f = self._write({"cosplayers": {
|
||||
"Alt": {"costume": "a red suit", "costume_back": "a red suit with a cape",
|
||||
"costumes": ["a blue suit", {"costume": "a gold suit", "mask": "a gold helm",
|
||||
"signature": {"hair_color": "white", "n": 1}},
|
||||
{"mask": "no costume key"}, ""],
|
||||
"costume_weights": [2, 1, 1], "subject": " A pig-headed alien. "},
|
||||
"Bad Weights": {"costume": "a robe", "costumes": ["a cloak"],
|
||||
"costume_weights": [1]},
|
||||
}})
|
||||
with self.assertLogs("data.user_options", "WARNING"):
|
||||
apply_user_cosplayers(store, path=f)
|
||||
alt = store["Alt"]
|
||||
self.assertEqual(alt["costume_back"], "a red suit with a cape")
|
||||
self.assertEqual(alt["subject"], "pig-headed alien")
|
||||
self.assertEqual(alt["costumes"], ["a blue suit", {
|
||||
"costume": "a gold suit", "mask": "a gold helm", "signature": {"hair_color": "white"}}])
|
||||
self.assertEqual(alt["costume_weights"], [2, 1, 1])
|
||||
self.assertNotIn("costume_weights", store["Bad Weights"])
|
||||
self.assertEqual(store["Bad Weights"]["costumes"], ["a cloak"])
|
||||
|
||||
def test_cosplayers_merge_requires_costume_and_defaults(self):
|
||||
from data.user_options import apply_user_cosplayers
|
||||
store = {}
|
||||
@@ -2951,6 +3011,12 @@ class RollAndLockTests(unittest.TestCase):
|
||||
for f in fields:
|
||||
self.assertEqual(again.get(f, "None"), widgets[f], f"{gender} @{seed}: {f}")
|
||||
|
||||
def test_non_text_widget_values_are_ignored(self):
|
||||
# 2.6.0: the route passes JSON through, and {"age": 3.5} crashed the engine.
|
||||
from nodes.identity_forge import roll_field_values
|
||||
self.assertEqual(roll_field_values({"age": 3.5, "hair_color": 7, "gender": True}, 4),
|
||||
roll_field_values({}, 4))
|
||||
|
||||
|
||||
class FeetOutOfFrameTests(unittest.TestCase):
|
||||
"""1.7.0: a framing that crops the feet drops the footwear clause from the prose.
|
||||
@@ -4158,6 +4224,17 @@ class PerformablePoseTests(unittest.TestCase):
|
||||
"running one hand through the hair", "adjusting one cuff"):
|
||||
self.assertIn(pose, got)
|
||||
|
||||
def test_prop_in_each_hand_drops_one_handed_poses(self):
|
||||
# 2.4.0: Star-Lord drew "adjusting one cuff" with a blaster in each hand.
|
||||
resolved = {"hair_length": "long", "outfit_description": "a wool overcoat",
|
||||
"held_item": "a pair of blasters, one in each hand"}
|
||||
got = _performable_poses(self._pool(), resolved, False, False, False)
|
||||
for pose in ("posing with a hand on one hip", "adjusting one cuff",
|
||||
"running one hand through the hair", "waving at the camera"):
|
||||
self.assertNotIn(pose, got)
|
||||
self.assertFalse(HAND_OCCUPIED_POSES & set(got))
|
||||
self.assertTrue(got)
|
||||
|
||||
def test_absent_held_item_changes_nothing(self):
|
||||
# `held_item` is optional and preset-only; an absent value must not narrow.
|
||||
base = {"hair_length": "long", "outfit_description": "a wool overcoat"}
|
||||
@@ -5061,8 +5138,8 @@ class FeralFitnessTests(unittest.TestCase):
|
||||
feral = _FORM_SUPPRESS_FIELDS[_FORM_FERAL]
|
||||
self.assertNotIn("body_type", feral, "a shape reads fine on a beast")
|
||||
self.assertNotIn("height", feral, "a towering creature reads fine")
|
||||
self.assertEqual(_FORM_SUPPRESS_FIELDS[_FORM_ANTHRO], set(),
|
||||
"anthro is humanoid and keeps everything")
|
||||
# 2.4.0: anthro keeps its shape and drops only the lifestyle word.
|
||||
self.assertEqual(_FORM_SUPPRESS_FIELDS[_FORM_ANTHRO], {"fitness_level"})
|
||||
|
||||
|
||||
class WornItemDeduplicationTests(unittest.TestCase):
|
||||
@@ -5554,6 +5631,14 @@ class ValidatorGuardTests(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
_duplicate_literal_keys(ROOT / filename, dict_name), [], filename)
|
||||
|
||||
def test_tobacco_guard_catches_smoking_items_but_not_garment_cuts(self):
|
||||
from tests.validate_data import _SMOKING_RE
|
||||
for bad in ("a thick lit cigar", "a corncob pipe", "a calabash pipe", "a hookah"):
|
||||
self.assertTrue(_SMOKING_RE.search(bad), bad)
|
||||
for ok in ("cigarette trousers", "a rusted lead pipe", "a blowdart pipe",
|
||||
"barbecue joint", "jointed limbs", "a bagpipe"):
|
||||
self.assertIsNone(_SMOKING_RE.search(ok), ok)
|
||||
|
||||
|
||||
class UserOptionsIntegrationTests(unittest.TestCase):
|
||||
"""user_options.json additions must be first-class: reachable by the random
|
||||
@@ -6067,19 +6152,19 @@ class RandomPoolTests(unittest.TestCase):
|
||||
# at 1.1.0 (Task 5 roster pass, 1977 -> 1994 cosplayers) and again at
|
||||
# 1.2.0 (1994 -> 1999), again at 1.3.0 (1999 -> 2023) and again at
|
||||
# 1.4.0 (2023 -> 2052), at 1.5.0 (2052 -> 2057) and at 1.5.1 (2057 -> 2073) and at 1.8.0 (new
|
||||
# cosplayers, one folded duplicate), at 1.9.0, at 1.11.0, at 2.1.0 and at 2.2.0 to
|
||||
# cosplayers, one folded duplicate), at 1.9.0, at 1.11.0, at 2.1.0, at 2.2.0 and at 2.7.0 to
|
||||
# the new ground truth. It is expected to need refreshing every time the roster grows.
|
||||
expected = {
|
||||
(_RANDOM_ANY, 0): 'Rhino',
|
||||
(_RANDOM_ANY, 1): 'Enid Sinclair',
|
||||
(_RANDOM_ANY, 2): 'Booster Gold',
|
||||
(_RANDOM_ANY, 3): 'Kimberly Jackson',
|
||||
(_RANDOM_ANY, 4): 'Kikyo',
|
||||
(_RANDOM_FEMALE, 0): 'Rikku',
|
||||
(_RANDOM_FEMALE, 1): 'Fire',
|
||||
(_RANDOM_FEMALE, 2): 'Bloody Mary',
|
||||
(_RANDOM_FEMALE, 3): 'Leone',
|
||||
(_RANDOM_FEMALE, 4): 'Leeloo',
|
||||
(_RANDOM_ANY, 0): 'Rebecca (Cyberpunk)',
|
||||
(_RANDOM_ANY, 1): 'Emma Frost',
|
||||
(_RANDOM_ANY, 2): 'Boba Fett',
|
||||
(_RANDOM_ANY, 3): 'Kenny McCormick',
|
||||
(_RANDOM_ANY, 4): 'Katma Tui',
|
||||
(_RANDOM_FEMALE, 0): 'Ranni the Witch',
|
||||
(_RANDOM_FEMALE, 1): 'Faith Connors',
|
||||
(_RANDOM_FEMALE, 2): 'Blake Belladonna',
|
||||
(_RANDOM_FEMALE, 3): 'Lapis Lazuli',
|
||||
(_RANDOM_FEMALE, 4): 'Lady Tremaine',
|
||||
(_RANDOM_MALE, 0): 'Reverse-Flash',
|
||||
(_RANDOM_MALE, 1): 'Duff Killigan',
|
||||
(_RANDOM_MALE, 2): 'Bowser',
|
||||
@@ -6632,6 +6717,14 @@ class AdvertisedCharacterCountTests(unittest.TestCase):
|
||||
f"only in the generated docs/reference/*.md -- describe the roster "
|
||||
f"qualitatively here and link the reference index instead.")
|
||||
|
||||
def test_registry_description_fits(self):
|
||||
"""The Comfy Registry rejects a description over 1000 characters (400
|
||||
"description is too long"); 2.6.0 failed to publish on this. (2.6.1)"""
|
||||
text = self._sources()[1].read_text(encoding="utf-8")
|
||||
match = re.search(r'^description = "(.*)"$', text, re.M)
|
||||
self.assertIsNotNone(match)
|
||||
self.assertLessEqual(len(match.group(1)), 1000)
|
||||
|
||||
|
||||
class EveryScopeGenderComboTests(unittest.TestCase):
|
||||
"""Every scope x every gender must return an IN-SCOPE character. (0.75.0)
|
||||
@@ -6910,10 +7003,8 @@ class NewRosterEntryTests(unittest.TestCase):
|
||||
"Yamada Asaemon Sagiri", 2, include_prop=True))
|
||||
self.assertIn("a katana in a black lacquered scabbard",
|
||||
worn["Clothing"]["outfit_description"])
|
||||
self.assertIn("an empty black lacquered scabbard",
|
||||
held["Clothing"]["outfit_description"])
|
||||
self.assertNotIn("a katana in a black lacquered scabbard",
|
||||
held["Clothing"]["outfit_description"])
|
||||
# 2.4.0: an "empty scabbard" rendered as a second sheathed sword, so none is named.
|
||||
self.assertNotIn("scabbard", held["Clothing"]["outfit_description"])
|
||||
|
||||
def test_alternate_looks_actually_roll(self):
|
||||
for name, expected in (("Yuzuriha", 3), ("Gabimaru", 2), ("Fern", 2)):
|
||||
@@ -7890,6 +7981,34 @@ class SpeciesRoundTripTests(unittest.TestCase):
|
||||
self.assertIn("Demographics", meta.get("suppress_groups", []))
|
||||
self.assertIn("waist", meta.get("suppress_fields", []))
|
||||
|
||||
def test_anthro_monster_is_humanoid_not_a_human_hybrid(self):
|
||||
# 2.4.0: "anthropomorphic skeleton hybrid ... a full waist, wide hips" drew a
|
||||
# person; an animal hybrid keeps its proportions and clothes.
|
||||
for seed in range(6):
|
||||
prose, _ = self._save("skeleton", "Anthropomorphic", seed=seed)
|
||||
self.assertIn("humanoid skeleton", prose)
|
||||
self.assertNotIn("hybrid", prose)
|
||||
self.assertNotRegex(prose, r"\b(?:hips|waist|physique)\b")
|
||||
self.assertIn(" wears ", prose)
|
||||
lion, _ = self._save("lion", "Anthropomorphic", seed=seed)
|
||||
self.assertIn("anthropomorphic lion hybrid", lion)
|
||||
self.assertNotIn("physique", lion)
|
||||
|
||||
def test_anthro_rewrites_apply_only_in_anthro_form(self):
|
||||
# 2.4.0: a creature's "anthro" text replaces its whole-animal slots, so the
|
||||
# model draws one hybrid, not a person beside a stegosaurus. Feral keeps
|
||||
# the animal, and recall at a new seed keeps the lead noun.
|
||||
prose, saved = self._save("stegosaurus", "Anthropomorphic")
|
||||
self.assertIn("scaly reptilian humanoid", prose)
|
||||
self.assertIn("sturdy scaly legs", prose)
|
||||
self.assertNotIn("forelegs", prose)
|
||||
self.assertIn("scaly reptilian humanoid", self._recall(saved, 41)[0])
|
||||
feral, _ = self._save("stegosaurus", "Feral / full creature")
|
||||
self.assertIn("forelegs", feral)
|
||||
self.assertNotIn("humanoid", feral)
|
||||
nautilus, _ = self._save("nautilus", "Anthropomorphic")
|
||||
self.assertNotIn("siphon", nautilus) # "" drops the slot
|
||||
|
||||
def test_a_feral_creature_survives_recall_at_a_new_seed(self):
|
||||
for creature in ("lion", "dragon", "bison", "octopus"):
|
||||
saved_prose, saved = self._save(creature, "Feral / full creature")
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Example workflows stay loadable against the current node schemas (2.6.0).
|
||||
|
||||
``widgets_values`` is positional: a widget added, removed or reordered in a node's
|
||||
``define_schema()`` shifts every later value in a saved workflow, and a combo option
|
||||
that was renamed loads as an invalid value. Nothing caught that for the shipped
|
||||
``example_workflows/`` until this test, which checks every pack node in them against
|
||||
the committed frontend fixture (``tests/frontend/fixtures/nodes.json``, itself gated
|
||||
against the live schemas by ``scripts/dump_frontend_fixtures.py --check``).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOWS = sorted((ROOT / "example_workflows").glob("*.json"))
|
||||
FIXTURE = json.loads((ROOT / "tests" / "frontend" / "fixtures" / "nodes.json")
|
||||
.read_text(encoding="utf-8"))
|
||||
|
||||
#: The Vault Load combo lists the user's own saved characters, so any name is valid.
|
||||
_FREE_COMBOS = {("IdentityForgeVaultLoad", "character")}
|
||||
|
||||
|
||||
class ExampleWorkflowWidgetTests(unittest.TestCase):
|
||||
def test_there_are_example_workflows(self):
|
||||
self.assertTrue(WORKFLOWS)
|
||||
|
||||
def test_pack_nodes_match_the_schema(self):
|
||||
for path in WORKFLOWS:
|
||||
workflow = json.loads(path.read_text(encoding="utf-8"))
|
||||
for node in workflow["nodes"]:
|
||||
widgets = FIXTURE.get(node["type"])
|
||||
if widgets is None:
|
||||
self.assertFalse(node["type"].startswith("IdentityForge"),
|
||||
f"{path.name}: {node['type']} missing from the fixture")
|
||||
continue
|
||||
values = node.get("widgets_values") or []
|
||||
with self.subTest(workflow=path.name, node=node["id"]):
|
||||
self.assertEqual(len(values), len(widgets),
|
||||
f"{node['type']}: widget count changed")
|
||||
for widget, value in zip(widgets, values):
|
||||
if widget["type"] != "combo" or (node["type"], widget["name"]) in _FREE_COMBOS:
|
||||
continue
|
||||
self.assertIn(value, widget["options"],
|
||||
f"{node['type']}.{widget['name']}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+39
-38
@@ -37,7 +37,10 @@ except ImportError:
|
||||
PILImage = None
|
||||
|
||||
GALLERY_ROOT = ROOT / "gallery"
|
||||
KINDS = ("cosplay", "archetypes", "creatures")
|
||||
KINDS = ("cosplay", "archetypes", "creatures", "people")
|
||||
#: The galleries built from a roster. The people gallery is fixed seeds: no release
|
||||
#: stamps and no downloadable cycle workflow (its cards carry the seed and prompt).
|
||||
ROSTER_KINDS = KINDS[:3]
|
||||
SCRIPTS = ("publish.py", "build_manifest.py", "build_gallery_images.py",
|
||||
"cross_reference.py")
|
||||
|
||||
@@ -113,8 +116,7 @@ class CopiesStayInSyncTests(unittest.TestCase):
|
||||
|
||||
def test_every_gallery_ships_the_full_script_set(self):
|
||||
for kind in KINDS:
|
||||
for name in SCRIPTS + ("update_gallery.bat", "index.html",
|
||||
"style.css", "gallery.js"):
|
||||
for name in SCRIPTS + ("update_gallery.bat", "index.html"):
|
||||
self.assertTrue((GALLERY_ROOT / kind / name).is_file(),
|
||||
f"gallery/{kind}/{name} is missing")
|
||||
|
||||
@@ -397,7 +399,7 @@ class StagedFileTests(unittest.TestCase):
|
||||
f"the file does not exist; it would be skipped silently")
|
||||
|
||||
def test_every_gallery_ships_a_downloadable_workflow(self):
|
||||
for kind in KINDS:
|
||||
for kind in ROSTER_KINDS:
|
||||
pub = load(kind, "publish")
|
||||
workflows = [f for f in pub.PAGE_FILES if f.endswith(".json")]
|
||||
self.assertEqual(len(workflows), 1,
|
||||
@@ -408,7 +410,7 @@ class StagedFileTests(unittest.TestCase):
|
||||
|
||||
def test_the_page_links_to_the_workflow_it_stages(self):
|
||||
"""The link and the staged filename are set in two different files."""
|
||||
for kind in KINDS:
|
||||
for kind in ROSTER_KINDS:
|
||||
pub = load(kind, "publish")
|
||||
workflow = next(f for f in pub.PAGE_FILES if f.endswith(".json"))
|
||||
page = (GALLERY_ROOT / kind / "index.html").read_text(encoding="utf-8")
|
||||
@@ -457,43 +459,42 @@ class SourceMatchingTests(unittest.TestCase):
|
||||
self.assertNotIn(published_only, {supplied})
|
||||
|
||||
|
||||
class PageAssetsStayInSyncTests(unittest.TestCase):
|
||||
"""The three PAGE files are copies too, and nothing pinned them (0.97.0).
|
||||
class SharedPageAssetsTests(unittest.TestCase):
|
||||
"""2.6.0: ``style.css`` and ``gallery.js`` exist once, in ``gallery/shared/``.
|
||||
|
||||
``CopiesStayInSyncTests`` covers the four ``.py`` scripts. It never covered
|
||||
``gallery.js`` or ``style.css``, which are also maintained as copies -- and an
|
||||
audit found the consequence: all three shipped a ``style.css`` whose header
|
||||
comment claimed to be the *cosplay* sheet, because the file had been copied
|
||||
twice and the header never re-read.
|
||||
They used to be three copies held together by drift tests; an audit found a
|
||||
stylesheet header claiming to be the cosplay sheet inside the other two. Now
|
||||
each page links ``../shared/`` and ``publish.py`` stages the folder beside it.
|
||||
"""
|
||||
|
||||
def test_gallery_js_is_identical_outside_its_header_comment(self):
|
||||
bodies = {}
|
||||
SHARED = GALLERY_ROOT / "shared"
|
||||
|
||||
def test_one_copy_and_every_page_links_it(self):
|
||||
for name in ("style.css", "gallery.js"):
|
||||
self.assertTrue((self.SHARED / name).is_file(), name)
|
||||
for kind in KINDS:
|
||||
text = (GALLERY_ROOT / kind / "gallery.js").read_text(encoding="utf-8")
|
||||
# The leading /* ... */ banner names the gallery; everything after it
|
||||
# must match byte for byte.
|
||||
self.assertTrue(text.startswith("/*"), f"{kind}: no header banner")
|
||||
bodies[kind] = text[text.index("*/") + 2:]
|
||||
for kind in KINDS[1:]:
|
||||
self.assertEqual(
|
||||
bodies["cosplay"], bodies[kind],
|
||||
f"gallery/{kind}/gallery.js has drifted from gallery/cosplay/"
|
||||
f"gallery.js -- port the change to all three (gallery/README.md).")
|
||||
with self.subTest(kind):
|
||||
html = (GALLERY_ROOT / kind / "index.html").read_text(encoding="utf-8")
|
||||
self.assertIn('href="../shared/style.css"', html)
|
||||
self.assertIn('src="../shared/gallery.js"', html)
|
||||
for name in ("style.css", "gallery.js"):
|
||||
self.assertFalse((GALLERY_ROOT / kind / name).exists(),
|
||||
f"gallery/{kind}/{name} is a stale copy")
|
||||
|
||||
def test_style_css_is_byte_identical(self):
|
||||
base = (GALLERY_ROOT / "cosplay" / "style.css").read_text(encoding="utf-8")
|
||||
for kind in KINDS[1:]:
|
||||
self.assertEqual(
|
||||
base, (GALLERY_ROOT / kind / "style.css").read_text(encoding="utf-8"),
|
||||
f"gallery/{kind}/style.css has drifted from gallery/cosplay/style.css")
|
||||
def test_every_publish_copy_stages_the_shared_folder(self):
|
||||
for kind in KINDS:
|
||||
pub = load(kind, "publish")
|
||||
with self.subTest(kind):
|
||||
self.assertEqual(pub.SHARED_SRC_DIR, self.SHARED)
|
||||
self.assertEqual(pub.SHARED_REL_DIR, "gallery/shared")
|
||||
for name in pub.SHARED_FILES:
|
||||
self.assertTrue((self.SHARED / name).is_file(), name)
|
||||
|
||||
def test_the_shared_stylesheet_does_not_claim_to_be_one_gallery(self):
|
||||
# The bug this pins: a header saying "Cosplay Gallery Styles" inside the
|
||||
# creature and archetype copies, which is how the drift went unnoticed.
|
||||
head = (GALLERY_ROOT / "cosplay" / "style.css").read_text(
|
||||
encoding="utf-8")[:600].lower()
|
||||
self.assertNotIn("cosplay gallery styles", head)
|
||||
def test_the_shared_assets_name_no_single_gallery(self):
|
||||
for name in ("style.css", "gallery.js"):
|
||||
head = (self.SHARED / name).read_text(encoding="utf-8")[:600].lower()
|
||||
for kind in ("cosplay gallery", "creature gallery", "archetype gallery"):
|
||||
self.assertNotIn(kind, head, name)
|
||||
|
||||
def test_every_page_ships_the_sort_controls(self):
|
||||
for kind in KINDS:
|
||||
@@ -512,7 +513,7 @@ class PageAssetsStayInSyncTests(unittest.TestCase):
|
||||
# A `$('#id')` that resolves to null is how a control silently does
|
||||
# nothing -- the dead "Clear search" button shipped that way for releases.
|
||||
for kind in KINDS:
|
||||
js = (GALLERY_ROOT / kind / "gallery.js").read_text(encoding="utf-8")
|
||||
js = (self.SHARED / "gallery.js").read_text(encoding="utf-8")
|
||||
html = (GALLERY_ROOT / kind / "index.html").read_text(encoding="utf-8")
|
||||
queried = set(re.findall(r"\$\('#([\w-]+)'\)", js))
|
||||
for element_id in sorted(queried - self.INJECTED_IDS):
|
||||
@@ -601,7 +602,7 @@ class ReleaseStampTests(unittest.TestCase):
|
||||
self.assertEqual({k: added["cosplayers"][k] for k in before}, before)
|
||||
|
||||
def test_the_manifest_carries_what_the_sort_needs(self):
|
||||
for kind in KINDS:
|
||||
for kind in ROSTER_KINDS:
|
||||
mod = load(kind, "build_manifest")
|
||||
with self.subTest(kind):
|
||||
self.assertTrue(mod.pack_version())
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
"""Tests for the server-side gallery cache behind the picker's previews (2.3.0)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
import urllib.error
|
||||
from email.message import Message
|
||||
from pathlib import Path
|
||||
|
||||
from nodes import gallery_cache as gc
|
||||
|
||||
_MANIFEST = json.dumps({"entries": [
|
||||
{"name": "AKI", "image": "images/AKI.jpeg"},
|
||||
{"name": "2-1B Droid", "image": "images/2-1B Droid.jpeg"},
|
||||
{"name": "No image", "has_image": False},
|
||||
]}).encode("utf-8")
|
||||
|
||||
|
||||
class _Response:
|
||||
def __init__(self, body: bytes, content_type: str, etag: str = '"v1"') -> None:
|
||||
self._body = body
|
||||
self.headers = Message()
|
||||
self.headers["Content-Type"] = content_type
|
||||
self.headers["ETag"] = etag
|
||||
|
||||
def read(self, limit: int = -1) -> bytes:
|
||||
return self._body if limit < 0 else self._body[:limit]
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *_):
|
||||
return False
|
||||
|
||||
|
||||
class _Opener:
|
||||
"""Answers like GitHub Pages; ``offline`` makes every call fail."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.calls: "list[tuple[str, str | None]]" = []
|
||||
self.offline = False
|
||||
self.not_modified = False
|
||||
self.image_type = "image/jpeg"
|
||||
self.image_body = b"\xff\xd8jpeg"
|
||||
self.manifest = _MANIFEST
|
||||
|
||||
def __call__(self, request):
|
||||
url = request.full_url
|
||||
self.calls.append((url, request.get_header("If-none-match")))
|
||||
if self.offline:
|
||||
raise urllib.error.URLError("no network")
|
||||
if self.not_modified and request.get_header("If-none-match"):
|
||||
raise urllib.error.HTTPError(url, 304, "Not Modified", Message(), None)
|
||||
if url.endswith("manifest.json"):
|
||||
return _Response(self.manifest, "application/json")
|
||||
return _Response(self.image_body, self.image_type)
|
||||
|
||||
|
||||
class GalleryCacheTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self._dir = tempfile.TemporaryDirectory()
|
||||
self.root = Path(self._dir.name) / "cache"
|
||||
self.opener = _Opener()
|
||||
gc._LISTED.clear()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
gc._LISTED.clear()
|
||||
self._dir.cleanup()
|
||||
|
||||
def _age(self, path: Path, seconds: float) -> None:
|
||||
then = time.time() - seconds
|
||||
os.utime(path, (then, then))
|
||||
|
||||
def test_fetches_once_then_serves_from_disk(self):
|
||||
path = gc.manifest_path("cosplay", self.root, self.opener)
|
||||
self.assertEqual(path.read_bytes(), _MANIFEST)
|
||||
self.assertEqual(self.opener.calls[0][0], gc.GALLERY_ROOT + "cosplay/manifest.json")
|
||||
gc.manifest_path("cosplay", self.root, self.opener)
|
||||
self.assertEqual(len(self.opener.calls), 1, "a fresh copy must not refetch")
|
||||
|
||||
def test_stale_copy_revalidates_with_its_etag(self):
|
||||
path = gc.manifest_path("cosplay", self.root, self.opener)
|
||||
self._age(path, gc.MANIFEST_MAX_AGE + 5)
|
||||
self.opener.not_modified = True
|
||||
gc.manifest_path("cosplay", self.root, self.opener)
|
||||
self.assertEqual(self.opener.calls[-1][1], '"v1"')
|
||||
self.assertLess(time.time() - path.stat().st_mtime, 60, "a 304 renews freshness")
|
||||
|
||||
def test_offline_serves_what_was_cached(self):
|
||||
image = gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
self._age(image, gc.IMAGE_MAX_AGE + 5)
|
||||
self._age(self.root / "cosplay" / "manifest.json", gc.MANIFEST_MAX_AGE + 5)
|
||||
self.opener.offline = True
|
||||
self.assertEqual(
|
||||
gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener), image)
|
||||
|
||||
def test_offline_backs_off_instead_of_retrying_every_request(self):
|
||||
# 2.6.0: a failed refresh renews the cached copy, so the next requests do not
|
||||
# each wait out a network timeout again.
|
||||
image = gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
self._age(image, gc.IMAGE_MAX_AGE + 5)
|
||||
self._age(self.root / "cosplay" / "manifest.json", gc.MANIFEST_MAX_AGE + 5)
|
||||
self.opener.offline = True
|
||||
before = len(self.opener.calls)
|
||||
for _ in range(5):
|
||||
gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
self.assertEqual(len(self.opener.calls) - before, 2, "one manifest + one image try")
|
||||
|
||||
def test_svg_is_never_served(self):
|
||||
self.opener.manifest = json.dumps({"entries": [{"image": "images/x.svg"}]}).encode()
|
||||
self.opener.image_type, self.opener.image_body = "image/svg+xml", b"<svg/>"
|
||||
with self.assertRaises(gc.GalleryError):
|
||||
gc.image_path("cosplay", "images/x.svg", self.root, self.opener)
|
||||
self.assertFalse((self.root / "cosplay" / "images" / "x.svg").exists())
|
||||
|
||||
def test_offline_with_nothing_cached_is_an_error(self):
|
||||
self.opener.offline = True
|
||||
with self.assertRaises(gc.GalleryError):
|
||||
gc.manifest_path("cosplay", self.root, self.opener)
|
||||
|
||||
def test_only_listed_images_on_the_one_host(self):
|
||||
path = gc.image_path("cosplay", "images/2-1B Droid.jpeg", self.root, self.opener)
|
||||
self.assertEqual(path.name, "2-1B Droid.jpeg")
|
||||
self.assertEqual(self.opener.calls[-1][0],
|
||||
gc.GALLERY_ROOT + "cosplay/images/2-1B%20Droid.jpeg")
|
||||
for bad in ("images/Unknown.jpeg", "images/../../../secret.txt", "manifest.json"):
|
||||
with self.subTest(bad=bad), self.assertRaises(gc.GalleryError):
|
||||
gc.image_path("cosplay", bad, self.root, self.opener)
|
||||
with self.assertRaises(gc.GalleryError):
|
||||
gc.manifest_path("../etc", self.root, self.opener)
|
||||
|
||||
def test_rejected_responses_are_not_cached(self):
|
||||
self.opener.image_type = "text/html"
|
||||
with self.assertRaises(gc.GalleryError):
|
||||
gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
self.assertFalse((self.root / "cosplay" / "images" / "AKI.jpeg").exists())
|
||||
self.opener.image_type = "image/jpeg"
|
||||
self.opener.image_body = b"x" * (gc.MAX_IMAGE_BYTES + 1)
|
||||
with self.assertRaises(gc.GalleryError):
|
||||
gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
|
||||
def test_size_and_clear(self):
|
||||
self.assertEqual(gc.cache_bytes(self.root), 0)
|
||||
gc.image_path("cosplay", "images/AKI.jpeg", self.root, self.opener)
|
||||
self.assertGreater(gc.cache_bytes(self.root), len(_MANIFEST))
|
||||
gc.clear(self.root)
|
||||
self.assertEqual(gc.cache_bytes(self.root), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,56 @@
|
||||
"""Contracts every node class in ``nodes/`` keeps (2.6.0).
|
||||
|
||||
These were per-node tests (the Turnaround's tooltip check) or memory-only rules.
|
||||
Walking every module means a new node is covered without anyone listing it.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import inspect
|
||||
import math
|
||||
import pkgutil
|
||||
import unittest
|
||||
|
||||
import nodes
|
||||
|
||||
|
||||
def _node_classes():
|
||||
found = {}
|
||||
for info in pkgutil.iter_modules(nodes.__path__):
|
||||
module = importlib.import_module(f"nodes.{info.name}")
|
||||
for _, cls in inspect.getmembers(module, inspect.isclass):
|
||||
if cls.__module__ == module.__name__ and "define_schema" in cls.__dict__:
|
||||
found[cls.__name__] = cls
|
||||
return found
|
||||
|
||||
|
||||
class NodeContractTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.classes = _node_classes()
|
||||
|
||||
def test_every_node_is_found(self):
|
||||
self.assertIn("IdentityForgeSceneSheet", self.classes)
|
||||
self.assertGreaterEqual(len(self.classes), 12)
|
||||
|
||||
def test_every_input_and_output_carries_a_tooltip(self):
|
||||
for name, cls in self.classes.items():
|
||||
schema = cls.define_schema()
|
||||
for spec in schema.inputs:
|
||||
self.assertTrue((spec.tooltip or "").strip(), f"{name}.{spec.id}")
|
||||
for output in schema.outputs:
|
||||
self.assertTrue((output.tooltip or "").strip(),
|
||||
f"{name} output {output.display_name}")
|
||||
|
||||
def test_no_node_returns_a_nan_fingerprint(self):
|
||||
"""2.7.1: NaN never equals itself, and ComfyUI folds every ancestor's
|
||||
fingerprint into a node's cache key, so one NaN re-runs the whole graph
|
||||
downstream (sampler included) every queue. A seed is already in the key."""
|
||||
for name, cls in self.classes.items():
|
||||
if "fingerprint_inputs" in cls.__dict__:
|
||||
value = cls.fingerprint_inputs(character="(random saved character)", seed=3)
|
||||
self.assertFalse(isinstance(value, float) and math.isnan(value), name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,156 @@
|
||||
"""Tests for the IdentityForgeOutfitSheet node (2.3.0).
|
||||
|
||||
Contract: one resolved character, several outfits, and nothing but the clothes (and the
|
||||
styling that goes with them) moving between them.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
from data.fields import FIELD_DEFINITIONS
|
||||
from nodes.identity_forge import IdentityForge
|
||||
from nodes.identity_forge_cosplayer import IdentityForgeCosplayer
|
||||
from nodes.identity_forge_outfit_sheet import (
|
||||
_BACKDROPS, _CLOTHING, _RESTYLED, _SHEETS, IdentityForgeOutfitSheet,
|
||||
resolve_outfit_sheet,
|
||||
)
|
||||
|
||||
_POSE = "standing naturally"
|
||||
|
||||
|
||||
def _forge(seed: int, archetype_json: str = "") -> str:
|
||||
kwargs: dict = {spec.id: "Random" for spec in IdentityForge.define_schema().inputs}
|
||||
kwargs.update(
|
||||
seed=seed, archetype_json=archetype_json, set_all_fields="Off", gender="Any",
|
||||
wardrobe="Match gender", size_scale="Auto", hair_color_scope="Natural only",
|
||||
accessory_density="Balanced", location_setting="Any indoor/outdoor",
|
||||
)
|
||||
return IdentityForge.execute(**kwargs).args[1]
|
||||
|
||||
|
||||
class _Conflicts(logging.Handler):
|
||||
"""Collects the engine's lock-vs-lock reports: a lock it had to keep against a rule."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(logging.INFO)
|
||||
self.messages: "list[str]" = []
|
||||
|
||||
def emit(self, record: logging.LogRecord) -> None:
|
||||
if "keeping lock" in record.getMessage():
|
||||
self.messages.append(record.getMessage())
|
||||
|
||||
|
||||
class VocabularyTests(unittest.TestCase):
|
||||
def test_every_sheet_style_is_a_live_option(self):
|
||||
for sheet, styles in _SHEETS.items():
|
||||
self.assertEqual(len(styles), len(set(styles)), sheet)
|
||||
for style in styles:
|
||||
self.assertIn(style, FIELD_DEFINITIONS["outfit_style"]["female_options"])
|
||||
self.assertIn(style, FIELD_DEFINITIONS["outfit_style"]["male_options"])
|
||||
|
||||
def test_every_backdrop_is_a_live_location(self):
|
||||
for label, location in _BACKDROPS.items():
|
||||
if location:
|
||||
self.assertIn(location, FIELD_DEFINITIONS["location"]["female_options"], label)
|
||||
self.assertIn(location, FIELD_DEFINITIONS["location"]["male_options"], label)
|
||||
|
||||
def test_restyling_never_touches_the_person(self):
|
||||
groups = {FIELD_DEFINITIONS[name]["group"] for name in _RESTYLED}
|
||||
self.assertNotIn("Face", groups)
|
||||
self.assertNotIn("Body", groups)
|
||||
self.assertNotIn("Demographics", groups)
|
||||
self.assertFalse({"hair_color", "hair_length", "hair_texture"} & _RESTYLED)
|
||||
self.assertIn("outfit_description", _CLOTHING)
|
||||
|
||||
|
||||
class SheetTests(unittest.TestCase):
|
||||
def test_same_person_each_view_in_its_style(self):
|
||||
document = _forge(11)
|
||||
prompts, labels = resolve_outfit_sheet(
|
||||
document, "Range (6)", "Grey studio backdrop", "Full body", _POSE)
|
||||
self.assertEqual(len(prompts), 6)
|
||||
self.assertEqual(labels[2], "3-business-formal")
|
||||
self.assertEqual(len(set(prompts)), 6, "every view must differ")
|
||||
heads = {prompt.split(". ")[0] for prompt in prompts}
|
||||
self.assertEqual(len(heads), 1, heads)
|
||||
for prompt in prompts:
|
||||
self.assertIn("seamless grey studio backdrop", prompt)
|
||||
|
||||
def test_deterministic_and_stable_across_sheets(self):
|
||||
document = _forge(4)
|
||||
first = resolve_outfit_sheet(document, "Range (6)", "Grey studio backdrop",
|
||||
"Full body", _POSE)
|
||||
again = resolve_outfit_sheet(document, "Range (6)", "Grey studio backdrop",
|
||||
"Full body", _POSE)
|
||||
self.assertEqual(first, again)
|
||||
everyday, _ = resolve_outfit_sheet(document, "Everyday (4)", "Grey studio backdrop",
|
||||
"Full body", _POSE)
|
||||
# The seed follows the style, not the position: casual dresses the same way.
|
||||
self.assertEqual(first[0][0], everyday[0])
|
||||
|
||||
def test_outfits_differ_between_characters_and_by_outfit_seed(self):
|
||||
# 2.3.0: a fixed per-style seed gave 40 characters four casual outfits.
|
||||
def outfit(prompt: str) -> str:
|
||||
return prompt.split(" wears ", 2)[-1].split(". ")[0]
|
||||
|
||||
casual = {outfit(resolve_outfit_sheet(_forge(seed), "Everyday (4)",
|
||||
"Grey studio backdrop", "Full body",
|
||||
_POSE)[0][0])
|
||||
for seed in range(12)}
|
||||
self.assertGreaterEqual(len(casual), 10, casual)
|
||||
document = _forge(4)
|
||||
rolls = {tuple(outfit(p) for p in resolve_outfit_sheet(
|
||||
document, "Everyday (4)", "Grey studio backdrop", "Full body", _POSE,
|
||||
outfit_seed=n)[0])
|
||||
for n in range(4)}
|
||||
self.assertEqual(len(rolls), 4, "each outfit_seed must re-dress the person")
|
||||
|
||||
def test_no_view_voices_a_contradiction(self):
|
||||
# Every lock this node adds must agree with what it keeps: the engine reports
|
||||
# a lock it had to keep against a rule, and no view may produce one.
|
||||
handler = _Conflicts()
|
||||
root = logging.getLogger()
|
||||
old_level = root.level
|
||||
root.addHandler(handler)
|
||||
root.setLevel(logging.INFO)
|
||||
try:
|
||||
for seed in range(25):
|
||||
document = _forge(seed)
|
||||
handler.messages.clear()
|
||||
for backdrop in ("Grey studio backdrop", "Keep the character's scene"):
|
||||
resolve_outfit_sheet(document, "Every style (15)", backdrop,
|
||||
"Full body", _POSE)
|
||||
self.assertEqual(handler.messages, [], f"seed {seed}")
|
||||
finally:
|
||||
root.removeHandler(handler)
|
||||
root.setLevel(old_level)
|
||||
|
||||
def test_a_cosplayer_wears_their_costume(self):
|
||||
kwargs = {spec.id: getattr(spec, "default", None)
|
||||
for spec in IdentityForgeCosplayer.define_schema().inputs}
|
||||
kwargs.update(character="Grimace", seed=7, upstream="")
|
||||
document = _forge(7, IdentityForgeCosplayer.execute(**kwargs).args[0])
|
||||
prompts, labels = resolve_outfit_sheet(
|
||||
document, "Range (6)", "Grey studio backdrop", "Full body", _POSE)
|
||||
self.assertEqual(labels, ["1-as-resolved"])
|
||||
self.assertEqual(len(prompts), 1)
|
||||
|
||||
def test_malformed_input_degrades_to_one_view(self):
|
||||
prompts, labels = resolve_outfit_sheet(
|
||||
"not json", "Range (6)", "Grey studio backdrop", "Full body", _POSE)
|
||||
self.assertEqual((len(prompts), labels), (1, ["1-as-resolved"]))
|
||||
self.assertTrue(json.dumps(prompts))
|
||||
|
||||
|
||||
class SchemaTests(unittest.TestCase):
|
||||
def test_outputs_are_lists(self):
|
||||
schema = IdentityForgeOutfitSheet.define_schema()
|
||||
self.assertEqual(schema.node_id, "IdentityForgeOutfitSheet")
|
||||
self.assertEqual(schema.category, "conditioning/character")
|
||||
self.assertTrue(all(output.is_output_list for output in schema.outputs))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -105,13 +105,31 @@ class RehashTests(unittest.TestCase):
|
||||
self.assertEqual(render_gallery.main(["--rehash", "--kind", kind]), 0)
|
||||
result = render_gallery.survey((kind,))[kind]
|
||||
self.assertEqual(result["stale"], [])
|
||||
self.assertEqual(result["unpublished"], [names[1]])
|
||||
# Other tiles may be legitimately unpublished on a release branch.
|
||||
self.assertIn(names[1], result["unpublished"])
|
||||
self.assertNotIn(names[0], result["unpublished"])
|
||||
self.assertIs(saved["m"], manifest)
|
||||
finally:
|
||||
render_gallery.load_manifest = original_load
|
||||
render_gallery.save_manifest = original_save
|
||||
|
||||
|
||||
class PublishPendingDryRunTests(unittest.TestCase):
|
||||
def test_dry_run_publishes_nothing(self) -> None:
|
||||
# 2.3.0: --publish-pending ignored --dry-run and pushed to gh-pages.
|
||||
original_survey, original_publish = render_gallery.survey, render_gallery.publish_kind
|
||||
render_gallery.survey = lambda kinds: {k: {"unpublished": ["X"]} for k in kinds}
|
||||
render_gallery.publish_kind = lambda *a: self.fail("dry run must not publish")
|
||||
try:
|
||||
buffer = io.StringIO()
|
||||
with redirect_stdout(buffer):
|
||||
code = render_gallery.main(["--publish-pending", "--dry-run"])
|
||||
self.assertEqual(code, 0)
|
||||
self.assertIn("would publish X", buffer.getvalue())
|
||||
finally:
|
||||
render_gallery.survey, render_gallery.publish_kind = original_survey, original_publish
|
||||
|
||||
|
||||
class EntryHashTests(unittest.TestCase):
|
||||
def test_hash_is_stable_across_calls(self) -> None:
|
||||
first = render_gallery.entry_hash("cosplay", "2B")
|
||||
@@ -155,16 +173,34 @@ class EntryHashTests(unittest.TestCase):
|
||||
|
||||
def test_a_rerolled_tile_hashes_its_own_seed(self) -> None:
|
||||
name = "2B"
|
||||
record = {"seed": render_gallery.entry_seed(name, 3)}
|
||||
self.assertEqual(render_gallery.record_reroll(name, record), 3)
|
||||
self.assertEqual(render_gallery.record_reroll(name, {}), 0)
|
||||
record = {"seed": render_gallery.entry_seed("cosplay", name, 3)}
|
||||
self.assertEqual(render_gallery.record_reroll("cosplay", name, record), 3)
|
||||
self.assertEqual(render_gallery.record_reroll("cosplay", name, {}), 0)
|
||||
|
||||
def test_a_people_sample_uses_its_own_seed_on_a_stock_node(self) -> None:
|
||||
# 2.7.0: a card names its seed and gender, and that pair alone must
|
||||
# reproduce the prompt on a fresh node: no preset node, no gallery pins.
|
||||
from nodes.identity_forge import IdentityForge
|
||||
|
||||
seeds = [(s["seed"], s["widgets"]["gender"]) for s in render_gallery.PEOPLE.values()]
|
||||
self.assertEqual(len(seeds), len(set(seeds)), "two samples share a seed")
|
||||
name, sample = next(iter(render_gallery.PEOPLE.items()))
|
||||
self.assertEqual(render_gallery.entry_seed("people", name, 2), sample["seed"] + 2)
|
||||
stock = {s.id: s.default for s in IdentityForge.define_schema().inputs
|
||||
if hasattr(s, "default")}
|
||||
stock.update(seed=sample["seed"], archetype_json="", **sample["widgets"])
|
||||
prose = IdentityForge.execute(**stock).args[0]
|
||||
self.assertEqual(render_gallery.resolve_prose("people", name), prose)
|
||||
card = render_gallery.people_card(name)
|
||||
self.assertEqual(card["prompt"], prose)
|
||||
self.assertIn(f"seed {sample['seed']}", card["settings"])
|
||||
|
||||
def test_seed_is_deterministic_and_matches_the_recorded_formula(self) -> None:
|
||||
import hashlib
|
||||
|
||||
name = "Jack Skellington"
|
||||
expected = int(hashlib.sha256(name.encode("utf-8")).hexdigest()[:15], 16)
|
||||
self.assertEqual(render_gallery.entry_seed(name), expected)
|
||||
self.assertEqual(render_gallery.entry_seed("cosplay", name), expected)
|
||||
self.assertEqual(
|
||||
render_gallery.load_manifest()["seed_formula"],
|
||||
render_gallery.SEED_FORMULA,
|
||||
@@ -196,14 +232,24 @@ class GalleryShotPoolTests(unittest.TestCase):
|
||||
|
||||
def test_pose_pins_name_real_poses_and_entries(self) -> None:
|
||||
from data.cosplayers import COSPLAYERS
|
||||
from data.creatures import CREATURES
|
||||
from data.fields import POSE_FAMILIES
|
||||
poses = {v for fam in POSE_FAMILIES.values() for v in fam["variants"]}
|
||||
roster = {"cosplay": COSPLAYERS, "creatures": CREATURES}
|
||||
for kind, pins in render_gallery._GALLERY_POSE.items():
|
||||
self.assertEqual(kind, "cosplay")
|
||||
self.assertIn(kind, roster)
|
||||
for name, pose in pins.items():
|
||||
self.assertIn(name, COSPLAYERS)
|
||||
self.assertIn(name, roster[kind])
|
||||
self.assertIn(pose, poses, name)
|
||||
|
||||
def test_lock_level_pins_name_real_archetypes_and_levels(self) -> None:
|
||||
from data.templates import ARCHETYPES
|
||||
from nodes.identity_forge_archetype import IdentityForgeArchetype
|
||||
spec = {i.id: i for i in IdentityForgeArchetype.define_schema().inputs}
|
||||
for name, level in render_gallery._GALLERY_LOCK_LEVEL.items():
|
||||
self.assertIn(name, ARCHETYPES)
|
||||
self.assertIn(level, spec["lock_level"].options, name)
|
||||
|
||||
def test_shot_pins_name_real_entries_and_gallery_shots(self) -> None:
|
||||
from data.templates import ARCHETYPES
|
||||
for kind, pins in render_gallery._GALLERY_SHOT.items():
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
"""Scene Sheet (2.6.0): one resolved character, a row of places."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from data.constraints import lock_clash
|
||||
from nodes import identity_forge_scene_sheet as scene
|
||||
from nodes.identity_forge import FIELD_DEFINITIONS, run_identity_forge
|
||||
from nodes.identity_forge_turnaround import _forge_class, _unwrap, document_fields, parse_document
|
||||
|
||||
_FACE = {name for name, field in FIELD_DEFINITIONS.items() if field.get("group") == "Face"}
|
||||
|
||||
|
||||
class _Spy:
|
||||
"""Records the resolved document of every view the sheet renders."""
|
||||
|
||||
def __init__(self):
|
||||
self.forge = _forge_class()
|
||||
self.views: "list[tuple[str | None, dict]]" = []
|
||||
|
||||
def execute(self, **kwargs):
|
||||
out = self.forge.execute(**kwargs)
|
||||
self.views.append((kwargs.get("location"),
|
||||
document_fields(parse_document(_unwrap(out)[1]))))
|
||||
return out
|
||||
|
||||
|
||||
def _run(document, sheet="Everyday (6)", clothes=scene._DRESS):
|
||||
spy = _Spy()
|
||||
with mock.patch.object(scene, "_forge_class", lambda: spy):
|
||||
prompts, labels = scene.resolve_scene_sheet(
|
||||
document, sheet, "Cowboy (mid-thigh up)", clothes)
|
||||
return prompts, labels, spy.views
|
||||
|
||||
|
||||
class SceneSheetTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
logging.disable(logging.WARNING)
|
||||
cls.characters = [run_identity_forge({"seed": seed})[1] for seed in range(8)]
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
logging.disable(logging.NOTSET)
|
||||
|
||||
def _assert_coherent(self, views):
|
||||
for place, fields in views:
|
||||
self.assertEqual(fields["location"], place)
|
||||
for name, value in fields.items():
|
||||
if name != "location":
|
||||
self.assertFalse(lock_clash("location", place, {name: value}),
|
||||
f"{place} vs {name}={value}")
|
||||
|
||||
def test_dress_for_each_place(self):
|
||||
for document in self.characters:
|
||||
prompts, labels, views = _run(document)
|
||||
self.assertEqual(len(prompts), len(scene._SHEETS["Everyday (6)"]))
|
||||
self.assertEqual(labels[0], "1-sunny-city-park")
|
||||
self._assert_coherent(views)
|
||||
self.assertEqual(len({f.get("outfit_description") for _, f in views}), len(views))
|
||||
original = document_fields(parse_document(document))
|
||||
for _, fields in views:
|
||||
self.assertEqual({k: fields.get(k) for k in _FACE},
|
||||
{k: original.get(k) for k in _FACE})
|
||||
|
||||
def test_keep_the_outfit_skips_places_that_refuse_it(self):
|
||||
skipped = 0
|
||||
for document in self.characters:
|
||||
outfit = document_fields(parse_document(document))["outfit_description"]
|
||||
prompts, _, views = _run(document, clothes=scene._KEEP_OUTFIT)
|
||||
if views and views[0][0] is not None:
|
||||
self._assert_coherent(views)
|
||||
self.assertEqual({f["outfit_description"] for _, f in views}, {outfit})
|
||||
skipped += len(scene._SHEETS["Everyday (6)"]) - len(prompts)
|
||||
self.assertGreater(skipped, 0, "no place refused any kept outfit")
|
||||
|
||||
def test_a_cosplayer_keeps_the_costume(self):
|
||||
doc = json.loads(self.characters[0])
|
||||
doc["_meta"]["cosplay_of"] = "Test Hero"
|
||||
outfit = document_fields(doc)["outfit_description"]
|
||||
_, _, views = _run(json.dumps(doc))
|
||||
self.assertTrue(views)
|
||||
for place, fields in views:
|
||||
if place is not None:
|
||||
self.assertEqual(fields["outfit_description"], outfit)
|
||||
|
||||
def test_malformed_input_emits_one_view(self):
|
||||
prompts, labels, _ = _run("not json")
|
||||
self.assertEqual(labels, ["1-as-resolved"])
|
||||
self.assertEqual(len(prompts), 1)
|
||||
|
||||
def test_every_sheet_names_real_places(self):
|
||||
pool = set(FIELD_DEFINITIONS["location"]["female_options"])
|
||||
for name, places in scene._SHEETS.items():
|
||||
self.assertTrue(set(places) <= pool, name)
|
||||
self.assertIn(f"({len(places)})", name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,90 @@
|
||||
"""2.6.0: a sheet that pins a framing releases what the framing refuses.
|
||||
|
||||
Before 2.6.0 the Expression Sheet pinned a close-up and kept "standing with arms crossed",
|
||||
and the one-view paths of the Age Progression and Outfit Sheet did the same. Every path
|
||||
now goes through ``pin_framing``.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
from data.constraints import lock_clash
|
||||
from nodes.identity_forge import run_identity_forge
|
||||
from nodes.identity_forge_age_progression import resolve_age_progression
|
||||
from nodes.identity_forge_expression_sheet import resolve_expression_sheet
|
||||
from nodes.identity_forge_outfit_sheet import resolve_outfit_sheet
|
||||
from nodes.identity_forge_turnaround import _FRAMINGS, document_fields, parse_document
|
||||
|
||||
_CLOSE_UP = "Head and shoulders"
|
||||
|
||||
|
||||
def _clashing_characters(count: int):
|
||||
"""Documents whose own values include something a close-up refuses."""
|
||||
framing = _FRAMINGS[_CLOSE_UP]
|
||||
found = []
|
||||
for seed in range(200):
|
||||
_, document, _ = run_identity_forge({"seed": seed, "shot_type": "full body shot"})
|
||||
fields = document_fields(parse_document(document))
|
||||
refused = {value for name, value in fields.items()
|
||||
if lock_clash("shot_type", framing, {name: value})}
|
||||
if refused:
|
||||
found.append((seed, document, refused))
|
||||
if len(found) == count:
|
||||
return found
|
||||
raise AssertionError("no seed draws a value a close-up refuses")
|
||||
|
||||
|
||||
def _with_meta(document: str, **meta) -> str:
|
||||
doc = json.loads(document)
|
||||
doc["_meta"].update(meta)
|
||||
return json.dumps(doc)
|
||||
|
||||
|
||||
class SheetFramingTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
logging.disable(logging.WARNING)
|
||||
cls.characters = _clashing_characters(6)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
logging.disable(logging.NOTSET)
|
||||
|
||||
def _assert_released(self, prompts, refused, seed):
|
||||
for prompt in prompts:
|
||||
for value in refused:
|
||||
self.assertNotIn(value, prompt, f"seed {seed}")
|
||||
|
||||
def test_expression_sheet(self):
|
||||
for seed, document, refused in self.characters:
|
||||
prompts, _ = resolve_expression_sheet(document, "Smiles (3)", _CLOSE_UP)
|
||||
self._assert_released(prompts, refused, seed)
|
||||
|
||||
def test_age_progression_one_view_path(self):
|
||||
for seed, document, refused in self.characters:
|
||||
prompts, labels = resolve_age_progression(
|
||||
_with_meta(document, covers_face=True), "Life stages (4)", _CLOSE_UP)
|
||||
self.assertEqual(labels, ["1-as-resolved"])
|
||||
self._assert_released(prompts, refused, seed)
|
||||
|
||||
def test_outfit_sheet_one_view_path(self):
|
||||
for seed, document, refused in self.characters:
|
||||
prompts, labels = resolve_outfit_sheet(
|
||||
_with_meta(document, covers_body=True), "Range (6)",
|
||||
"Keep the character's scene", _CLOSE_UP, "Keep the character's pose")
|
||||
self.assertEqual(labels, ["1-as-resolved"])
|
||||
self._assert_released(prompts, refused, seed)
|
||||
|
||||
def test_released_pose_differs_between_characters(self):
|
||||
# The replacement is drawn per character, not from one shared replay seed.
|
||||
poses = set()
|
||||
for _, document, _ in self.characters:
|
||||
prompts, _ = resolve_expression_sheet(document, "Smiles (3)", _CLOSE_UP)
|
||||
poses.add(prompts[0].split(". Set in")[0][-80:])
|
||||
self.assertGreater(len(poses), 1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -452,16 +452,11 @@ class SchemaShapeTests(unittest.TestCase):
|
||||
"only 'pose' may share a name with an IdentityForge input")
|
||||
|
||||
def test_no_widget_auto_advances(self):
|
||||
# The corollary of having no fingerprint_inputs: this node is a pure
|
||||
# function, so ComfyUI's normal caching is correct. A widget with
|
||||
# control_after_generate would reintroduce ComfyUI#11905 and need the
|
||||
# NaN signature back (architecture.md -> "Seeded nodes re-roll every queue").
|
||||
for spec in self.schema.inputs:
|
||||
self.assertIsNone(getattr(spec, "control_after_generate", None), spec.id)
|
||||
# `vars`, not `hasattr`: the real comfy_api's ComfyNode base declares
|
||||
# fingerprint_inputs (raising NotImplementedError), so hasattr is True on
|
||||
# every node and would assert nothing. The stub declares no such method,
|
||||
# which is exactly how a hasattr check passes here and fails in ComfyUI.
|
||||
# every node. The test stub also declares the base method.
|
||||
self.assertNotIn("fingerprint_inputs", vars(IdentityForgeTurnaround))
|
||||
|
||||
def test_character_json_is_a_required_socket_not_a_multiline_box(self):
|
||||
|
||||
@@ -76,6 +76,12 @@ class SanitizeTests(unittest.TestCase):
|
||||
def test_collapses_whitespace_and_trims_dots(self):
|
||||
self.assertEqual(sanitize_name(" hi there.. "), "hi there")
|
||||
|
||||
def test_length_cap_never_leaves_a_trailing_dot(self):
|
||||
# 2.6.0: a cut landing just after a dot kept it; Windows then drops it from
|
||||
# the folder name, so the saved folder and the returned name differed.
|
||||
name = sanitize_name("a" * 119 + ".b")
|
||||
self.assertEqual(name, "a" * 119)
|
||||
|
||||
def test_rejects_traversal_and_empty(self):
|
||||
self.assertEqual(sanitize_name(".."), "")
|
||||
self.assertEqual(sanitize_name("///"), "")
|
||||
@@ -256,6 +262,15 @@ class RoundTripTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
rename_character(self.root, "ghost", "C")
|
||||
|
||||
def test_case_only_rename(self):
|
||||
# 2.6.0: on a case-insensitive filesystem "bob" and "Bob" resolve to one
|
||||
# folder, and the rename reported success without changing anything.
|
||||
save_character(self.root, "bob", SAMPLE_JSON)
|
||||
self.assertEqual(rename_character(self.root, "bob", "Bob"), "Bob")
|
||||
self.assertEqual(list_character_names(self.root), ["Bob"])
|
||||
meta = json.loads((self.root / "Bob" / "meta.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual(meta["display_name"], "Bob")
|
||||
|
||||
|
||||
|
||||
class VaultRecallControlDeferralTests(unittest.TestCase):
|
||||
@@ -399,6 +414,17 @@ class FingerprintTests(unittest.TestCase):
|
||||
_NO_FINGERPRINT)
|
||||
self.assertEqual(_character_fingerprint(self.root, "ghost"), _NO_FINGERPRINT)
|
||||
|
||||
def test_random_pick_is_seeded_and_lands_on_a_saved_entry(self):
|
||||
from nodes.identity_forge_vault_load import _NO_CHARACTERS, _RANDOM, resolve_selection
|
||||
self.assertEqual(resolve_selection(self.root, "X", 5), "X")
|
||||
for name in ("X", "Y", "Z"):
|
||||
save_character(self.root, name, SAMPLE_JSON)
|
||||
picks = {resolve_selection(self.root, _RANDOM, seed) for seed in range(40)}
|
||||
self.assertEqual(picks, set(list_character_names(self.root)))
|
||||
self.assertEqual(resolve_selection(self.root, _RANDOM, 7),
|
||||
resolve_selection(self.root, _RANDOM, 7))
|
||||
self.assertEqual(resolve_selection(self.root / "empty", _RANDOM, 7), _NO_CHARACTERS)
|
||||
|
||||
def test_unchanged_file_gives_the_same_fingerprint(self):
|
||||
save_character(self.root, "X", SAMPLE_JSON)
|
||||
self.assertEqual(_character_fingerprint(self.root, "X"),
|
||||
@@ -421,5 +447,21 @@ class FingerprintTests(unittest.TestCase):
|
||||
self.assertEqual(after, _NO_FINGERPRINT)
|
||||
|
||||
|
||||
class StaleSelectionTests(unittest.TestCase):
|
||||
"""2.8.0: a name this vault does not hold must reach execute(), not fail validation."""
|
||||
|
||||
def test_validate_inputs_names_character_and_accepts_anything(self):
|
||||
import inspect
|
||||
|
||||
from nodes import identity_forge_vault_load as vault_load
|
||||
node = getattr(vault_load, "IdentityForgeVaultLoad", None)
|
||||
if node is None:
|
||||
self.skipTest("comfy_api stub not registered")
|
||||
# ComfyUI skips its combo check only for inputs validate_inputs names.
|
||||
self.assertIn("character", inspect.getfullargspec(node.validate_inputs).args)
|
||||
for stale in ("deleted long ago", "(no characters saved)", "(random saved character)"):
|
||||
self.assertIs(node.validate_inputs(character=stale), True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
+41
-1
@@ -947,7 +947,7 @@ def validate() -> list[str]:
|
||||
# field engine), so only structure is checked here, not value membership.
|
||||
if len(CREATURES) < 40:
|
||||
errors.append(f"CREATURES has {len(CREATURES)}; need >= 40")
|
||||
allowed_keys = {"class", "palette", "palette_pool"} | set(CREATURE_SLOTS)
|
||||
allowed_keys = {"class", "palette", "palette_pool", "anthro"} | set(CREATURE_SLOTS)
|
||||
class_counts = {cls: 0 for cls in CREATURE_CLASSES}
|
||||
for name, entry in CREATURES.items():
|
||||
if not isinstance(entry, dict):
|
||||
@@ -969,6 +969,17 @@ def validate() -> list[str]:
|
||||
isinstance(v, str) and v for v in value
|
||||
):
|
||||
errors.append(f"creature '{name}': 'palette_pool' must be a non-empty list of strings")
|
||||
elif key == "anthro":
|
||||
# Anthropomorphic-form rewrites: slot -> text ("" drops it), plus an
|
||||
# optional lead noun.
|
||||
if not isinstance(value, dict) or not value:
|
||||
errors.append(f"creature '{name}': 'anthro' must be a non-empty dict")
|
||||
continue
|
||||
for sub, text in value.items():
|
||||
if sub not in set(CREATURE_SLOTS) | {"subject"}:
|
||||
errors.append(f"creature '{name}': anthro key {sub!r} is not a slot")
|
||||
elif not isinstance(text, str) or (sub == "subject" and not text):
|
||||
errors.append(f"creature '{name}': anthro {sub!r} must be a string")
|
||||
elif value is not None and (not isinstance(value, str) or not value):
|
||||
errors.append(f"creature '{name}': slot {key!r} must be a non-empty string")
|
||||
thin = [cls for cls, count in class_counts.items() if count < 3]
|
||||
@@ -997,9 +1008,38 @@ def validate() -> list[str]:
|
||||
if band not in SKIN_TONE_BANDS:
|
||||
errors.append(f"ETHNICITY_REGION['{ethnicity}']: unknown band {band!r}")
|
||||
|
||||
# --- no tobacco or drugs anywhere in the prose (maintainer's standing rule) ---
|
||||
for where, data in (("COSPLAYERS", COSPLAYERS), ("ARCHETYPES", ARCHETYPES),
|
||||
("CREATURES", CREATURES), ("COSTUME_SLOTS", COSTUME_SLOTS),
|
||||
("OUTFIT_DESCRIPTIONS", OUTFIT_DESCRIPTIONS),
|
||||
("FIELD_DEFINITIONS", FIELD_DEFINITIONS)):
|
||||
for path, text in _strings(data, where):
|
||||
hit = _SMOKING_RE.search(text)
|
||||
if hit:
|
||||
errors.append(f"{path}: names {hit.group(0)!r} - no tobacco or drug items")
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
#: Tobacco and drug items. "cigarette trousers/pants" is a garment cut, not a cigarette.
|
||||
_SMOKING_RE = re.compile(
|
||||
r"\b(?:cigars?|cigarillos?|cheroots?|cigarettes?(?! (?:trousers|pants|jeans|skirts?))|"
|
||||
r"tobacco|vapes?|vaping|hookahs?|bongs?|marijuana|cannabis|opium|narcotics?|"
|
||||
r"(?:corncob|calabash|briar|clay|tobacco|smoking) pipes?)\b", re.IGNORECASE)
|
||||
|
||||
|
||||
def _strings(value, path: str):
|
||||
"""Yield (path, text) for every string nested in dicts, lists and tuples."""
|
||||
if isinstance(value, str):
|
||||
yield path, value
|
||||
elif isinstance(value, dict):
|
||||
for key, item in value.items():
|
||||
yield from _strings(item, f"{path}[{key!r}]")
|
||||
elif isinstance(value, (list, tuple)):
|
||||
for item in value:
|
||||
yield from _strings(item, path)
|
||||
|
||||
|
||||
def _archetype_lock_clashes() -> list[str]:
|
||||
"""1.5.1: no archetype may lock a pair the engine's own rules forbid.
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"_comment_archetypes": "'archetypes' adds presets to the Archetype node. Same {field: value} shape as the built-ins; outfit_description may use {slot} placeholders (color, fabric, metal, gem, fur, flower, ...). A name matching a built-in overrides it. A custom value used here (like Sky Pirate's expression/location below) should also be listed under 'fields' above so it becomes a real option. Run 'python tests/validate_data.py' to check your field values.",
|
||||
"_comment_archetypes": "'archetypes' adds presets to the Archetype node. Same {field: value} shape as the built-ins: a value may be a list (one is picked per seed), and a 'variants' object gives separate 'Female' / 'Male' looks; outfit_description may use {slot} placeholders (color, fabric, metal, gem, fur, flower, ...). A name matching a built-in overrides it. A custom value used here (like Sky Pirate's expression/location below) should also be listed under 'fields' above so it becomes a real option. Run 'python tests/validate_data.py' to check your field values.",
|
||||
"archetypes": {
|
||||
"Sky Pirate": {
|
||||
"gender": "Female",
|
||||
@@ -59,11 +59,17 @@
|
||||
"_comment_mask": "For a fully masked head set 'covers_face': true AND put the head covering in a separate 'mask' string (kept OUT of 'costume'). covers_face hides the randomized face/hair; the mask is appended to the costume by default but kept apart so the node's 'Unmask (show face)' toggle can drop it and reveal the random head. Omit both when the face is visible.",
|
||||
"_comment_required": "Only 'costume' is required in a cosplayer entry. Everything else is optional \u2014 copy an example below, rename it, and keep just the keys you need.",
|
||||
"_comment_advanced": "Optional advanced flags (all default off; only add one when it is true): 'covers_body': true = a full hard suit/armor hides bare skin, so jewelry/nails are suppressed. 'covers_hair': true = a hood/cowl hides the hair while the face shows. 'bald': true = fully hairless head (also clears facial hair). 'body_paint': true = the skin itself is the costume color; optionally add 'skin': 'warm green' to name the color when it is not obvious from the costume text. Word a full-body color as the character's own skin ('smooth, flawless deep green skin') rather than 'body paint' or 'dye' -- paint wording renders as a streaky coat over a human tone; the skin-native wording is auto-detected, so the flag is only needed for other phrasings.",
|
||||
"_comment_alternates": "Optional per-cosplayer extras: 'costumes' is a list of alternate looks (a costume string, or an object with its own 'costume' plus per-look keys such as 'mask' or 'signature'); one look is picked per seed. 'costume_weights' gives one positive number per look, the main costume first. 'costume_back' is the costume seen from behind, used by the Turnaround's back views. 'subject' is a lead noun for a non-human head, with no article ('pig-headed alien').",
|
||||
"cosplayers": {
|
||||
"Custom Hero (My OC)": {
|
||||
"franchise": "Original",
|
||||
"gender": "Female",
|
||||
"costume": "a teal-and-silver bodysuit with a star emblem, white gloves, and white boots",
|
||||
"costume_back": "a teal-and-silver bodysuit with a silver stripe down the spine, white gloves, and white boots",
|
||||
"costumes": [
|
||||
"a black-and-gold stealth bodysuit with a dim star emblem, black gloves, and black boots"
|
||||
],
|
||||
"costume_weights": [3, 1],
|
||||
"signature": {
|
||||
"hair_color": "electric blue",
|
||||
"hair_length": "long",
|
||||
|
||||
Reference in New Issue
Block a user