Eyedropper Color Preview
AcceptedPublic

Authored by Marcelo Mutzbauer (1xundoredo) on Sep 9 2015, 2:08 PM.

Details

Summary

The color property gets set on mouse movement when the p key is pressed. When the p key gets released or the operator gets cancelled, the color will be reset to the state before the operator ran.
This helps choosing a color because you do not have to 'guess' what color your mouse cursor is on.

Diff Detail

Repository
rB Blender
Branch
_eyedropper_cpreview

This is a nice little feature @Marcelo Mutzbauer (1xundoredo). It works quite well from the user side (I cannot speak to the code side).

However, it has the same issue that many of our modal operators have, in that it has very low discoverability. This is not so much of an issue since it's a non-essential feature, but it's still less than optimal for the sake of actually helping people use it.

Until we have a better way to present additional user information within a modal the best way to give more feedback is through the Eyedropper tool tip. Currently the eye dropper tool tip is pretty poor: Sample a data-block from the 3D View. This is poor because many users won't know what a "data-block" is in this context and because the eyedropper works on any color element (even the UI).

You could utilize the tooltip to introduce the CTRL key concept. We already do this with 3D View Layers:

  • Change tooltip to 'Sample a data-block from this window - Hold Ctrl to preview color'
  • Fix some updating problems in user prefs
  • Code Style: no cuddled else
  • Fix problem with alpha channel
  • Change tooltip to 'Sample a color from this window - Hold Ctrl for preview'

Looking good, just two minor suggestions.

source/blender/editors/interface/interface_eyedropper.c
167

Would cast here: (Eyedropper *)op->customdata

333–334

Maybe pack this into own function eyedropper_color_reset which can be called from here and eyedropper_cancel.

This revision is now accepted and ready to land.Sep 27 2015, 2:53 AM
  • Moved reset to separate function
  • op->customdata casted (in the arguments for the reset function)

@Jonathan Williamson (carter2422), @venomgfx, @Paweł Łyczkowski (plyczkowski), anything to add or do you think it's ready to go?

source/blender/editors/interface/interface_eyedropper.c
165

We like to use doxygen style comments which could be used here, too:

/**
 * blahblah
 */
  • Use Doxygen-style comment for reset function
  • Invoke eyedropper via Ctrl+E
Julian Eisel (Severin) requested changes to this revision.EditedMar 5 2016, 9:05 PM

Noticed it would be preferable to have a configurable key for activating the preview. Committed support for customizable eyedropper keymap (rBc1d05faa24af02e50). @Marcelo Mutzbauer (1xundoredo), would you mind updating the patch so this is used?

Note, for the operator description you can use WM_modalkeymap_operator_items_to_string to get a string for the final keymap item.

This revision now requires changes to proceed.Mar 5 2016, 9:05 PM
  • Update for customizable keymap

It seems that keymaps are only being initialized once operator types have been, which makes it difficult to introduce those shortcuts in the tooltip(Keys not available yet in init func).
Alternatively, it would be possible to place hints below the cursor during operator execution(below the sampled pixel).

@Julian Eisel (Severin) if we're able to address the issue of showing the keymap in the tooltip then this can probably get committed. I'd like to give it a run through again, though, just need to pull down and compile when I've got a moment.

Don't think there's a nice way to support displaying the keymap item string in the tooltip. Only if we added support for dynamically generated operator descriptions/tooltips (which in fact might be useful to have). So for me this is good to go, even if I'd really like to have the tooltip thing working (this is a general issue in Blender though).

@Marcelo Mutzbauer (1xundoredo), you'll need to update the patch again, mainly because eyedropper code was split into multiple files. Other than that, I'd be fine with committing this. You can send me your email address if you want me to commit with you as author.

source/blender/makesrna/intern/rna_userdef.c
3811

Could you describe why this is needed? Is it even?

This revision is now accepted and ready to land.Apr 8 2018, 4:47 PM