diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2017-03-30 09:31:07 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2017-03-30 09:31:07 +0300 |
commit | ba89ec341ccea23d480d3c23c51ebaaf2bb88ee5 (patch) | |
tree | e32332cba3cb599b7c1e19126b9273a5d14964e1 /mesh_extra_tools/icons/icons.py | |
parent | f53017167bdd9854a65690c23cbc90cf1f9d37ea (diff) |
Update Mesh Edit Tools: T50680
Diffstat (limited to 'mesh_extra_tools/icons/icons.py')
-rw-r--r-- | mesh_extra_tools/icons/icons.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mesh_extra_tools/icons/icons.py b/mesh_extra_tools/icons/icons.py new file mode 100644 index 00000000..92b7d0db --- /dev/null +++ b/mesh_extra_tools/icons/icons.py @@ -0,0 +1,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 |