Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw9fjYcwzhZeJZAD6ujMjA
27 lines
983 B
Python
27 lines
983 B
Python
"""Empty latent. A node-only module."""
|
|
|
|
from .nodes import FunUIAspectSize, FunUIEmptyLatent
|
|
|
|
ID = "latent_empty"
|
|
TITLE = "Empty latent"
|
|
STAGE = "latent"
|
|
CATEGORY = "system"
|
|
STATUS = "proven"
|
|
|
|
NODES = [FunUIEmptyLatent, FunUIAspectSize]
|
|
|
|
|
|
BASIS_ROLE = {"at": "project.resolution_basis", "input": "basis"}
|
|
|
|
|
|
def upgrade(slots, _outputs=None):
|
|
"""An Aspect Size saved before the project could say what its width and height mean gets the role that carries that, and
|
|
keeps the rule it always had (the pixel count) until the project's own setting says otherwise."""
|
|
if not any(x.get("node") == "FunUIAspectSize" and BASIS_ROLE not in (x.get("roles") or []) for x in slots):
|
|
return slots
|
|
return [{**x, "roles": [*(x.get("roles") or []), BASIS_ROLE], "inputs": {**(x.get("inputs") or {}), "basis": "area"}}
|
|
if x.get("node") == "FunUIAspectSize" and BASIS_ROLE not in (x.get("roles") or []) else x for x in slots]
|
|
|
|
|
|
PROVIDES = {"upgrade_slots": upgrade}
|