I have developed a little addon that provides icon button in the node editor. We have 80 node items. And so i have 80 external icons to load. I use custom_icons.load for that.

The problem is, every icon loads one by one when activating the tab. You see them popping up one after another. The user has to wait until all the icons are loaded. And that's for our 80 icons around 10 seconds in Blender 2.78a. Not good.

Is there a way to load the external icons at Blender startup? If not, is there a way to load at least all icons at once?

The script is already a init.py, Examplecode looks like this. The icons are of course missing. Please add a folder called icons besides the script, and put two png images into the folder with the correct name:

import bpy
import os
import bpy.utils.previews

class NodesIconPanel(bpy.types.Panel):
    """Creates a Panel"""
    bl_label = "All Nodes"
    bl_idname = "nodes.common_buttons"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'TOOLS'
    bl_category = "All Nodes"

    def draw(self, context):
        layout = self.layout
        default_context = bpy.app.translations.contexts.default

    ##### --------------------------------- Layout ------------------------------------------- ####


        row = layout.row()
        row.alignment = 'LEFT'        

        props = row.operator("node.add_node", text="", text_ctxt=default_context, icon_value = custom_icons["icon32_frame"].icon_id)
        props.use_transform = True
        props.type = "NodeFrame"      

        props = row.operator("node.add_node", text="", text_ctxt=default_context, icon_value = custom_icons["icon32_reroute"].icon_id)
        props.use_transform = True
        props.type = "NodeReroute"

# global variable to store icons in
custom_icons = None

def register():


    # Our external Icons
    global custom_icons

    custom_icons = bpy.utils.previews.new()

    # Use this for addons
    #icons_dir = os.path.join(os.path.dirname(__file__), "icons")

    # Use this for testing the script in the scripting layout
    script_path = bpy.context.space_data.text.filepath
    icons_dir = os.path.join(os.path.dirname(script_path), "icons")

    custom_icons.load("frame", os.path.join(icons_dir, "frame.png"), 'IMAGE')
    custom_icons.load("reroute", os.path.join(icons_dir, "reroute.png"), 'IMAGE')

def unregister():
    global custom_icons

# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.

if __name__ == "__main__":
  • $\begingroup$ I have the exact issue with the custom icons. Did you ever find a solution for this? I assume that the icons loaded from file need to be converted to textures and sent to the GPU which is why it takes so long. If this process could be done before hand (perhaps when the add-on is loaded/registered) it would eliminate the lag. $\endgroup$ Feb 18, 2017 at 22:04
  • $\begingroup$ Unfortunately not, sorry. $\endgroup$
    – Tiles
    Feb 19, 2017 at 8:47
  • $\begingroup$ I see it's been 3 years since last comment. Did you finally find something? $\endgroup$ Dec 1, 2020 at 8:41
  • 1
    $\begingroup$ No, sorry. Still not. $\endgroup$
    – Tiles
    Dec 1, 2020 at 10:34

1 Answer 1


We developed a library, which solves that problem. It allows blazingly fast preview image loads in Blender.

See here for more: https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349

  • 1
    $\begingroup$ Thanks for the posts. This is not a regular forum, according to site rules links to answers are not answers if the link goes missing your answer becomes an empty shell without content. Answers should be substantial and stand on their own without relying on external data like links, videos or images. Instead of having users go through external links, transcribe essential parts of the process here like installing the addon or how to use it, linking the source, or posts these in the comments section instead. $\endgroup$ May 10, 2021 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .