INNER CODE UNIT · Python
detect_slot
untoldengine/UntoldEngine · scripts/texbake.py:182
def detect_slot(path: Path) -> str:
"""Infer texture slot from filename keywords. Returns 'data' if unrecognised."""
stem = path.stem.lower()
if any(k in stem for k in ("basecolor", "base_color", "albedo", "diffuse", "colour", "color")):
return "base_color"
if any(k in stem for k in ("emissive", "emission", "_emit", "emit_")):
return "emissive"
if any(k in stem for k in ("normal", "_nrm", "nrm_", "_nml", "nml_")):
return "normal"
if any(k in stem for k in ("height", "displacement", "_disp", "disp_", "_bump", "bump_")):
return "height"
if any(k in stem for k in ("roughness", "_rough", "rough_")):
return "roughness"
if any(k in stem for k in ("metallic", "_metal", "metal_", "metalness")):
return "metallic"
if any(k in stem for k in ("occlusion", "_ao_", "_ao", "ao_", "ambient")):
return "occlusion"
if any(k in stem for k in ("_orm", "orm_")):