I am trying to create below UI panel to open the file browser and load / select the image into this field. Here is what I got so far, this opens the image and I can then select it from the available images, but I would like to turn it into a single step. So, click file browser, select image and it automatically populates the necessary areas.
import bpy class OBJECT_PT_my_UI(bpy.types.Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = "MY_PANEL" bl_idname = 'OBJECT_myUI' bl_context = 'object' def draw(self, context): layout = self.layout col = layout.column() row = col.row(align=True) row.prop_search(context.scene, 'image_name', bpy.data, 'images') row.operator("image.open", icon="FILE_FOLDER", text="") def register(): bpy.types.Scene.image_name = bpy.props.StringProperty(name = '') bpy.utils.register_module(__name__) def unregister(): bpy.utils.unregister_module(__name__) if __name__ == "__main__": register()
Blender already does it in the texture Panel, but I could not extract just the part I need from the python script:
Either option above does what I need.