"""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)]