Page MenuHome

Add transparency support to tabs
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on Feb 3 2014, 8:13 PM.

Details

Summary

This adds transparency support for each of the tab theme colors. In addition it disables the tab highlight as it was generally distracting and it loons much cleaner without it.

It also adds a secondary outline to the active tab to ensure good readability with transparent tabs. This secondary tab also makes the design feel more consistent with the tab divider.

Original patch by @codemanx

Single Patch Download:

Diff Detail

Branch
tabs/alpha

Event Timeline

Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 3 2014, 8:54 PM
  • Make Active Tab use Region Text Highlight theme color
Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 3 2014, 9:28 PM
  • Fix active tab drawing too dark

@Campbell Barton (campbellbarton) would you be game to review this?

I believe you mentioned a while ago that transparency had some unforeseen problems, but I can't seem to find any. Seems to be working very well. My main question is how much it impacts speed. Is there a good way to test this?

@Jonathan Williamson (carter2422) - Ill check on this - minor note inline, but I can probably change when applying the patch, so only make these changes if you want.

Id like to do final review before committing though, whatever happens,

source/blender/editors/interface/interface_panel.c
1493–1494

suggest to have an is_alpha bool var, before using glEnable(GL_BLEND);, this can be enabled only when the region is using alpha/overlap.

If alpha support becomes more involved, it means the code which handles alpha overlap is isolated and not running when its not needed. (fine to keep glColor4's though, not much point to check alpha there)

1540

is this intended to be part of the patch?

Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 4 2014, 9:13 PM
  • Add bool to check for region overlap and alpha
  • Uncomment tab highlighting. Will remove in separate patch.
Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 4 2014, 11:14 PM
  • Make Active Tab use Region Text Highlight theme color
  • Fix active tab drawing too dark
  • Add bool to check for region overlap and alpha
  • Uncomment tab highlighting. Will remove in separate patch.
  • Remove tab highlighting and clean up

Not really a fan of removing highlight - and not clear why this is done, would prefer to just add alpha support and do any visual changes as a separate patch - but before that, have some agreement on whats wrong with the tabs and why they should change.

Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 4 2014, 11:31 PM
  • Re-add highlighting
Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 5 2014, 1:34 AM
  • Make Active Tab use Region Text Highlight theme color
  • Fix active tab drawing too dark
  • Add bool to check for region overlap and alpha
  • Uncomment tab highlighting. Will remove in separate patch.
  • Remove tab highlighting and clean up
  • Re-add highlighting
  • Add is_alpha bool and remove secondary outline
Jonathan Williamson (carter2422) updated this revision to Unknown Object (????).Feb 5 2014, 1:43 AM
  • Make Active Tab use Region Text Highlight theme color
  • Fix active tab drawing too dark
  • Add bool to check for region overlap and alpha
  • Uncomment tab highlighting. Will remove in separate patch.
  • Remove tab highlighting and clean up
  • Re-add highlighting
  • Add is_alpha bool and remove secondary outline
  • Remove missed highlight fix. To be added in separate patch.

@Campbell Barton (campbellbarton), any qualms with the latest version? It only adds alpha support and doesn't affect anything else (the patch linked in the OP is slightly out of date, just check last revision).

source/blender/editors/interface/interface_panel.c
1493–1494

Good call, will see what I can do.

1540

Yes, the highlight does not play nice with the alpha (gets very bright) and stands out weird. It also gives the tabs a more messy look, even though it adds more depth.

I commented it out for now to give the tabs a cleaner look, that also works better with the transparency.

Eventually what I would like to do, though, is work on the overall widget styles to support both Embossed and Flat styles. Billrey's mockups show the flat very nicely.

Thoughts?

@Jonathan Williamson (carter2422) - the problem with the highlight is blend_color_interpolate_byte has special handling of alpha, in this case I think we're best off to use simple lerp interpolation of RGB and ignore alpha. updating patch now... will commit if its ok.

Committed a very much cut down version of this patch: rB3276b83fda1e49bd007872c8dcd0f1b4c62063a3

To get this all working with alpha seems a lot more involved then you might think, further - Im skeptical of transparency with the tabs themselves, you too easily get interference with the 3d scene or image behind.
Buttons in the region don't draw transparent, and the tabs are basically buttons.

Got the highlight issue solved by using a simpler color blending function which ignores alpha. but didnt commit.

For now, I rather not spend anymore time on this, its quite tricky to get it working really well, and if we want good alpha for this we probably want to have some nice blending between tabs the region background.

Related to this patch - you did raise an issue that tabs dont work nice with dark themes, I checked elysuin theme and it looks OK to me, but if you think there is still issues IMHO we could check on them before 2.70 release.

Sounds good @Campbell Barton (campbellbarton). Agreed, let's not spend any more time on this for now.

re: dark themes, the issue here was with the highlight blending. It sounds like using the simpler interpolation method might do the trick. So that would tentatively solve both highlight strength issue and the dark themes.

The main outstanding issue that I'd like to get solved somehow (perhaps with blending between the Region Background and Tabs, like you said) is the difference between tabs and the region background when the region is transparent This may be wrong, but I believe the active tab at least should always match the region background. As you've said before, though, this becomes more challenging since the tab area is over the region, not next to it. I suggest we try and solve this in 2.71 or so.

Thanks!

Sounds like we're on the same page. committed simple color blending (was silly we didnt have a way to do that).
rB2f01be2b2fe563f634c9f653260940b2a9a78d6d

so at least we won't run into weird alpha behavior again.

Campbell Barton (campbellbarton) abandoned this revision.

Closing, any further changes in this area can be new patches.