Files
wtd-libreflow-addon/core/contexts.py
T
Nero Frame 13 4617c47ad0 Added sanity check baseline made by claude.
Also changed the location to a panel in VIEW_3D instead of menu.
2026-10-13 16:33:03 +02:00

45 lines
1.3 KiB
Python

"""Production contexts a file can be checked against.
To add a context, append a ``Context`` to ``CONTEXTS`` and list its id in the
``contexts`` attribute of the checks that apply to it.
"""
from dataclasses import dataclass
GENERAL = "GENERAL"
CHAR_MOD = "CHAR_MOD"
CHAR_LINEART = "CHAR_LINEART"
LAYOUT = "LAYOUT"
# Every asset context gets the general asset checks.
ASSET = frozenset({GENERAL, CHAR_MOD, CHAR_LINEART})
CHARACTER = frozenset({CHAR_MOD, CHAR_LINEART})
ALL = frozenset({GENERAL, CHAR_MOD, CHAR_LINEART, LAYOUT})
@dataclass(frozen=True)
class Context:
id: str
label: str
description: str
icon: str = "NONE"
CONTEXTS = [
Context(GENERAL, "Asset: General", "Props, sets and generic assets (modeling and lineart)", "MESH_CUBE"),
Context(CHAR_MOD, "Character: Modeling", "Character modeling file", "USER"),
Context(CHAR_LINEART, "Character: Lineart / Shading", "Character lineart and shading file", "OUTLINER_OB_GREASEPENCIL"),
Context(LAYOUT, "Shot: Layout", "Shot layout file", "SEQUENCE"),
]
def get_context(context_id):
for context in CONTEXTS:
if context.id == context_id:
return context
return None
def enum_items():
return [(c.id, c.label, c.description, c.icon, i) for i, c in enumerate(CONTEXTS)]