Fix blender_icons_update.py not working after mono icon changes.
This commit is contained in:
@@ -128,21 +128,26 @@ def dice_icon_name(
|
|||||||
# Init on demand
|
# Init on demand
|
||||||
if not _dice_icon_name_cache:
|
if not _dice_icon_name_cache:
|
||||||
import re
|
import re
|
||||||
|
count = 0
|
||||||
|
|
||||||
# Search for eg: DEF_ICON(BRUSH_NUDGE) --> BRUSH_NUDGE
|
# 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")
|
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:
|
with open(ui_icons_h, 'r', encoding="utf-8") as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
match = re_icon.search(l)
|
match = re_icon.search(l)
|
||||||
if match:
|
if match:
|
||||||
|
if l.find('DEF_ICON_BLANK') == -1:
|
||||||
icon_name = match.group(1).lower()
|
icon_name = match.group(1).lower()
|
||||||
# print(l.rstrip())
|
_dice_icon_name_cache[count] = icon_name
|
||||||
_dice_icon_name_cache[len(_dice_icon_name_cache)] = icon_name
|
count += 1
|
||||||
# ---- Done with icon cache
|
# ---- Done with icon cache
|
||||||
|
|
||||||
index = (y * parts_x) + x
|
index = (y * parts_x) + x
|
||||||
|
if index not in _dice_icon_name_cache:
|
||||||
|
return None
|
||||||
|
|
||||||
icon_name = _dice_icon_name_cache[index]
|
icon_name = _dice_icon_name_cache[index]
|
||||||
|
|
||||||
# for debugging its handy to sort by number
|
# for debugging its handy to sort by number
|
||||||
@@ -209,6 +214,9 @@ def dice(
|
|||||||
parts_x, parts_y,
|
parts_x, parts_y,
|
||||||
name_style=name_style, prefix=output_prefix
|
name_style=name_style, prefix=output_prefix
|
||||||
)
|
)
|
||||||
|
if not id_str:
|
||||||
|
continue
|
||||||
|
|
||||||
filepath = os.path.join(output, id_str)
|
filepath = os.path.join(output, id_str)
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print(" writing:", filepath)
|
print(" writing:", filepath)
|
||||||
|
Reference in New Issue
Block a user