UI: Allow Eyedropper Outside of Blender #105324

Merged
Harley Acheson merged 3 commits from Harley/blender:Eyedropper into main 2023-08-16 01:14:43 +02:00
Member

This adds a new Ghost function, GHOST_GetPixelAtCursor, that allows
picking colors from outside of Blender windows. This only has an
implementation for the Windows platform, but this should allow other
platforms to also do so if possible.


Seems to work as advertised. Gets the same colors as Gimp does. It doesn't show the eyedropper mouse cursor outside of our windows, but that does not seem (normally) possible. Other apps that pick outside of their borders also show the regular pointer cursor while doing so.

Eyedropper.gif

This adds a new Ghost function, GHOST_GetPixelAtCursor, that allows picking colors from outside of Blender windows. This only has an implementation for the Windows platform, but this should allow other platforms to also do so if possible. --- Seems to work as advertised. Gets the same colors as Gimp does. It doesn't show the eyedropper mouse cursor outside of our windows, but that does not seem (normally) possible. Other apps that pick outside of their borders also show the regular pointer cursor while doing so. ![Eyedropper.gif](/attachments/4896bda7-68ed-44ab-b1d1-394f68be32fb)
Author
Member

I started this in response to a shout-out from @pablovazquez on this week's Blender Today episode. He mentioned that it might be nice for me to get this working on Windows.

I started this in response to a shout-out from @pablovazquez on this week's Blender Today episode. He mentioned that it might be nice for me to get this working on Windows.
Author
Member

Looks like mouse capture only works when a mouse button is held down. This why I can set "no drop" cursor for area join when outside the window, but can't show "eyedropper" cursor here.

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setcapture

Looks like mouse capture only works when a mouse button is held down. This why I can set "no drop" cursor for area join when outside the window, but can't show "eyedropper" cursor here. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setcapture
Harley Acheson force-pushed Eyedropper from 1f566948bc to 6df371e560 2023-03-01 23:55:44 +01:00 Compare
Author
Member

@blender-bot package windows

@blender-bot package windows
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR105324) when ready.
Harley Acheson changed title from WIP: UI: Allow Eyedropper Outside of Blender (W32) to UI: Allow Eyedropper Outside of Blender (W32) 2023-03-08 00:06:47 +01:00
Harley Acheson force-pushed Eyedropper from a32f5fed22 to e8831987b7 2023-03-11 16:33:19 +01:00 Compare
Harley Acheson changed title from UI: Allow Eyedropper Outside of Blender (W32) to UI: Allow Eyedropper Outside of Blender 2023-03-11 16:34:10 +01:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson changed title from UI: Allow Eyedropper Outside of Blender to WIP: UI: Allow Eyedropper Outside of Blender 2023-03-16 16:33:21 +01:00
Author
Member

Set to WIP. Will check this weekend to see if the access to this should instead be a wrapper in WM_api

Set to WIP. Will check this weekend to see if the access to this should instead be a wrapper in WM_api
Harley Acheson force-pushed Eyedropper from e8831987b7 to d6fe8c8c68 2023-03-16 21:11:44 +01:00 Compare
Author
Member

Now using a WM_desktop_cursor_sample_read wrapper around the ghost function.

Now using a WM_desktop_cursor_sample_read wrapper around the ghost function.
Harley Acheson changed title from WIP: UI: Allow Eyedropper Outside of Blender to UI: Allow Eyedropper Outside of Blender 2023-03-16 21:13:26 +01:00
Harley Acheson requested review from Campbell Barton 2023-03-16 21:13:48 +01:00
Harley Acheson force-pushed Eyedropper from d6fe8c8c68 to 824ece3f16 2023-03-21 16:21:46 +01:00 Compare
Harley Acheson added this to the User Interface project 2023-04-01 18:00:33 +02:00
Harley Acheson force-pushed Eyedropper from 824ece3f16 to 9b2ad2761f 2023-04-15 21:31:25 +02:00 Compare
Harley Acheson force-pushed Eyedropper from 9b2ad2761f to 009748a2e5 2023-04-16 22:42:00 +02:00 Compare
Harley Acheson force-pushed Eyedropper from 009748a2e5 to 5f892ba7fe 2023-05-17 23:33:35 +02:00 Compare
Harley Acheson force-pushed Eyedropper from 5f892ba7fe to 8461434275 2023-05-27 00:26:03 +02:00 Compare
First-time contributor

Any news on this? Thx...

Any news on this? Thx...
Author
Member

Any news on this? Thx...

It's on my wish list for 4.0. It is just in the review queue, but should be a fairly straight-forward one.

> Any news on this? Thx... It's on my wish list for 4.0. It is just in the review queue, but should be a fairly straight-forward one.
Harley Acheson force-pushed Eyedropper from 8461434275 to a4edce178b 2023-07-31 03:11:06 +02:00 Compare
Brecht Van Lommel requested changes 2023-08-15 20:00:48 +02:00
@ -766,1 +766,4 @@
/**
* Get the color of the pixel at the current mouse cursor location
* \param r_color: returned RGB float colors

Can you change RGB -> sRGB to clarify the color space. Here and a few other places that repeat the same comment.

Can you change RGB -> sRGB to clarify the color space. Here and a few other places that repeat the same comment.
Harley marked this conversation as resolved
@ -371,0 +366,4 @@
const char *display_device = CTX_data_scene(C)->display_settings.display_device;
ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
IMB_colormanagement_display_to_scene_linear_v3(r_col, display);

Use IMB_colormanagement_srgb_to_scene_linear_v3 instead if the color came from another window.

When doing color picker of for a 3D viewport or render that Blender displays then taking into account the view transform makes sense. But from another window, it seems wrong to me.

Use `IMB_colormanagement_srgb_to_scene_linear_v3` instead if the color came from another window. When doing color picker of for a 3D viewport or render that Blender displays then taking into account the view transform makes sense. But from another window, it seems wrong to me.
Harley marked this conversation as resolved
Harley Acheson added 2 commits 2023-08-15 23:29:41 +02:00
Brecht Van Lommel approved these changes 2023-08-15 23:47:15 +02:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit 5741a5d433 into main 2023-08-16 01:14:43 +02:00
Harley Acheson deleted branch Eyedropper 2023-08-16 01:14:57 +02:00
First-time contributor

Since Blender gets immediately unfocused after using the eyedropper outside of the window, you cannot use it to grab an average color or a gradient for a Color Ramp. Substance Designer lets you pick a gradient with images outside of the window without unfocusing it, so i know it's something possible to do.

Since Blender gets immediately unfocused after using the eyedropper outside of the window, you cannot use it to grab an average color or a gradient for a Color Ramp. Substance Designer lets you pick a gradient with images outside of the window without unfocusing it, so i know it's something possible to do.
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#105324
No description provided.