INNER CODE UNIT · Python
_slot_from_texture_flags
untoldengine/UntoldEngine · scripts/texbake.py:206
def _slot_from_texture_flags(flags: int) -> str | None:
"""Map .untold texture record flags (field index 3) to a texbake slot name.
The exporter sets these flags at export time from material slot information,
so they are authoritative even when the filename has no recognisable keywords
(e.g. "SimpleDungeonTexture" → TEXTURE_FLAG_SRGB → "base_color").
Returns None when no slot-relevant flag is set; caller should fall back to
detect_slot() in that case.
"""
if flags & _UNTOLD_TEX_FLAG_LUT:
return "lut"
if flags & _UNTOLD_TEX_FLAG_HEIGHT:
return "height"
if flags & _UNTOLD_TEX_FLAG_NORMAL_MAP:
return "normal"
if flags & _UNTOLD_TEX_FLAG_EMISSIVE:
return "emissive"