Could not find it back, I got somewhere here a script to show all ICONS of Blender 2.5
but the corresponding source does not work anymore in SVN 31095
Sorry author :)!
Trying to understand I got it working but only as ‘addon’
If not an addon the icons list is not available in and for the Panel operator
WHO KNOWS to overcome this problem???
Because I compile myself i have the UI_icons.h file
Adjust or camouflage with # and remove the # in a line under! line 17 18 in the source.
I could not open a project for ‘my’ connect addon (some not understood error ), where the wiki and bug-tracker point to
So that should be adjusted too!
#copyright GPL by PKHG
bl_addon_info = {
'name': 'addicons',
'author': 'PKHG',
'version': '0.1',
'blender': (2, 5, 3),
'location': 'objectpanel',
'description': 'show icons!',
'warning': '', # ???used for warning icon and text in addons panel
'wiki_url': 'http://petertregarg.host22.com/pmwiki/pmwiki.php/Api/ConnectTwoComponents',
'tracker_url': 'http://petertregarg.host22.com/pmwiki/pmwiki.php/Api/ConnectTwoComponents',
'category': 'Abracadabra'} #works ;-)
# retrieving the masterlist with all icon names
import bpy
try:
import urllib.request
file = urllib.request.urlopen('file:\\\C:/BlenderSVN/blender/source/blender/editors/include/UI_icons.h')
#file = urllib.request.urlopen('https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/include/UI_icons.h')
except:
print("Couldn't find the urllib module or was unable to connect to the internet")
file = False
if file:
lines = str(file.read()).split('\
')
else:
lines = []
# get the icon names of existing non-blank icons
icons = []
for l in lines:
if l[:9] == 'DEF_ICON(':
n = l.strip().split('(')[1].split(')')[0]
if n[:10] != 'ICON_BLANK':
icons.append(n[5:])
# create custom operator for each icon
def printdoc_invoke(self, context, event):
print(self.bl_description)
return{'FINISHED'}
for i in icons:
c = type(i,(bpy.types.Operator,),dict(bl_idname="ICONDISPLAY_OT_"+i, bl_label="ICONDISPLAY_OT_"+i, bl_description=i))
setattr(c, 'invoke', printdoc_invoke)
bpy.types.register(c)
# draw the panel with the icons
class OBJECT_PT_icons(bpy.types.Panel):
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
bl_label = "All icons"
def draw(self, context):
amount = 10
cols = []
layout = self.layout
split = layout.split(percentage=1.0/amount)
for i in range(amount):
cols.append(split.column())
for i in range(len(icons)):
col = cols[i%amount].row()
try:
col.operator("ICONDISPLAY_OT_"+icons[i], text="", icon=icons[i])
except:
col.operator("icondisplay_OT_"+icons[i], text="new")
#bpy.types.register(OBJECT_PT_icons)
def register():
pass
def unregister():
pass
if __name__ == "__main__":
register()