How to add Image Browser to custom panel using Python or addon Serpens 3? Look like World Browser in this sample.

enter image description here

  • $\begingroup$ Should it be a panel/section in the World Properties tab or could it also be an area in the sidebar like this one here? $\endgroup$
    – Blunder
    Dec 17, 2022 at 20:30
  • $\begingroup$ @Blunder It doesn't really matter, but specifically I want to make a world textures switcher $\endgroup$
    – M. Gordon
    Dec 18, 2022 at 3:35

1 Answer 1


1) Property in the side panel

To create a property in the viewports side panel (N-panel) aramature selection

use the script from this question (How to access pose bones via python in this condition?) and replace select_rig with select_image and these lines

    # select_rig should point to an Object of type 'ARMATURE'
    bpy.types.Scene.select_rig = bpy.props.PointerProperty(name='Select Rig',
        type=bpy.types.Object, poll=scene_mychosenobject_poll)

with this line

    bpy.types.Scene.select_image = bpy.props.PointerProperty(name='Image',type=bpy.types.Image)

2) Property in the World Properties window

import bpy

class SelectImagePanel(bpy.types.Panel):
    """Creates a Panel in the World properties window"""
    bl_label = "World Image Panel"
    bl_idname = "OBJECT_PT_select_image"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "world"

    def draw(self, context):
        layout = self.layout

        obj = context.active_object

        row = layout.row()
        row.label(text="Select an image", icon='WORLD_DATA')

        row = layout.row()
        row.prop(context.scene, 'select_image')

def register():
    bpy.types.Scene.select_image = bpy.props.PointerProperty(name='Image',type=bpy.types.Image)

def unregister():

if __name__ == "__main__":

custom property in the world properties window

Related questions:

  • $\begingroup$ Thank you very much for your answer! I meant a specific image how to change? For example "Sky Image" from World Shader. Sorry, my python skill is very beginning $\endgroup$
    – M. Gordon
    Dec 20, 2022 at 16:25

You must log in to answer this question.

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