5
$\begingroup$

I'm trying to use layout.template_preview to display texture previews on some custom nodes I created. I'm currently calling it with just:

layout.template_preview(bpy.data.textures['some_name']) I'm not exactly sure what the other parameters do...

Problem is I can only get one texture to display at a time. The other nodes will display the same texture, even when I supply layout.template_preview with different textures. When I click on different nodes, sometimes the texture will change. Also, when the previews are displayed in the nodes, the texture preview in the properties panel disappears.

I wonder if I need to do something with the ID's, or maybe it has something to do with the user interface rendering.

$\endgroup$
  • $\begingroup$ Up until recently, the UV image editor was a bit of a mess when it came to updating preview icons. It was sort of fixed sometime last year then properly fixed not long after. It could be that you may have to look through that specific code to find a working solution. The code you are currently working with may not have the upgrade yet. The Blender Render(Internal) Material/Texture tab also works well in this area so be sure to verify what you are doing against this code as well. :) $\endgroup$ – MarcClintDion Apr 18 '15 at 23:53
  • $\begingroup$ I'm currently working with a build made from the git repository updated a couple weeks ago. I've looked at the properties_texture.py in the startup ui folder, since it deals with the layout of the texture properties panel. The TEXTURE_PT_preview class in that python file does call layout.template_preview, but it relies on the context and the texture slots, not bpy.data.texture. It also only previews one texture at a time. I've looked at other files as well, but none of them seem do what I'm looking for. The texture node editor behavior is what I'm after, but that's implemented in C. $\endgroup$ – tiredNconfused Apr 19 '15 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.