Custom icon is not drawn on header / addons prefs panel #48813

Closed
opened 2016-07-08 16:53:51 +02:00 by Sybren A. Stüvel · 12 comments

System Information
Kubuntu 16.04, GeForce 8800 GTS 512

Blender Version
Broken: 2.77a and 8bb69b6157

Short description of error
When drawing a button or label with a custom icon on a header or addons panel, the icon isn't shown. Only after forcing a redraw (for example by moving the mouse over the UI element) the icon gets drawn.

Exact steps for others to reproduce the error

  1. Place the attached blend file test_custom_icon.blend and icon icon-cloud.png in the same folder.
  2. Open the blend file.
  3. Scroll the text editor header such that there is plenty of space on the right-hand side of the header. This is necessary so that you can see the button that will appear here, directly on the first draw.
  4. Run the script.
  5. See the "Render" button without cloud icon.
  6. Move the mouse around over the button.
  7. See the "Render" button appear.

If you go to the properties editor, objects tab, the script also registers a button there, in a custom panel. You can also see that it is drawn without the icon first, but is redrawn when the icon is loaded. My bet is that this redraw trigger doesn't happen for other areas.

**System Information** Kubuntu 16.04, GeForce 8800 GTS 512 **Blender Version** Broken: 2.77a and 8bb69b6157 **Short description of error** When drawing a button or label with a custom icon on a header or addons panel, the icon isn't shown. Only after forcing a redraw (for example by moving the mouse over the UI element) the icon gets drawn. **Exact steps for others to reproduce the error** 1. Place the attached blend file [test_custom_icon.blend](https://archive.blender.org/developer/F320340/test_custom_icon.blend) and icon ![icon-cloud.png](https://archive.blender.org/developer/F320341/icon-cloud.png) in the same folder. 2. Open the blend file. 3. Scroll the text editor header such that there is plenty of space on the right-hand side of the header. This is necessary so that you can see the button that will appear here, directly on the first draw. 3. Run the script. 4. See the "Render" button without cloud icon. 5. Move the mouse around over the button. 6. See the "Render" button appear. If you go to the properties editor, objects tab, the script also registers a button there, in a custom panel. You can also see that it is drawn without the icon first, but is redrawn when the icon is loaded. My bet is that this redraw trigger doesn't happen for other areas.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Added subscribers: @mont29, @Sergey

Added subscribers: @mont29, @Sergey

@mont29, is it something in your area?

@mont29, is it something in your area?

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Problem is that those 'custom icons from file' are asynchronously deferred loaded, using 'generic' icon generation job, which generates NC_MATERIAL notifications. Replacing those with NC_WINDOW does fix the issue, question is, do we accept that kind of 'redraw everything' message from icon generation? @ideasman42, what do you think?

Problem is that those 'custom icons from file' are asynchronously deferred loaded, using 'generic' icon generation job, which generates NC_MATERIAL notifications. Replacing those with NC_WINDOW does fix the issue, question is, do we accept that kind of 'redraw everything' message from icon generation? @ideasman42, what do you think?

@mont29, right, we can always add global redraw flags to workaround these issues. In this case I don't have a strong opinion,
though IMHO it's quite weak - the more add-ons use generated icons, the more we will redraw everything when they update.


I think we need a more flexible notification system which doesn't depend on hard coded values (making assumptions about whats shown in a region).

Currently a Python script may show any information in the UI, its totally hit-and-miss that the UI is refreshed when they're changed.

We could have design task for this (if someone has time to develop it...) would suggest moving to a publish/subscribe pattern for the notifier system where...

  • hard coded listener functions are replaced with dynamically registered listeners based on the contents of the region/area.
  • defining the UI elements automatically subscribes that region to be updated when those values are changed.

How fine-grained we need to be can be chosen later... per-property is possible but overkill. (probably ID & RNA-type is enough).
This way using dynamically generated icons is just a matter of asking to listen for changes to icons - a different kind of listener.

This allows for Python scripts to be able to register to be notified on changes too.

For the 3D-view for eg, it probably doesn't make sense to inspect whats drawn and listen to changes in each object's ID. It could just register a listener for changes to data-types (material, object-object data).
So something similar to the existing system could be done where needed.

@mont29, right, we can always add global redraw flags to workaround these issues. In this case I don't have a strong opinion, though IMHO it's quite weak - the more add-ons use generated icons, the more we will redraw everything when they update. ---- I think we need a more flexible notification system which doesn't depend on hard coded values (making assumptions about whats shown in a region). Currently a Python script may show any information in the UI, its totally hit-and-miss that the UI is refreshed when they're changed. We could have design task for this (if someone has time to develop it...) would suggest moving to a *publish/subscribe* pattern for the notifier system where... - hard coded listener functions are replaced with dynamically registered listeners based on the contents of the region/area. - defining the UI elements automatically *subscribes* that region to be updated when those values are changed. How fine-grained we need to be can be chosen later... per-property is possible but overkill. (probably ID & RNA-type is enough). This way using dynamically generated icons is just a matter of asking to listen for changes to icons - a different kind of listener. This allows for Python scripts to be able to register to be notified on changes too. For the 3D-view for eg, it probably doesn't make sense to inspect whats drawn and listen to changes in each object's ID. It could just register a listener for changes to data-types (material, object-object data). So something similar to the existing system could be done where needed.
Bastien Montagne was assigned by Sergey Sharybin 2016-07-26 17:45:34 +02:00

While notifier is a weak solution it is the only one for now. So either we go this way or consider this a TODO.

Since for now we don't have have much addons who uses this function think it's acceptable to just use notifiers.

While notifier is a weak solution it is the only one for now. So either we go this way or consider this a TODO. Since for now we don't have have much addons who uses this function think it's acceptable to just use notifiers.

Yes, agree, for now notifier will do the work.

@ideasman42 your idea sounds nice, imho at this point should be part of the bigger 'workflow' 2.8 topic (as part of custom editors, which will require that kind of thing anyway)…

Yes, agree, for now notifier will do the work. @ideasman42 your idea sounds nice, imho at this point should be part of the bigger 'workflow' 2.8 topic (as part of custom editors, which will require that kind of thing anyway)…

This issue was referenced by f3f10e4515

This issue was referenced by f3f10e4515c45925df7dea3b29d2dc73dd097568

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Member

Thanks guys!

Thanks guys!
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
5 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#48813
No description provided.