Icon Preview generation for textures and images #48831

Closed
opened 2016-07-12 09:29:32 +02:00 by Andreas Esau · 16 comments
Member

System Information
Windows 7

Blender Version
2.77.a abf6f08

Short description of error
I am trying to use the preview functionality for textuers and images and display those icons via an enum property. I loop over all textures in bpy.data and generate an entry for the enum property. Icon for the enum property is set by the IconID I get from bpy.data.textures["tex"].preview.icon_id.
When I now generate a new texture, the icon gets also generated and displayed. The problem now starts when I when I reload the blend. The icons are not generated anymore. And I get an error in the console that the given IconID with its corresponding icon is not found. Is there a way to trigger the generation of an icon? Also Icons are not displayed by the template_icon_view.

Exact steps for others to reproduce the error
Just open the blend file. Generate some textures. Icons get generated. Save blend file and then reopen. Icons are missing.
draw_Icons.blend

**System Information** Windows 7 **Blender Version** 2.77.a abf6f08 **Short description of error** I am trying to use the preview functionality for textuers and images and display those icons via an enum property. I loop over all textures in bpy.data and generate an entry for the enum property. Icon for the enum property is set by the IconID I get from bpy.data.textures["tex"].preview.icon_id. When I now generate a new texture, the icon gets also generated and displayed. The problem now starts when I when I reload the blend. The icons are not generated anymore. And I get an error in the console that the given IconID with its corresponding icon is not found. Is there a way to trigger the generation of an icon? Also Icons are not displayed by the template_icon_view. **Exact steps for others to reproduce the error** Just open the blend file. Generate some textures. Icons get generated. Save blend file and then reopen. Icons are missing. [draw_Icons.blend](https://archive.blender.org/developer/F321886/draw_Icons.blend)
Campbell Barton was assigned by Andreas Esau 2016-07-12 09:29:32 +02:00
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @ndee

Added subscriber: @ndee
Author
Member

Small addition.

I add a new texture of type "IMAGE" and give the texture an image as data.
When painting something on the image, the icon does only update if the Texture Panel is "open" where the original texture icon in the texture_slot is displayed. Otherwise the icon has the old cashed version. It updates once the texture_slot is visible and updates the the icon.

Small addition. I add a new texture of type "IMAGE" and give the texture an image as data. When painting something on the image, the icon does only update if the Texture Panel is "open" where the original texture icon in the texture_slot is displayed. Otherwise the icon has the old cashed version. It updates once the texture_slot is visible and updates the the icon.
Author
Member

Here is a small gif showcasing the problem.
blender_icons.gif

Here is a small gif showcasing the problem. ![blender_icons.gif](https://archive.blender.org/developer/F321896/blender_icons.gif)

Added subscriber: @Sergey

Added subscriber: @Sergey

This seems to be similar to #48813. Caused by Blender not knowing anything about dependencies between interface elements. To me it's more like a TODO than a Bug.

@mon29, @ideasman42, this is your area so leaving final decision up to you.

This seems to be similar to #48813. Caused by Blender not knowing anything about dependencies between interface elements. To me it's more like a TODO than a Bug. @mon29, @ideasman42, this is your area so leaving final decision up to you.

This seems to be similar to #48813. Caused by Blender not knowing anything about dependencies between interface elements. To me it's more like a TODO than a Bug.

@mon29, @ideasman42, this is your area so leaving final decision up to you.

This seems to be similar to #48813. Caused by Blender not knowing anything about dependencies between interface elements. To me it's more like a TODO than a Bug. @mon29, @ideasman42, this is your area so leaving final decision up to you.
Author
Member

I noticed that after reloading the blendfile blender crashes very often.
In the gif this also happens. I just open the same blendinstance in the back for the video purpose so it is not seeable.

So I would say this is sort of BUGGY and not just a feature TODO :)

I noticed that after reloading the blendfile blender crashes very often. In the gif this also happens. I just open the same blendinstance in the back for the video purpose so it is not seeable. So I would say this is sort of BUGGY and not just a feature TODO :)

