Page MenuHome

UI: Fix Transform Gizmo 2D and Transform Gizmo 3D low highlight contrast and inconsistency throughout all gizmos
Needs RevisionPublic

Authored by Juan (jc4d) on Jun 15 2020, 11:22 AM.
Tags
None
Tokens
"Like" token, awarded by Kickflipkid687."Love" token, awarded by gilberto_rodrigues."Like" token, awarded by CobraA."Love" token, awarded by jfmatheu."Love" token, awarded by HooglyBoogly.

Details

Summary

This patch addresses two issues:

1- The lack of contrasts when the cursor hovers over the transform gizmo which is almost imperceptible.

2- Giving consistency among all the gizmos.
Before the patch when the cursor hovers over the the Interactive Navigation in the 3D Viewport or when it hovers over the Extrude operation or the Spin operation among others the gizmos always get highlighted with a white color, but the Transform gizmo (drag, rotate and scale) it doesn't follow this rule. Therefore, this patch solve the consistency between all of them.

Here is a video showing the before and after in action:

Thank you for your consideration.

Diff Detail

Repository
rB Blender

Event Timeline

Juan (jc4d) requested review of this revision.Jun 15 2020, 11:22 AM
Juan (jc4d) created this revision.

Just to inform you,this won't work on light themes or grease pencil template since the background is white, better make it a theme option with a complete different color like orange , yellow etc.

Just to inform you,this won't work on light themes or grease pencil template since the background is white, better make it a theme option with a complete different color like orange , yellow etc.

Yes, I was just following the rest of the gizmos. The same thing happens if you hover over the extrude gizmo on a light background.
The good thing is that I agreed with the developers to move it to the preferences so is not hard coded. 🙂

Brecht Van Lommel (brecht) requested changes to this revision.Jun 25 2020, 5:42 PM

I guess this patch is work in progress, and that further changes are planned to solve the hardcoded values.

This revision now requires changes to proceed.Jun 25 2020, 5:42 PM
Juan (jc4d) updated this revision to Diff 26477.Jul 2 2020, 7:59 PM

This differential update moves the gizmo highlight hardcoded to the preferences where the user can choose any color that adapts better to their personal theme.

Thank you for your consideration.

Hans Goudey (HooglyBoogly) requested changes to this revision.Jul 2 2020, 8:33 PM

Thanks, a good improvement to have all of these consistent, and themeable! There just seems to be some issues of code placement. Sometimes that's the hardest problem..

Also, these will need versioning to add the new default highlight color to themes when they open the new version for the first time. (see versioning_userdef.c)

source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
65

#include "UI_resources.h" (Same everywhere else)

source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
688

I may be missing something, but it looks like these colors should be set in the "setup" function for each gizmo rather than the "draw" function.
What you have works, but it looks like it's getting the color from the theme on every single redraw, vs on setup, which is the way it looks like it is now.

I think this will be a problem wherever there is a gizmo_color_get call above your new line, or wherever "UI_resources.h" wasn't included already, unless all of the gizmo's colors were hardcoded before.

I might be wrong though, as it looks like gizmo_cage2d_setup is empty, so I'm not sure where its color is defined.

source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
377

Oops, careful about adding blank space. Using clang format on save will automatically correct this stuff. (see https://wiki.blender.org/wiki/Tools/ClangFormat)

This revision now requires changes to proceed.Jul 2 2020, 8:33 PM
Juan (jc4d) marked 2 inline comments as done.

This patch was updated by following the advises from the developer.

Small comments clean up.

Hans Goudey (HooglyBoogly) requested changes to this revision.Jul 22 2020, 4:45 PM

I still feel that the only time where theme colors should be retrieved from the theme is in the setup function. Mostly that works fine, but you are right that there are certain cases where that doesn't work.
For example, the GIZMO_GT_move_3d in the spin tool always takes on the highlight color if you set the highlight color in the setup function. But my guess is that this is a problem on its own.

We really need @Campbell Barton (campbellbarton)'s input here though, as he is the one who designed this system.

source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
65

I meant these should use quotes " instead of <.

Also, look at the comment above these three lines: "own includes". Group these includes with the existing UI_* includes.

This revision now requires changes to proceed.Jul 22 2020, 4:45 PM

I still feel that the only time where theme colors should be retrieved from the theme is in the setup function. Mostly that works fine, but you are right that there are certain cases where that doesn't work.
For example, the GIZMO_GT_move_3d in the spin tool always takes on the highlight color if you set the highlight color in the setup function. But my guess is that this is a problem on its own.

We really need @Campbell Barton (campbellbarton)'s input here though, as he is the one who designed this system.

Do we wait for @Campbell Barton (campbellbarton) to proceed before fixing what you commented, or do I update the diff now?

Juan (jc4d) marked an inline comment as done.

Corrected the #include issues, but we better wait as you suggested to see how we proceed from here. :)

Campbell Barton (campbellbarton) requested changes to this revision.Aug 13 2020, 2:28 PM

I'd rather hold off this patch just now, although the premise may be OK.

First of all, whats the desired outcome?

  • That all gizmos use the theme color for highlighting?
  • Are we sure users want transform gizmos to highlight white (maybe it's useful to see color for the axis).

If we want this to be a default, we could assign this in the function that creates gizmos.

Although we might not want this everywhere, did you try doing this?

source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
281

Selection function shouldn't be loading the color.

This revision now requires changes to proceed.Aug 13 2020, 2:28 PM