From 99fa874c858dbbe10be70d3be03ad337780c1ec0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 27 Sep 2018 18:38:36 +0200 Subject: Fix blender_icons_update.py not working after mono icon changes. --- source/blender/datatoc/datatoc_icon_split.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender/datatoc/datatoc_icon_split.py') diff --git a/source/blender/datatoc/datatoc_icon_split.py b/source/blender/datatoc/datatoc_icon_split.py index 399d7df4d8d..87f3fdae478 100755 --- a/source/blender/datatoc/datatoc_icon_split.py +++ b/source/blender/datatoc/datatoc_icon_split.py @@ -128,21 +128,26 @@ def dice_icon_name( # Init on demand if not _dice_icon_name_cache: import re + count = 0 # Search for eg: DEF_ICON(BRUSH_NUDGE) --> BRUSH_NUDGE - re_icon = re.compile(r'^\s*DEF_ICON\(\s*([A-Za-z0-9_]+)\s*\).*$') + re_icon = re.compile(r'^\s*DEF_ICON.*\(\s*([A-Za-z0-9_]+)\s*\).*$') ui_icons_h = os.path.join(SOURCE_DIR, "source", "blender", "editors", "include", "UI_icons.h") with open(ui_icons_h, 'r', encoding="utf-8") as f: for l in f: match = re_icon.search(l) if match: - icon_name = match.group(1).lower() - # print(l.rstrip()) - _dice_icon_name_cache[len(_dice_icon_name_cache)] = icon_name + if l.find('DEF_ICON_BLANK') == -1: + icon_name = match.group(1).lower() + _dice_icon_name_cache[count] = icon_name + count += 1 # ---- Done with icon cache index = (y * parts_x) + x + if index not in _dice_icon_name_cache: + return None + icon_name = _dice_icon_name_cache[index] # for debugging its handy to sort by number @@ -209,6 +214,9 @@ def dice( parts_x, parts_y, name_style=name_style, prefix=output_prefix ) + if not id_str: + continue + filepath = os.path.join(output, id_str) if VERBOSE: print(" writing:", filepath) -- cgit v1.2.3