Added subscribers: @ideasman42, @mont29

Added subscribers: @ideasman42, @mont29
Campbell Barton was unassigned by Bastien Montagne 2016-07-12 17:53:34 +02:00
Bastien Montagne self-assigned this 2016-07-12 17:53:34 +02:00

Yes, there is the update issue, but as you said, this is considered TODO for now.

However, there are at least two other issues here:

  1. ID.icon_id and PreviewImage.icon_id are not ensured to be the same, as it should be (and previewimage one is not correctly cleared on file read either).
  2. Mere 'buttons from icon_id' UI code (ui_def_but_icon and its callgraph) are not able to generate/update their pictures when those are ID-auto-generated (and not loaded from filesystem).
Yes, there is the update issue, but as you said, this is considered TODO for now. However, there are at least two other issues here: 1) `ID.icon_id` and `PreviewImage.icon_id` are not ensured to be the same, as it should be (and previewimage one is not correctly cleared on file read either). 2) Mere 'buttons from icon_id' UI code (`ui_def_but_icon` and its callgraph) are not able to generate/update their pictures when those are ID-auto-generated (and not loaded from filesystem).

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

OK, Everything should be fixed now (51812fb502 & eb04908cc).

@ndee note however that you should rather use bpy.types.UILayout.icon(tex) to get an ID icon in theory… Now should not change anything though.

OK, Everything should be fixed now (51812fb502 & eb04908cc). @ndee note however that you should rather use `bpy.types.UILayout.icon(tex)` to get an ID icon in theory… Now should not change anything though.
Author
Member

Oh wow.. that was a quick. I will test this. Thanks alot Bastien.

so this would get me a proper icon id?

tex = bpy.data.textures["text_name"]
icon_id = bpy.types.UILayout.icon(tex)
Oh wow.. that was a quick. I will test this. Thanks alot Bastien. so this would get me a proper icon id? ``` tex = bpy.data.textures["text_name"] icon_id = bpy.types.UILayout.icon(tex) ```
Bastien Montagne was unassigned by Andreas Esau 2016-07-12 22:01:11 +02:00
Author
Member

Ok.. One last thing. I don't know if this is related or if I should create a custom bug report for that.

@mont29
The icon gets properly displayed for normal enum properties. But when I try to display the enum property as template_icon_view, the icons are not shown.
Is there a magic trick, or is this a bug and I should write an extra report for that?

Ok.. One last thing. I don't know if this is related or if I should create a custom bug report for that. @mont29 The icon gets properly displayed for normal enum properties. But when I try to display the enum property as template_icon_view, the icons are not shown. Is there a magic trick, or is this a bug and I should write an extra report for that?

In #48831#381188, @ndee wrote:
so this would get me a proper icon id?

tex = bpy.data.textures["text_name"]
icon_id = bpy.types.UILayout.icon(tex)

Yes, typically… Though again, now it should not make any difference, except that going through tex.preview forces Blender to create the PreviewImage immediately - not a big deal in practice.

In #48831#381189, @ndee wrote:
The icon gets properly displayed for normal enum properties. But when I try to display the enum property as template_icon_view, the icons are not shown.

Don’t know about that, here it works perfectly now (using your demo file)…

> In #48831#381188, @ndee wrote: > so this would get me a proper icon id? > > ``` > tex = bpy.data.textures["text_name"] > icon_id = bpy.types.UILayout.icon(tex) > ``` Yes, typically… Though again, now it should not make any difference, except that going through tex.preview forces Blender to create the PreviewImage immediately - not a big deal in practice. > In #48831#381189, @ndee wrote: > The icon gets properly displayed for normal enum properties. But when I try to display the enum property as template_icon_view, the icons are not shown. Don’t know about that, here it works perfectly now (using your demo file)…
Author
Member

@mont29
ok. Just tried out the latest blender build and icon_view works fine now! Awesome that this issues are resolved!

@mont29 ok. Just tried out the latest blender build and icon_view works fine now! Awesome that this issues are resolved!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#48831
No description provided.