import gpu from pathlib import Path class LazyDict(dict): def __getitem__(self, k): v = super().__getitem__(k) if callable(v): v = v() super().__setitem__(k, v) return v def get(self, k, default=None): if k in self: return self.__getitem__(k) return default PICKERS = {} MODULE_DIR = Path(__file__).parent SHADER_DIR = MODULE_DIR / 'shaders' SHADERS = LazyDict() vertex_shader = Path(SHADER_DIR, "dash_shader.vert").read_text(encoding='utf-8') fragment_shader = Path(SHADER_DIR, "dash_shader.frag").read_text(encoding='utf-8') SHADERS['dashed_line'] = lambda : gpu.types.GPUShader(vertex_shader, fragment_shader)