Skip to content

Commit

Permalink
Merge pull request #156 from MaximeHerpin/develop
Browse files Browse the repository at this point in the history
replaced icons
  • Loading branch information
MaximeHerpin authored Aug 15, 2017
2 parents 9f929c5 + 746e773 commit abc5f3d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
bl_info = {
"name": "Modular trees",
"author": "Herpin Maxime, Jake Dube",
"version": (2, 9, 0),
"blender": (2, 77, 0),
"version": (2, 9, 1),
"blender": (2, 79, 0),
"location": "View3D > Tools > Tree > Make Tree",
"description": "Generates an organic tree with correctly modeled branching.",
"warning": "May take a long time to generate! Save your file before generating!",
Expand Down
Binary file added custom_icons/BATCH_TREE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added custom_icons/TREE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added custom_icons/TREE1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added custom_icons/TREE_UPDATE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added custom_icons/TWIG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions icons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2016 Maxime Herpin, Jake Dube
#
# ##### BEGIN GPL LICENSE BLOCK ######
# This file is part of Modular Tree.
#
# Modular Tree is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Modular Tree is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Modular Tree. If not, see <http://www.gnu.org/licenses/>.
# ##### END GPL LICENSE BLOCK #####

from os.path import join, dirname
from bpy.utils import previews

# global variables
ICONS = {'TREE', 'TREE_UPDATE', 'BATCH_TREE', 'TWIG'}
ICON_COLLECTION = {}


def register_icons():
preview_coll = previews.new()
icons_folder = join(dirname(__file__), "custom_icons")

for icon in ICONS:
preview_coll.load(icon, join(icons_folder, icon + ".png"), 'IMAGE')

ICON_COLLECTION["main"] = preview_coll


def unregister_icons():
for collection in ICON_COLLECTION.values():
previews.remove(collection)
ICON_COLLECTION.clear()


def get_icon(icon):
preview_coll = ICON_COLLECTION["main"]
return preview_coll[icon].icon_id

0 comments on commit abc5f3d

Please sign in to comment.