Path: blob/master/scene/theme/icons/default_theme_icons_builders.py
9906 views
"""Functions used to generate source files during build time"""12import os34import methods567# See also `editor/icons/editor_icons_builders.py`.8def make_default_theme_icons_action(target, source, env):9icons_names = []10icons_raw = []1112for src in map(str, source):13with open(src, encoding="utf-8", newline="\n") as file:14icons_raw.append(methods.to_raw_cstring(file.read()))1516name = os.path.splitext(os.path.basename(src))[0]17icons_names.append(f'"{name}"')1819icons_names_str = ",\n\t".join(icons_names)20icons_raw_str = ",\n\t".join(icons_raw)2122with methods.generated_wrapper(str(target[0])) as file:23file.write(f"""\24#include "modules/modules_enabled.gen.h"2526inline constexpr int default_theme_icons_count = {len(icons_names)};27inline constexpr const char *default_theme_icons_sources[] = {{28{icons_raw_str}29}};3031inline constexpr const char *default_theme_icons_names[] = {{32{icons_names_str}33}};34""")353637