Download scene_builder_nodes.py from Crocody/mymuse: direct link, hf CLI and curl.
- Browser
- Download file 35.8 kB
-
https://huggingface.co/datasets/Crocody/mymuse/resolve/main/scene_builder_nodes.py
- Command line
-
hf download hf://datasets/Crocody/mymuse/scene_builder_nodes.py
-
curl -L -o scene_builder_nodes.py https://huggingface.co/datasets/Crocody/mymuse/resolve/main/scene_builder_nodes.py
35.8 kB
| """ | |
| ์ฌ ๋น๋ ๋ ธ๋ ์์คํ (ComfyUI Custom Nodes) - ์ ํ์ง(๋๋กญ๋ค์ด) ๋ฒ์ | |
| ์ค์น: ์ด ํ์ผ์ ComfyUI/custom_nodes/ ํด๋์ ๋ฃ๊ณ ComfyUI๋ฅผ ์ฌ์์. | |
| ๋ฉ๋ด: ์ฐํด๋ฆญ > Add Node > SceneBuilder | |
| ๋ ธ๋ ๊ตฌ์ฑ (๋ฐฐ๊ฒฝ๊ณผ ๋ฐฐ๊ฒฝ ์ํ์ ํ๋๋ก ํตํฉ๋จ): | |
| [์ถ์ฒ] Scene Builder (All-in-One) : ๋ ธ๋ ํ๋์์ ๋ชจ๋ ์์๋ฅผ ๋๋กญ๋ค์ด์ผ๋ก ๊ณ ๋ฅด๊ณ ๋ฐ๋ก ์ต์ข ํ๋กฌํํธ ์ถ๋ ฅ | |
| [๋ถ๋ฆฌํ] Node 1 Shot_Angle / 2a Gender / 2b Age_Range / 2c Nationality / 3 Placement_Pose / | |
| 4 Clothing_Material / 5a Hair_Color / 5b Hair_Style / 5c Expression_Action(ํ์ +์์ +ํ๋) / | |
| 6 Environment_Background(๋ฐฐ๊ฒฝ+์ํ) / 7 Local_Lighting / 8 Atmospheric_Mood | |
| -> Node 9 Scene Aggregator | |
| ๊ฐ ํญ๋ชฉ์ ์ ํ ๋ฐฉ์: | |
| - ๋ชฉ๋ก์์ ์ง์ ๊ณ ๋ฅด๊ธฐ (๊ธฐ๋ณธ๊ฐ์ ๊ธฐํ์ ์์) | |
| - (random) : seed ๊ฐ์ ๋ฐ๋ผ ๋ฌด์์ ์ ํ. seed๊ฐ fixed๋ฉด ์ฌํ, randomize๋ฉด ํ๋ง๋ค ์๋ก ๋ฝํ | |
| - (none) : ํด๋น ์์๋ฅผ ์๋ต | |
| - custom_override / override_... : ์ง์ ์ด ๋ด์ฉ(๋๋ ์ฐ๊ฒฐํ STRING)์ด ์ฐ์ ์ ์ฉ | |
| ์ธ๋ฌผ ๋ฌธ์ฅ์ [๊ด์ฌ + young + ๊ตญ์ + ์ฑ๋ณ + in his/her + ๋์ด๋]๋ก, ๋จธ๋ฆฌ๋ [her + ๋จธ๋ฆฌ์ + hair + ํค์ด์คํ์ผ]๋ก ์กฐ๋ฆฝ๋ฉ๋๋ค. | |
| ์ฑ๋ณ ์๋ ๋์: ๋ฌธ์ฅ ์ {their} {them} {they} {s}(๋์ฌ s)๋ ์ฑ๋ณ์ ๋ง๊ฒ her/his, she/he ๋ฑ์ผ๋ก ์นํ๋ฉ๋๋ค. | |
| ์ ํ์ง ์ถ๊ฐ ๋ฐฉ๋ฒ: ์๋ ๋ฐ์ดํฐ ๋ชฉ๋ก์ ๋ฌธ์์ด ํ ์ค์ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค. ๊ฐ ๋ชฉ๋ก์ ์ฒซ ํญ๋ชฉ์ด ๊ธฐ๋ณธ๊ฐ์ ๋๋ค. | |
| ๋ฐฐ๊ฒฝ์ BACKGROUNDS์ (์ด๋ฆ, ๋ฐฐ๊ฒฝ ๋ฌธ์ฅ, [์ํ ๋ฌธ์ฅ๋ค]) ํ ๋ฌถ์์ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค. | |
| """ | |
| import random | |
| import re | |
| CATEGORY = "SceneBuilder" | |
| NONE = "(none)" | |
| RANDOM = "(random)" | |
| # ===================================================================== | |
| # ์ ํ์ง ๋ฐ์ดํฐ | |
| # ===================================================================== | |
| # ---- ๋ ธ๋ 1: ํ๊ฐ ๋ฐ ์นด๋ฉ๋ผ ๋๋์ด ---- | |
| SHOT_ANGLE = [ | |
| "A medium shot at eye level of", | |
| "A close-up shot at eye level of", | |
| "A medium close-up shot at eye level of", | |
| "An extreme close-up shot at eye level of", | |
| "A close-up portrait at eye level of", | |
| "A waist-up shot at eye level of", | |
| "A cowboy shot, framed from mid-thigh up at eye level, of", | |
| "A three-quarter shot at eye level of", | |
| "A full-body shot at eye level of", | |
| "A wide shot at eye level of", | |
| "A wide establishing shot at eye level of", | |
| "A medium-wide shot at eye level of", | |
| "A medium shot at chest level of", | |
| "A candid medium shot at eye level of", | |
| "A side-profile medium shot at eye level of", | |
| "A medium shot from behind, at eye level, of", | |
| "A medium shot from a slightly low angle of", | |
| "A medium shot from a slightly high angle of", | |
| "A full-body shot from a low angle of", | |
| "A full-body shot from a slightly high angle of", | |
| "A high-angle shot looking down at", | |
| "A low-angle shot looking up at", | |
| "An over-the-shoulder shot of", | |
| ] | |
| # ---- ๋ ธ๋ 2a: ์ฑ๋ณ ---- | |
| GENDER = [ | |
| "woman", | |
| "man", | |
| ] | |
| # ---- ๋ ธ๋ 2b: ๋์ด๋ (์ฑ์ธ๋ง) ---- | |
| AGE_RANGE = [ | |
| "early twenties", | |
| "mid-twenties", | |
| "late twenties", | |
| "early thirties", | |
| "mid-thirties", | |
| "late thirties", | |
| "early forties", | |
| "mid-forties", | |
| "late forties", | |
| "early fifties", | |
| "mid-fifties", | |
| "late fifties", | |
| "sixties", | |
| "seventies", | |
| ] | |
| # ---- ๋ ธ๋ 2c: ๊ตญ์ /์ถ์ (ํ์ฉ์ฌ ํํ ํ ๋จ์ด) ---- | |
| NATIONALITY = [ | |
| "Korean", | |
| "Japanese", | |
| "Chinese", | |
| "Taiwanese", | |
| "Mongolian", | |
| "Thai", | |
| "Vietnamese", | |
| "Filipino", | |
| "Indonesian", | |
| "Malaysian", | |
| "Indian", | |
| "Pakistani", | |
| "Iranian", | |
| "Turkish", | |
| "Middle Eastern", | |
| "Russian", | |
| "Ukrainian", | |
| "Polish", | |
| "German", | |
| "French", | |
| "Italian", | |
| "Spanish", | |
| "Swedish", | |
| "British", | |
| "Irish", | |
| "European", | |
| "American", | |
| "Canadian", | |
| "Australian", | |
| "Mexican", | |
| "Brazilian", | |
| "Argentinian", | |
| "Latin American", | |
| "Nigerian", | |
| "Ethiopian", | |
| "Kenyan", | |
| "South African", | |
| "Egyptian", | |
| "Moroccan", | |
| "African", | |
| "Korean-American", | |
| "Japanese-American", | |
| "mixed-race", | |
| ] | |
| # ---- ๋ ธ๋ 3: ์์น ๋ฐ ํฌ์ฆ ---- | |
| PLACEMENT_POSE = [ | |
| "standing just inside the open front door of {their} apartment", | |
| "standing in the center of the frame", | |
| "standing slightly off-center, toward the left of the frame", | |
| "standing slightly off-center, toward the right of the frame", | |
| "standing near a window", | |
| "standing in a doorway", | |
| "standing at a kitchen counter", | |
| "standing at a bus stop", | |
| "standing on a rooftop terrace", | |
| "standing on a subway platform", | |
| "standing at the entrance of a convenience store", | |
| "standing on a quiet residential street", | |
| "leaning against a wall", | |
| "leaning on a railing", | |
| "walking along a sidewalk", | |
| "walking down a hallway toward the camera", | |
| "sitting on the edge of a bed", | |
| "sitting on a sofa in the living room", | |
| "sitting at a small wooden cafe table", | |
| "sitting at a desk by the window", | |
| "sitting on a park bench", | |
| "sitting on a set of concrete steps", | |
| "sitting cross-legged on the floor", | |
| "crouching down near the floor", | |
| "kneeling beside a low table", | |
| ] | |
| # ---- ๋ ธ๋ 4: ์์ ๋ฐ ์์ฌ ---- | |
| CLOTHING_MATERIAL = [ | |
| "wearing a simple, sleeveless slip dress in soft beige, the fabric clinging gently to {their} form", | |
| "wearing a plain white cotton t-shirt and light blue denim jeans, the fabric slightly creased", | |
| "wearing an oversized gray knit sweater and black leggings, the wool soft and slightly bulky", | |
| "wearing a fitted black turtleneck and a pleated beige skirt, the fabric hanging neatly", | |
| "wearing a white button-up shirt with the sleeves rolled up and tailored navy trousers", | |
| "wearing a light floral summer dress with thin straps, the cotton fabric flowing loosely", | |
| "wearing a long camel trench coat over a cream blouse, the heavy wool falling past {their} knees", | |
| "wearing a gray hoodie and loose sweatpants, the cotton fleece soft and worn", | |
| "wearing a soft pink cardigan over a white camisole, the knit fabric lightly textured", | |
| "wearing a simple black dress in smooth satin, the fabric catching subtle highlights", | |
| "wearing a denim jacket over a white tee and a knee-length skirt", | |
| "wearing a crisp white oxford shirt and charcoal slacks, the cotton lightly pressed", | |
| "wearing a navy crewneck sweater over a collared shirt and beige chinos", | |
| "wearing a black leather jacket over a plain gray t-shirt and dark jeans", | |
| "wearing a loose linen shirt in off-white and light khaki shorts, the fabric softly wrinkled", | |
| "wearing a tailored dark suit with a white shirt and no tie, the wool smooth and structured", | |
| "wearing a heavy olive-green parka with a fur-lined hood, the nylon shell slightly glossy", | |
| "wearing a plain black t-shirt and dark gray joggers, the fabric soft and matte", | |
| "wearing a striped long-sleeve cotton shirt and faded blue jeans", | |
| "wearing a cream knit vest over a white shirt and brown trousers", | |
| "wearing a navy windbreaker over a hooded sweatshirt and black track pants", | |
| "wearing a loose white pajama set in soft cotton, the fabric slightly rumpled", | |
| "wearing a charcoal wool coat over a ribbed black sweater, the fabric thick and warm", | |
| "wearing a simple white tank top and light-wash denim shorts", | |
| "wearing a mustard-yellow raincoat over a gray sweater, the vinyl surface slightly shiny", | |
| ] | |
| # ---- ๋ ธ๋ 5a: ๋จธ๋ฆฌ์๊น ('{their} ___ hair' ์๋ฆฌ์ ๋ค์ด๊ฐ๋ ํ์ฉ์ฌ) ---- | |
| HAIR_COLOR = [ | |
| "dark", | |
| "black", | |
| "jet-black", | |
| "dark brown", | |
| "chestnut brown", | |
| "light brown", | |
| "golden brown", | |
| "auburn", | |
| "honey blonde", | |
| "golden blonde", | |
| "ash blonde", | |
| "platinum blonde", | |
| "strawberry blonde", | |
| "copper red", | |
| "deep burgundy", | |
| "ash gray", | |
| "silver-gray", | |
| "ash brown", | |
| "soft pink", | |
| "pastel lavender", | |
| ] | |
| # ---- ๋ ธ๋ 5b: ํค์ด์คํ์ผ ('{their} (์) hair ___' ์๋ฆฌ์ ๋ค์ด๊ฐ๋ ๊ตฌ) ---- | |
| HAIR_STYLE = [ | |
| "pulled back", | |
| "falling loosely past {their} shoulders", | |
| "falling straight and long down {their} back", | |
| "parted in the middle and falling straight", | |
| "swept to one side", | |
| "tucked behind {their} ears", | |
| "tied in a loose ponytail", | |
| "tied in a high ponytail", | |
| "tied in a low ponytail at the nape of {their} neck", | |
| "gathered in a low ponytail with a fabric scrunchie", | |
| "pulled into a neat low bun", | |
| "twisted into a messy top bun", | |
| "styled in a sleek high bun", | |
| "twisted up and fastened with a claw clip", | |
| "styled half-up, half-down", | |
| "braided into a single long braid over one shoulder", | |
| "styled in two loose braids", | |
| "styled in a loose fishtail braid", | |
| "tied in low pigtails", | |
| "held back with a thin headband", | |
| "styled in soft waves falling past {their} shoulders", | |
| "styled in loose curls", | |
| "styled in tight natural curls", | |
| "cut in a chin-length bob", | |
| "cut in a sleek, shoulder-length lob", | |
| "cut in a short bob with straight bangs", | |
| "cut in a layered, shoulder-length style", | |
| "styled with wispy see-through bangs framing {their} face", | |
| "cut in a short pixie style", | |
| "cut short and neatly combed", | |
| "cut short and slightly tousled", | |
| "damp and slightly tousled", | |
| ] | |
| # ---- ๋ ธ๋ 5c: ํ์ , ์์ , ํ๋ ---- | |
| EXPRESSION_ACTION = [ | |
| "{their} gaze directed slightly downward as {they} wipe{s} the threshold with a damp cloth", | |
| "{their} gaze directed at the camera with a soft, relaxed smile", | |
| "{their} eyes looking off to the side as {they} adjust{s} a sleeve", | |
| "{their} gaze lowered toward a book held in both hands", | |
| "{their} expression thoughtful as {they} look{s} out the window", | |
| "{their} head turning with a gentle smile", | |
| "{their} eyes closed and a faint smile on {their} lips as {they} take{s} a slow breath", | |
| "{their} gaze fixed on {their} phone screen as {they} scroll{s} with a thumb", | |
| "{their} eyes focused as {they} pour{s} coffee into a cup", | |
| "{their} gaze meeting the camera with a calm, neutral expression", | |
| "{their} gaze steady as {they} look{s} straight into the camera", | |
| "{their} eyes half-open as {they} rub{s} the back of {their} neck", | |
| "{their} expression serious as {they} read{s} a letter", | |
| "{their} gaze lifted toward the ceiling and {their} lips parted as {they} laugh{s} quietly", | |
| "{their} arms crossed loosely and {their} eyes looking toward something just out of frame", | |
| "{their} hands wrapped around a warm mug and {their} gaze resting on the steam rising from it", | |
| "{their} head tilted slightly and {their} brow faintly furrowed as {they} type{s} on a laptop", | |
| "{their} eyes glancing back over {their} shoulder with a small smile", | |
| "{their} hands tying a shoelace and {their} gaze directed down at {their} feet", | |
| "{their} eyes lowered as {they} pat{s} {their} neck with a towel", | |
| "{their} hands resting in {their} pockets and {their} gaze wandering across the street", | |
| "{their} fingers brushing a strand of hair back and {their} expression relaxed and unguarded", | |
| "{their} gaze following something in the distance and {their} mouth set in a quiet, neutral line", | |
| "{their} hands folding a piece of laundry and {their} eyes focused on the fabric", | |
| "{their} gaze meeting the camera with a shy, slightly embarrassed smile", | |
| "{their} brow slightly furrowed in concentration as {they} stir{s} a pot on the stove", | |
| "{their} eyes wide with surprise as {they} open{s} a small package", | |
| "{their} lips pressed together in quiet resolve as {they} tighten{s} a bag strap on {their} shoulder", | |
| ] | |
| # ---- ๋ ธ๋ 6: ํต์ฌ ๋ฐฐ๊ฒฝ + ๋ฐฐ๊ฒฝ ์ํ (ํตํฉ) ---- | |
| # (์ด๋ฆ, ๋ฐฐ๊ฒฝ/๊ฑด์ถ ๊ตฌ์กฐ ๋ฌธ์ฅ, [์ด์ธ๋ฆฌ๋ ์ํ ๋ฌธ์ฅ ๋ณํ๋ค]) | |
| # ๋๋กญ๋ค์ด์๋ '์ด๋ฆ 1', '์ด๋ฆ 2' ... ํํ๋ก ๋์ค๋ฉฐ, ์ ํํ๋ฉด '๋ฐฐ๊ฒฝ ๋ฌธ์ฅ, ์ํ ๋ฌธ์ฅ'์ผ๋ก ํฉ์ณ์ง๋๋ค. | |
| BACKGROUNDS = [ | |
| ( | |
| "Apartment corridor", | |
| "Behind {them}, the exterior corridor of a typical Korean apartment building stretches into the distance", | |
| [ | |
| "lined with identical white doors and gray concrete walls, with a small metal handrail running along the left side", | |
| "with numbered steel doors, a row of shoe racks outside, and a fire extinguisher box on the wall", | |
| "lined with identical doors, small windows with metal bars, and a few potted plants beside the entrances", | |
| ], | |
| ), | |
| ( | |
| "Studio apartment", | |
| "Behind {them}, a small, tidy studio apartment opens up with a single bed and a window", | |
| [ | |
| "furnished with a low wooden table, a folded blanket, and a small potted plant on the windowsill", | |
| "with a neatly made bed, a small desk by the window, and clothes hanging on a rack", | |
| "with a compact kitchenette in the corner, a laundry rack, and a tiny round table", | |
| ], | |
| ), | |
| ( | |
| "Living room", | |
| "Behind {them}, a bright modern living room extends toward a large window", | |
| [ | |
| "with a light wooden floor, a beige sofa, and a few books stacked on a side table", | |
| "with a low glass coffee table, a floor lamp, and a rug in muted tones", | |
| "with a television on a low cabinet, a few potted plants, and sheer curtains at the window", | |
| ], | |
| ), | |
| ( | |
| "Residential street", | |
| "Behind {them}, a quiet residential street in a Korean neighborhood stretches into the distance", | |
| [ | |
| "lined with parked cars, small shop signs without text, and utility poles with overhead cables", | |
| "lined with low-rise buildings, a few potted plants outside the doors, and bicycles leaning against the walls", | |
| "with narrow sidewalks, tangled overhead cables, and a small neighborhood shop with its shutter half open", | |
| ], | |
| ), | |
| ( | |
| "Cafe", | |
| "Behind {them}, a cozy cafe interior fills the space", | |
| [ | |
| "with wooden tables and chairs, a ceramic mug on the counter, and shelves of books along the wall", | |
| "with a long counter, an espresso machine, and pendant lights hanging above small round tables", | |
| "with large windows, potted plants on the sills, and a small wooden stand by the door", | |
| ], | |
| ), | |
| ( | |
| "Alleyway", | |
| "Behind {them}, a narrow alleyway runs between low-rise buildings", | |
| [ | |
| "lined with low brick walls, potted plants beside the doors, and cables running overhead", | |
| "with weathered concrete walls, a few stacked crates, and a metal gas meter box on the wall", | |
| "with tiled doorsteps, a small blue plastic stool, and laundry hanging from a balcony above", | |
| ], | |
| ), | |
| ( | |
| "Kitchen", | |
| "Behind {them}, a compact kitchen runs along the wall", | |
| [ | |
| "with a stainless steel sink, a few ceramic dishes on a rack, and white tiled walls", | |
| "with wooden cabinets, a small rice cooker on the counter, and a kettle on the stove", | |
| "with open shelves of glass jars, a hanging towel, and a small window above the sink", | |
| ], | |
| ), | |
| ( | |
| "Rooftop terrace", | |
| "Behind {them}, a rooftop terrace overlooks the city skyline", | |
| [ | |
| "with a concrete railing, a few folding chairs, and strings of small lights", | |
| "with water tanks, potted plants in plastic containers, and a clothes drying line", | |
| "with a low parapet wall, a metal bench, and distant apartment towers in soft haze", | |
| ], | |
| ), | |
| ( | |
| "Subway platform", | |
| "Behind {them}, a subway platform stretches along the tracks", | |
| [ | |
| "with yellow tactile paving, a row of metal benches, and a blank digital display above", | |
| "with tiled walls, glass safety doors along the platform edge, and fluorescent tube lights overhead", | |
| "with a painted support pillar, a vending machine, and a curved ceiling with exposed ducts", | |
| ], | |
| ), | |
| ( | |
| "Park path", | |
| "Behind {them}, a quiet park path winds through the trees", | |
| [ | |
| "lined with tall trees, wooden benches, and fallen leaves scattered across the ground", | |
| "with a gravel path, a low wooden fence, and dappled shade under the branches", | |
| "with a stone-paved path, a small pond in the distance, and a lamp post beside a bench", | |
| ], | |
| ), | |
| ( | |
| "Convenience store", | |
| "Behind {them}, the interior of a convenience store fills the frame", | |
| [ | |
| "with white shelves stocked with snacks and a refrigerator along the back wall", | |
| "with a checkout counter, a rack of drinks, and bright ceiling panels", | |
| "with narrow aisles of packaged goods, a refrigerated drinks wall, and a small seating counter by the window", | |
| ], | |
| ), | |
| ( | |
| "Apartment stairwell", | |
| "Behind {them}, the stairwell of a Korean apartment building rises", | |
| [ | |
| "with gray concrete steps, a metal handrail, and a small window at the landing", | |
| "with painted walls, a row of mailboxes, and a fire door at the landing", | |
| "with bare concrete stairs, a bicycle stored under the steps, and a ceiling light in a plastic cover", | |
| ], | |
| ), | |
| ( | |
| "Office hallway", | |
| "Behind {them}, a long hallway of an office building recedes into the distance", | |
| [ | |
| "with glass-walled meeting rooms, gray carpet, and a row of identical wooden doors", | |
| "with a water dispenser, a potted plant by the elevator, and recessed ceiling lights", | |
| "with a long carpeted floor, a printer on a small table, and frosted glass partitions", | |
| ], | |
| ), | |
| ( | |
| "Bathroom", | |
| "Behind {them}, a tiled bathroom with a small window is visible", | |
| [ | |
| "with white square tiles, frosted glass in the window, and a folded towel on a rail", | |
| "with a pedestal sink, a round mirror, and a plastic basket of toiletries on a shelf", | |
| "with a glass shower partition, a wooden stool, and condensation on the tiles", | |
| ], | |
| ), | |
| ( | |
| "Bookstore", | |
| "Behind {them}, a bookstore interior fills the frame with tall shelves", | |
| [ | |
| "with wooden shelves packed with books, a ladder on rails, and a reading table near the window", | |
| "with stacked paperbacks on a display table, a hanging lamp, and narrow aisles between the shelves", | |
| "with a cashier desk, a small potted plant, and rows of colorful book spines", | |
| ], | |
| ), | |
| ( | |
| "Open-plan office", | |
| "Behind {them}, an open-plan office with rows of desks stretches back", | |
| [ | |
| "with rows of desks, dual monitors, and ergonomic chairs pushed in", | |
| "with low cubicle partitions, a whiteboard on the wall, and stacks of paper trays", | |
| "with a long window wall, a few potted plants between desks, and a printer in the corner", | |
| ], | |
| ), | |
| ( | |
| "Traditional market", | |
| "Behind {them}, a covered traditional market street stretches into the distance", | |
| [ | |
| "lined with stalls of fresh vegetables in plastic baskets, hanging awnings, and cardboard boxes stacked along the edges", | |
| "with fruit piled on wooden crates, metal shelving, and fluorescent tube lights strung overhead", | |
| "with a corrugated roof overhead, plastic stools, and steaming pots at a small food stall", | |
| ], | |
| ), | |
| ( | |
| "Riverside path", | |
| "Behind {them}, a riverside walking path runs along a concrete embankment", | |
| [ | |
| "with a paved cycling lane, a metal railing, and tall grass along the water's edge", | |
| "with wooden benches facing the river, lamp posts at regular intervals, and a bridge in the distance", | |
| "with concrete steps leading down to the water, a few reeds, and distant apartment towers across the river", | |
| ], | |
| ), | |
| ( | |
| "Bedroom", | |
| "Behind {them}, a small bedroom with a window and a wooden wardrobe fills the space", | |
| [ | |
| "with a neatly made bed, a bedside table, and a folded towel at its foot", | |
| "with a wooden wardrobe, a small desk lamp, and curtains drawn halfway across the window", | |
| "with a floor cushion, a stack of books, and a plush blanket draped over the bed", | |
| ], | |
| ), | |
| ( | |
| "Parking garage", | |
| "Behind {them}, an underground parking garage stretches back", | |
| [ | |
| "with exposed concrete pillars, painted parking lines, and a few parked cars", | |
| "with low ceiling pipes, reflective floor markings, and a yellow safety barrier", | |
| "with rows of parked cars, concrete walls with painted numbers, and fluorescent tube lights", | |
| ], | |
| ), | |
| ( | |
| "Gym", | |
| "Behind {them}, a quiet gym with rows of equipment fills the room", | |
| [ | |
| "with a rack of dumbbells, a mirrored wall, and black rubber flooring", | |
| "with treadmills in a row, a water cooler, and bright overhead lights", | |
| "with weight benches, a pull-up frame, and a stack of folded towels", | |
| ], | |
| ), | |
| ( | |
| "Train carriage", | |
| "Behind {them}, a train carriage interior with rows of seats stretches back", | |
| [ | |
| "with a worn leather seat, an overhead handrail, and a window showing blurred scenery", | |
| "with rows of padded seats, hanging hand straps, and a sliding door at the end of the carriage", | |
| "with a luggage rack above the seats and sunlight flickering through the windows", | |
| ], | |
| ), | |
| ( | |
| "Classroom", | |
| "Behind {them}, a sunlit school-style classroom with rows of desks fills the room", | |
| [ | |
| "with a chalkboard, rows of wooden desks, and sunlight-faded curtains", | |
| "with a teacher's desk, a wall clock, and plastic chairs pushed under the desks", | |
| "with tall windows, a whiteboard, and a shelf of tidy notebooks at the back", | |
| ], | |
| ), | |
| ( | |
| "Hillside neighborhood", | |
| "Behind {them}, a hillside neighborhood of low houses and narrow stairs rises", | |
| [ | |
| "with steep concrete stairs, low tiled roofs, and potted plants along the walls", | |
| "with narrow lanes, hanging laundry, and a view of the city spreading out below", | |
| "with painted brick walls, a handrail along the steps, and a few motorbikes parked by the doors", | |
| ], | |
| ), | |
| ] | |
| # ---- ๋ ธ๋ 7: ํ์ฅ ๋ฌผ๋ฆฌ ๊ด์ ๋ฐ ์กฐ๋ช ---- | |
| LOCAL_LIGHTING = [ | |
| "The scene is lit by soft, diffused daylight from a high window, casting even illumination across the floor and {their} clothing", | |
| "The scene is lit by warm golden-hour sunlight streaming through a window, casting long soft shadows across the floor", | |
| "The scene is lit by soft overcast daylight, producing even, nearly shadowless illumination", | |
| "The scene is lit by soft morning light filtering through sheer curtains, creating a gentle glow", | |
| "The scene is lit by bright midday sunlight, casting crisp shadows on the nearby surfaces", | |
| "The scene is lit by warm lamplight from a bedside lamp, creating gentle pools of amber light", | |
| "The scene is lit by cool fluorescent ceiling lights, casting flat, even illumination", | |
| "The scene is lit by a mix of natural window light and warm interior lighting", | |
| "The scene is lit by dim evening light from street lamps outside, leaving the corners softly shadowed", | |
| "The scene is lit by glowing shop signs and street lights at night, casting colored reflections on nearby surfaces", | |
| "The scene is lit by low late-afternoon sunlight entering from the side, creating warm highlights and long shadows", | |
| "The scene is lit by pale blue dawn light through the window, leaving the room cool and softly lit", | |
| "The scene is lit by overhead warm pendant lights, creating soft circles of light on the surfaces below", | |
| "The scene is lit by dappled sunlight filtering through tree leaves, scattering moving patches of light across the ground", | |
| "The scene is lit by the glow of a laptop screen and a small desk lamp in an otherwise dim room", | |
| "The scene is lit by harsh overhead light from a bare bulb, casting sharp shadows beneath {their} features", | |
| "The scene is lit by flat gray light from a rainy sky outside the window, with a muted, even tone", | |
| "The scene is lit by warm indoor lighting from recessed ceiling lights, evenly illuminating the room", | |
| ] | |
| # ---- ๋ ธ๋ 8: ์ ์์ ๋ฌด๋ ๋ฐ ๋ง๋ฌด๋ฆฌ ---- | |
| ATMOSPHERIC_MOOD = [ | |
| "The mood is quiet and domestic, with no visible text in the scene.", | |
| "The mood is warm and cozy, with no visible text in the scene.", | |
| "The mood is calm and peaceful, with no visible text in the scene.", | |
| "The mood is bright and cheerful, with no visible text in the scene.", | |
| "The mood is serene and contemplative, with no visible text in the scene.", | |
| "The mood is intimate and relaxed, with no visible text in the scene.", | |
| "The mood is nostalgic and gentle, with no visible text in the scene.", | |
| "The mood is melancholic and quiet, with no visible text in the scene.", | |
| "The mood is lonely and still, with no visible text in the scene.", | |
| "The mood is lively and energetic, with no visible text in the scene.", | |
| "The mood is ordinary and unhurried, with no visible text in the scene.", | |
| "The mood is tender and unguarded, with no visible text in the scene.", | |
| "The mood is tense and watchful, with no visible text in the scene.", | |
| "The mood is playful and light, with no visible text in the scene.", | |
| "The mood is wistful and soft, with no visible text in the scene.", | |
| "The mood is focused and quietly determined, with no visible text in the scene.", | |
| "The mood is sleepy and slow, with no visible text in the scene.", | |
| "The mood is crisp and fresh, with no visible text in the scene.", | |
| "The mood is candid and spontaneous, with no visible text in the scene.", | |
| "The mood is still and slightly eerie, with no visible text in the scene.", | |
| ] | |
| # ===================================================================== | |
| # ๋ด๋ถ ์ฒ๋ฆฌ (๋ณดํต ์์ ํ ํ์ ์์) | |
| # ===================================================================== | |
| YOUNG_AGES = {"early twenties", "mid-twenties"} | |
| # ๋ฐฐ๊ฒฝ: ๋๋กญ๋ค์ด ๊ฐ -> ํฉ์ณ์ง ๋ฌธ์ฅ | |
| BACKGROUND_CHOICES = [] | |
| BACKGROUND_TEXT = {} | |
| for _name, _bg, _props in BACKGROUNDS: | |
| for _n, _prop in enumerate(_props, 1): | |
| _label = f"{_name} {_n}" | |
| BACKGROUND_CHOICES.append(_label) | |
| BACKGROUND_TEXT[_label] = f"{_bg}, {_prop}" | |
| # (ํค, ํด๋์ค ์ ๋ฏธ์ฌ, ํ์ ์ด๋ฆ, ํตํฉ ๋ ธ๋ ์ ๋ ฅ ์ด๋ฆ, ์ ํ์ง ๋ชฉ๋ก) | |
| ATOM_SPECS = [ | |
| ("shot", "ShotAngle", "Node 1 - Shot_Angle", "Shot_Angle", SHOT_ANGLE), | |
| ("gender", "Gender", "Node 2a - Gender", "Gender", GENDER), | |
| ("age", "AgeRange", "Node 2b - Age_Range", "Age_Range", AGE_RANGE), | |
| ("nationality", "Nationality", "Node 2c - Nationality", "Nationality", NATIONALITY), | |
| ("pose", "PlacementPose", "Node 3 - Placement_Pose", "Placement_Pose", PLACEMENT_POSE), | |
| ("clothing", "ClothingMaterial", "Node 4 - Clothing_Material", "Clothing_Material", CLOTHING_MATERIAL), | |
| ("hair_color", "HairColor", "Node 5a - Hair_Color", "Hair_Color", HAIR_COLOR), | |
| ("hair_style", "HairStyle", "Node 5b - Hair_Style", "Hair_Style", HAIR_STYLE), | |
| ("expression", "ExpressionAction", "Node 5c - Expression_Action", "Expression_Action", EXPRESSION_ACTION), | |
| ("background", "EnvironmentBackground", "Node 6 - Environment_Background (๋ฐฐ๊ฒฝ+์ํ)", | |
| "Environment_Background", BACKGROUND_CHOICES), | |
| ("lighting", "LocalLighting", "Node 7 - Local_Lighting", "Local_Lighting", LOCAL_LIGHTING), | |
| ("mood", "AtmosphericMood", "Node 8 - Atmospheric_Mood", "Atmospheric_Mood", ATMOSPHERIC_MOOD), | |
| ] | |
| def _norm(text): | |
| """์ค๋ณต ๊ณต๋ฐฑ ์ ๊ฑฐ + ์๋ ๊ณต๋ฐฑ ์ ๊ฑฐ.""" | |
| return re.sub(r"\s+", " ", (text or "")).strip() | |
| def _strip_tail(text): | |
| """๋์ ์ด๋ฏธ ๋ถ์ด ์๋ ๊ตฌ๋์ (, . ;)์ ์ ๊ฑฐํด ์ค๋ณต ๋ถํธ ๋ฐฉ์ง.""" | |
| return _norm(text).rstrip(" ,.;") | |
| def _resolve(key, value): | |
| """๋๋กญ๋ค์ด ๊ฐ์ ์ค์ ๋ฌธ์ฅ์ผ๋ก ๋ณํ (๋ฐฐ๊ฒฝ๋ง ์ด๋ฆ -> ํฉ์ณ์ง ๋ฌธ์ฅ).""" | |
| value = _norm(value) | |
| if key == "background": | |
| return BACKGROUND_TEXT.get(value, value) | |
| return value | |
| _FEMALE = re.compile(r"\b(woman|women|girl|female|lady)\b", re.I) | |
| _MALE = re.compile(r"\b(man|men|boy|male|guy|gentleman)\b", re.I) | |
| def _pronouns(gender_text): | |
| """์ฑ๋ณ ํ ์คํธ์์ ๋๋ช ์ฌ ์ธํธ ํ๋ณ.""" | |
| if _FEMALE.search(gender_text or ""): | |
| return {"their": "her", "them": "her", "they": "she", "s": "s"} | |
| if _MALE.search(gender_text or ""): | |
| return {"their": "his", "them": "him", "they": "he", "s": "s"} | |
| return {"their": "their", "them": "them", "they": "they", "s": ""} | |
| def _fill(text, pron): | |
| for key, val in pron.items(): | |
| text = text.replace("{" + key + "}", val) | |
| return text | |
| def _article(word): | |
| w = word.lower() | |
| if w[:1] in "aeiou" and not w.startswith(("eu", "uni", "uk")): | |
| return "an" | |
| return "a" | |
| def _compose_subject(gender, age, nationality, pron): | |
| """์ฑ๋ณ/๋์ด๋/๊ตญ์ ์ผ๋ก ์ธ๋ฌผ ๋ฌธ๊ตฌ ์กฐ๋ฆฝ.""" | |
| noun = gender or "person" | |
| core = " ".join(x for x in [nationality, noun] if x) | |
| lead = "a young" if age in YOUNG_AGES else _article(core) | |
| text = f"{lead} {core}" | |
| if age: | |
| text += f" in {pron['their']} {age}" | |
| return text | |
| def _assemble(shot, gender, age, nationality, pose, clothing, hair_color, hair_style, | |
| expression, background, lighting, mood): | |
| """์์ ํ ์คํธ๋ฅผ ๊ท์น๋๋ก 1๋จ๋ฝ์ผ๋ก ๊ฒฐํฉ (๋ถ๋ฆฌํ/์ฌ์ธ์ ๊ณต์ฉ).""" | |
| pron = _pronouns(gender) | |
| def clean(text): | |
| return _strip_tail(_fill(text, pron)) | |
| def join(parts, sep): | |
| return sep.join(p for p in parts if p) | |
| subject = _compose_subject(clean(gender), clean(age), clean(nationality), pron) | |
| # ๋ฌธ์ฅ 1: [ํ๊ฐ + ์ธ๋ฌผ + ํฌ์ฆ], [์์], [ํ์ /ํ๋]. | |
| s1 = join([clean(shot), subject, clean(pose)], " ") | |
| # ๋จธ๋ฆฌ ๋ฌธ๊ตฌ: "her dark hair pulled back" (์/์คํ์ผ ์ค ์๋ ๊ฒ๋ง ์ฌ์ฉ), ํ์ /ํ๋๊ณผ "and"๋ก ์ฐ๊ฒฐ | |
| hc, hs = clean(hair_color), clean(hair_style) | |
| hair = join([pron["their"], hc, "hair", hs], " ") if (hc or hs) else "" | |
| expr = clean(expression) | |
| # ํ์ /ํ๋ ๋ฌธ๊ตฌ ์์ ์ด๋ฏธ "and"๊ฐ ์์ผ๋ฉด ์ผํ๋ก ์ด์ด์ "and"๊ฐ ์ฐ๋ฌ์ ๋์ค์ง ์๊ฒ ํจ | |
| s2 = join([hair, expr], ", " if " and " in expr else " and ") | |
| clothing_text = clean(clothing) | |
| sentence1 = join([s1 + "," if s1 else "", | |
| clothing_text + "," if clothing_text else "", | |
| s2], " ").rstrip(",") | |
| if sentence1: | |
| sentence1 += "." | |
| # ๋ฌธ์ฅ 2: [๋ฐฐ๊ฒฝ + ์ํ]. | |
| s4 = clean(background) | |
| sentence2 = s4 + "." if s4 else "" | |
| # ๋ฌธ์ฅ 3: [์กฐ๋ช ]. | |
| s5 = clean(lighting) | |
| sentence3 = s5 + "." if s5 else "" | |
| # ๋ฌธ์ฅ 4: [๋ฌด๋] (๋์ ์ข ๊ฒฐ ๋ถํธ ์์ผ๋ฉด ์จ์ ๋ณด์ถฉ) | |
| s6 = _norm(_fill(mood, pron)) | |
| if s6 and s6[-1] not in ".!?": | |
| s6 += "." | |
| return _norm(" ".join(p for p in [sentence1, sentence2, sentence3, s6] if p)) | |
| def _make_atom_node(key, suffix, opts): | |
| """๋ถ๋ฆฌํ ๋ ธ๋: ๋๋กญ๋ค์ด ์ ํ / ๋๋ค / ์์ / ์ง์ ์ ๋ ฅ -> STRING ์ถ๋ ฅ.""" | |
| opts = list(opts) | |
| class AtomNode: | |
| CATEGORY = CATEGORY | |
| RETURN_TYPES = ("STRING",) | |
| RETURN_NAMES = ("text",) | |
| FUNCTION = "run" | |
| def INPUT_TYPES(cls): | |
| return { | |
| "required": { | |
| "choice": ([RANDOM, NONE] + opts, {"default": opts[0]}), | |
| "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), | |
| }, | |
| "optional": { | |
| "custom_override": ("STRING", {"multiline": True, "default": ""}), | |
| }, | |
| } | |
| def run(self, choice, seed=0, custom_override=""): | |
| custom = _norm(custom_override) | |
| if custom: | |
| return (custom,) | |
| if choice == NONE: | |
| return ("",) | |
| if choice == RANDOM: | |
| rng = random.Random(f"{suffix}:{seed}") | |
| return (_resolve(key, rng.choice(opts)),) | |
| return (_resolve(key, choice),) | |
| return AtomNode | |
| class SceneAggregator: | |
| """Node 9 (๋ถ๋ฆฌํ): ๋ ธ๋๋ค์ ์ถ๋ ฅ์ ๋ฐ์ 1๋จ๋ฝ์ผ๋ก ํตํฉ.""" | |
| CATEGORY = CATEGORY | |
| RETURN_TYPES = ("STRING",) | |
| RETURN_NAMES = ("scene_prompt",) | |
| FUNCTION = "aggregate" | |
| def INPUT_TYPES(cls): | |
| return {"required": {spec[3]: ("STRING", {"forceInput": True}) for spec in ATOM_SPECS}} | |
| def aggregate(self, Shot_Angle, Gender, Age_Range, Nationality, Placement_Pose, | |
| Clothing_Material, Hair_Color, Hair_Style, Expression_Action, | |
| Environment_Background, Local_Lighting, Atmospheric_Mood): | |
| return (_assemble(Shot_Angle, Gender, Age_Range, Nationality, Placement_Pose, | |
| Clothing_Material, Hair_Color, Hair_Style, Expression_Action, | |
| Environment_Background, Local_Lighting, Atmospheric_Mood),) | |
| class SceneBuilderAll: | |
| """์ฌ์ธ์: ํ ๋ ธ๋์์ ๋ชจ๋ ์์๋ฅผ ๊ณ ๋ฅด๊ณ ์ต์ข ํ๋กฌํํธ๊น์ง ์ถ๋ ฅ.""" | |
| CATEGORY = CATEGORY | |
| RETURN_TYPES = ("STRING",) | |
| RETURN_NAMES = ("scene_prompt",) | |
| FUNCTION = "build" | |
| def INPUT_TYPES(cls): | |
| required = {} | |
| optional = {} | |
| for _key, _suffix, _display, inp, opts in ATOM_SPECS: | |
| required[inp] = ([RANDOM, NONE] + list(opts), {"default": opts[0]}) | |
| required["all_random"] = ("BOOLEAN", {"default": False}) | |
| required["seed"] = ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}) | |
| # ํ์ํ ๋๋ง ๋ค๋ฅธ ๋ ธ๋์ STRING์ ์ฐ๊ฒฐํด ํด๋น ์์๋ฅผ ๋ฎ์ด์ฐ๊ธฐ (์์ผ ์ ์ฉ, ์์ ฏ ์์) | |
| for _key, _suffix, _display, inp, _opts in ATOM_SPECS: | |
| optional["override_" + inp] = ("STRING", {"forceInput": True}) | |
| return {"required": required, "optional": optional} | |
| def build(self, all_random=False, seed=0, **kwargs): | |
| values = [] | |
| for key, suffix, _display, inp, opts in ATOM_SPECS: | |
| override = _norm(kwargs.get("override_" + inp, "")) | |
| choice = kwargs.get(inp) | |
| rng = random.Random(f"{suffix}:{seed}") | |
| if override: | |
| v = override | |
| elif choice == NONE and not all_random: | |
| v = "" | |
| elif choice == RANDOM or all_random: | |
| v = _resolve(key, rng.choice(list(opts))) | |
| else: | |
| v = _resolve(key, choice) | |
| values.append(v) | |
| return (_assemble(*values),) | |
| NODE_CLASS_MAPPINGS = {} | |
| NODE_DISPLAY_NAME_MAPPINGS = {} | |
| for _k, _suffix, _display, _inp, _opts in ATOM_SPECS: | |
| _cls = _make_atom_node(_k, _suffix, _opts) | |
| _key = f"SceneBuilder_{_suffix}" | |
| _cls.__name__ = _key | |
| NODE_CLASS_MAPPINGS[_key] = _cls | |
| NODE_DISPLAY_NAME_MAPPINGS[_key] = _display | |
| NODE_CLASS_MAPPINGS["SceneBuilder_Aggregator"] = SceneAggregator | |
| NODE_DISPLAY_NAME_MAPPINGS["SceneBuilder_Aggregator"] = "Node 9 - Scene Aggregator" | |
| NODE_CLASS_MAPPINGS["SceneBuilder_All"] = SceneBuilderAll | |
| NODE_DISPLAY_NAME_MAPPINGS["SceneBuilder_All"] = "Scene Builder (All-in-One)" | |