Is there any possibility to load animated gifs as a custom icon, which then would be viewed as animated sequence right in the preview? for now, it's just blank and no static preview generated

For testing I used the "Ui previews dynamic enum" template in python templates (in Text editor)

enter image description here

EDIT: IF there is no possibility to load gif, anyone here knows the alternative? Maybe fake somehow animated preview, but for user it'll be looked like gif animation

  • 1
    AFAIK animated gifs are not supported by blender. – batFINGER Aug 8 at 9:39
  • 1
    One option coul be to draw your own stuff with bgl module somewhere in the UI. You would have to update that draw call in app.handler to make an animation or to use a modal operator if you needed to react to user input. – Jaroslav Jerryno Novotny Aug 8 at 10:37

Fudge it via the draw system.

Emulating the frames of an animated gif by using the 4 triangle icons. The simple panel template has been edited to add this "animated" icon to a label. The icon will step thru its list when the draw is called and panel updated. Mousing over the area, scrolling the area etc will tick the animation.

import bpy

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"
    i = 0
    icons = ['TRIA_RIGHT',
             'TRIA_DOWN',
             'TRIA_LEFT',
             'TRIA_UP']

    @classmethod
    def icon(cls):
        cls.i += 1
        if cls.i >= len(cls.icons):
            cls.i = 0
        return cls.icons[cls.i]

    def draw(self, context):
        layout = self.layout
        layout.label("Anim %d" % self.i, icon=self.icon())

def register():
    bpy.utils.register_class(LayoutDemoPanel)

def unregister():
    bpy.utils.unregister_class(LayoutDemoPanel)

if __name__ == "__main__":
    register()

Ok that's not too impressive, need some way to tie it to time better. As an example redraw the properties area on a frame change. Run code and start an animation to see effect.

import bpy

def redraw_props(scene):
    for a in bpy.context.screen.areas:
        if a.type == 'PROPERTIES':
            a.tag_redraw()

bpy.app.handlers.frame_change_post.append(redraw_props)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.