Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ui_tex = bpy.data.textures.new('MP', 'IMAGE')
- ui_tex.image = bpy.data.images.load("D:/pic.png")
- class UIPanel(bpy.types.Panel):
- bl_label = "Label"
- bl_space_type = "VIEW_3D"
- bl_region_type = "TOOLS"
- br_name = "Printing"
- def draw(self, context):
- layout = self.layout
- scn = context.scene
- ui_tex = bpy.data.textures.new("MP", "IMAGE")
- ui_tex.image = bpy.data.images.load("D:/pic.png")
- row = layout.row(align=True)
- row.alignment = 'EXPAND'
- row.template_preview(bpy.data.textures["MP"])
- line 39, in draw
- ui_tex.image = bpy.data.images.load(filepath = filepath)
- AttributeError: Writing to ID classes in this context is not allowed: MP, Texture datablock, error setting ImageTexture.image
- bpy.ops.image.open(filepath='full_path_to/your_image.png')
- bpy.data.images['your_image.png'].pack(as_png=True) # Pack an image as embedded data into the .blend file
- ui_tex.image = bpy.data.images['your_image.png']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement