Page MenuHome

Image preview icon rendered for HI-DPI displays
AbandonedPublic

Authored by Jack Andersen (jackoalan) on Feb 2 2014, 6:38 AM.

Details

Summary

This patch causes Blender to scale preview icon resolution based on display's pixel size (as tested on my retina Mac).

I'm working on an add-on to support custom icons via 0-user image datablocks. It also adjusts the resolution for display in ID-menu templates (as visible in Texture properties).

Blender will cache a HI-DPI scaled icon image using factor from 'U.pixelsize' for interface panels zoomed to their largest size (which is 64x64 texels on 2x DPI).

The drawback of this method is the icon position appears to be translated by about (2,2) points ((4,4) pixels at 2x). There must be a sensible place to adjust this transformation, but I'm still figuring out this part of the codebase.

Diff Detail

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.Feb 4 2014, 6:25 PM

Marking this as request changes for the icon position translation that I guess has to be solved before this can be committed.

This review isn't about custom icons, but I do not think we would accept 0-user image datablocks as a solution for that. We should keep a clear distinction between what is UI and what is data that the user edits and manages, and can link and use in other datablocks etc. Probably the code in interface_icons.c should be refactored to support custom icons with storage similar to the existing icons, and some sort of bpy.register_icon(..) function.

Understood..
The bit about image datablocks was admittedly extraneous (it prompted this patch for me).

Nevertheless, this definitely improves the rendering quality of preview icons, even in typical image-ID selections.

I've also noticed that preview icons for 'Texture' objects do not benefit from this patch as well.

I'll do some further investigation and testing

I believe the UI code has changed significantly since this patch was written..

Merge-testing with the current version on hi-dpi platforms should say for certain. I don't have access to hi-dpi HW right now to say myself.

Closing this patch because it is out of date, if the change is still applicable, please submit a patch.