godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.17k stars 21.2k forks source link

Color picking not working on Windows #68979

Closed KoBeWi closed 1 year ago

KoBeWi commented 1 year ago

Godot version

4.0 11e1c83

System information

Windows 10 x64

Issue description

The color never changes. Not for the property, nor for the button. According to the discussion in #63886, this is a Windows-specific issue.

Steps to reproduce

  1. Be on Windows
  2. Open ColorPicker
  3. Click the eyedrop button
  4. Try to pick some color

Minimal reproduction project

N/A

duianto commented 1 year ago

v4.0.beta5.official [89a33d28f], Win 10 22H2

It does work if the Color popup is closed with esc after clicking on the eye dropper icon:

https://user-images.githubusercontent.com/13420573/203299627-62cd558e-3f2a-46f7-91d9-d75befd14a9a.mp4

When this is fixed, so that the eye dropper works while the color popup is open, then the eye dropper probably should be canceled when the color popup is closed with esc.

Sauermann commented 1 year ago

While investigating this issue I tracked it to this: https://github.com/godotengine/godot/blob/6318320c04f348eee1df7a5dae3bad540ef1fdcc/scene/gui/color_picker.cpp#L1408-L1429 Is it possible, that this is related to the Control->Window conversion?

I verified, that this problem also exists in v4.0.alpha1.official [31a7ddbf8] on Linux X11:

In v4.0.beta.custom_build [6318320c0] on Linux X11:

stmSi commented 1 year ago

I saw weird things happening while debugging ColorPicker::_screen_input. The first Mouse Click Event doesn't not enter yet... after u click again.... two clicks events enter continuously.

  1. First comment out this so that u can capture screen click events as long as u want. (in _notification)

image


  1. insert these lines (in _screen_input)

image


  1. select color picker and click it. nothings happens. click again... "LEFT" will print 2 TIMES

image


  1. Color will set successfully.
nezvers commented 1 year ago

Godot 4 Beta 15 on Windows eyedropper does not pick a color.

Sauermann commented 1 year ago

The relevant code section has this comment: // TODO: show modal no longer works, needs to be converted to a popup.

So I did some experiment with popups. Current status is that I ran into the problem that Popups can not be made transparent reliably (previously the Control screen simply was transparent). So I believe, that it is currently not possible to solve this by a simple replacement Control->Window

In a second attempt I tried to solve this with the Drag & Drop mechanic. This might be possible, but becomes quite complex.

JohanAR commented 1 year ago

I've considered a couple of alternative ideas, that may or may not work in reality..

1) Use some OS-specific code for eye dropping a colour instead of trying to implement it using Godot objects. 2) Hide the ColorPicker popup while using the eyedropper, and open it again after the user has clicked the main window. Possibly with some kind of decoration, like a thick frame around the window, or a small notification e.g. "click to pick a colour, or Esc to cancel", to give some kind of indication that the popup didn't just disappear. 3) Remove eye dropper. Maybe people aren't using it anyway?