blob: 92b7d0dbe2d8f852b12795591293ba5a8f7c84e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import os
import bpy
import bpy.utils.previews
mesh_check_icon_collections = {}
mesh_check_icons_loaded = False
def load_icons():
global mesh_check_icon_collections
global mesh_check_icons_loaded
if mesh_check_icons_loaded: return mesh_check_icon_collections["main"]
custom_icons = bpy.utils.previews.new()
icons_dir = os.path.join(os.path.dirname(__file__))
custom_icons.load("ngons", os.path.join(icons_dir, "ngon.png"), 'IMAGE')
custom_icons.load("triangles", os.path.join(icons_dir, "triangle.png"), 'IMAGE')
mesh_check_icon_collections["main"] = custom_icons
mesh_check_icons_loaded = True
return mesh_check_icon_collections["main"]
def clear_icons():
global mesh_check_icons_loaded
for icon in mesh_check_icon_collections.values():
bpy.utils.previews.remove(icon)
mesh_check_icon_collections.clear()
mesh_check_icons_loaded = False
|