Fix eyedropper outside blender on mac #115187
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115187
Loading…
Reference in New Issue
No description provided.
Delete Branch "rajveermalviya/blender:eyedrop-mac"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Updates #111303 - adding support for picking color from outside of blender window on macOS, but there are limitations (similar to X11 impl):
This differs from GIMP where it listens to mouse events and updates the color continuously (which results in macOS assuming it's doing a screen recording and shows the screen recording indicator in the taskbar).
Here's the current behavior:
15801b1606
to734a86d88c
WIP: Fix eyedropper outside blender on macto Fix eyedropper outside blender on mac@blender-bot build macos
@blender-bot build macos package
Unknown platform
package
. See documentation for details.@blender-bot package macos
Package build started. Download here when ready.
@rajveermalviya
Nice!
Your uses of line comments with "//" in GHOST_SystemCocoa::getPixelAtCursor should be changed to block comments delimited by "/⁎" and "⁎/"
This compiles okay, and I made builds of it available for testing here:
Because our DevTalk site is currently under DDOS attack, I created a call for testing on BlenderArtists here: https://blenderartists.org/t/testing-requested-for-mac-eyedropper-builds/1494179
734a86d88c
to256e0e43c7
Updated!
Thanks!
There has only been one person responding to the thread on Blenderartists so far, here: https://blenderartists.org/t/testing-requested-for-mac-eyedropper-builds/1494179
They are reporting some successes and some returns of (0,0,0). That return is just the default returned if your getPixelAtCursor returns GHOST_kFailure. So my gut feeling is that will be something simple.
The first part that looks suspicious is when there is a call to CGGetDisplaysWithPoint in order to figure out which display contains the mouse location. You are passing
1
as the second argument and therefore getting only the first display that contains the point. But the docs for that imply that more than one display can contain the location and that there are times you might call that function with maxDisplays set to zero or with dspys set to NULL. You might want to pass an array to dspys of size maxDisplays and then examine the return of dspyCnt. https://developer.apple.com/documentation/coregraphics/1454385-cggetdisplayswithpointYou could even consider using the displayid of the main display if you fail with the above.
256e0e43c7
to7442892cee
Ah, I hadn't tested with external monitor, now did it and it's seems to be failing for me as well, I tried to fix it with current impl but
CGDisplayCreateImageForRect
kept returningnil
when trying to capture the secondary extended display.I tried following fixes, with no luck:
CGGetDisplaysWithRect
instead ofCGGetDisplaysWithPoint
CGGetDisplaysWithRect(rect, maxDisplayCount, displays, &displayCount)
and looping over the displays array withCGDisplayCreateImageForRect
.At the end I updated the impl to use
CGWindowListCreateImage
instead, and it works correctly for me, even with the secondary extended displays. But do note thatCGWindowListCreateImage
got deprecated in macOS 14 (Sonoma) but it's still available - the recommendation is to use ScreenCaptureKit API instead butSCScreenshotManager
(what we need) is only available in macOS 14+ & it's callback based.IMO we should keep using
CGWindowListCreateImage
and migrate to the new API later.Another alternative is to use the callback based API
NSColorSampler
I described in #111303 (comment), but even that may have some caveats (described in that comment).We currently support back to 10.15 (Catalina) on Intel, 11 (Big Sur) on Apple Silicon. So it will be quite a while before we can rely on something as new ScreenCaptureKit.
I would just go with what you have and we can revisit later. Even if we have to add parallel code for the different versions.
Let's make a new build.
@blender-bot package macos
@blender-bot package macos
Package build started. Download here when ready.
Buildbot is having some issues that the moment. Did manage to build without errors on ARM, but is failing some tests unrelated to this PR.
Will try again later.
@blender-bot package macos
Package build started. Download here when ready.
@blender-bot package macos
Package build started. Download here when ready.
7442892cee
tod5303d90a0
Rebased to main, if it makes any difference.
@blender-bot package macos
Package build started. Download here when ready.
@Harley seems like the build succeeded this time.
Awesome!
I've added a comment to that BlenderArtist thread for the one tester, who reported multi-monitor issues, to try again.
https://blenderartists.org/t/testing-requested-for-mac-eyedropper-builds/1494179/7
Implementation looks good to me.
@Harley, looks like now it works correctly for them. :)
https://blenderartists.org/t/testing-requested-for-mac-eyedropper-builds/1494179/8
Yes, that is the same person who commented on the BlenderArtists thread - I made that one there during the cyberattack. But this might be all we get for feedback for now. So you plus two others might have to do.
This isn't very potentially harmful in that this code isn't even called when selecting from a blender window, so I might just make do a build looking for any compiler warnings or formatting issues then commit if fine.
@blender-bot build macos