Page MenuHome

couple usages of UILayout.template_preview will display only the first
Closed, InvalidPublicTO DO


the next panel will display only the first texture number of times that template_preview was called!

class MyMaterialPanel(bpy.types.Panel):
bl_label = "My Material Panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'material'

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

for mat in
row= layout.row()
col = row.column()
col.label(text = "%s: " % (mat.texture_slots[0], icon = "MATERIAL_DATA")

if you select an object which contains, lets say 3 materials, then there will be 3 different labels and 3 same texture previews.
displaying materials will cause the same problem.

im working with blender 2.59 x64, windows 7


Event Timeline

Attaching sample file and possible fix for this.

Developer note:
Problem was caused by renderer name depended only on screen area pointer, so you wasn't been able to have several renderers inside one screen area. If more unique name is chosen, then you can easily deal with reported issue. If be honest, don't think provided patch is really nice -- it can produce renderers for all IDs rendered in this screen area and ideally it should be per-template renderers. Not sure how difficult it'll be to make. And probably it should be more general thing which will clean-up unused renderers. Currently if you'll collapse screen area or start adding new materials plenty of renderers would be created.

Discussed with Brecht. Preview template wasn't designed to deal with such kind of things. Added note to TODO:
Anyway, thanks for the report, but i have to close it now.

Sergey Sharybin (sergey) changed the task status from Unknown Status to Unknown Status.Oct 11 2011, 5:44 PM