-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ColorPicker
's RAW mode colors and values
#88072
Conversation
WhalesState
commented
Feb 7, 2024
•
edited
Loading
edited
- Fixes: Switching to RAW mode and then to RGB will change slider max value until refreshed #62894
- Makes RAW sliders colored same as RGB mode.
- Fix RAW mode maximum values, from 100 to 1.0.
- Allow RGB and RAW modes to have greater values for overbright.
- Changes RAW step value to 1.0 / 255.0, to match the RGB mode values when changed.
- Prevent OKHSL mode from overriding the picker shape.
- Fix conversion between RAW and RGB modes when color is overbright.
9b7e6fe
to
a9acca2
Compare
Please add the bug label too, since it fixes three annoying issues. |
Please open a bug report first :) Remember you need to add "fixes" before each issue number |
Thanks ^^ |
We share the same fix |
Being able to set values greater than 1.0 in raw mode is a feature, not a bug. #62894 is about not restoring the maximum value of the slider when going back to RGB mode, not changing the max value in raw mode. |
we can still allow this feature by making the however, allowing both RGB and RAW mode to set greater values will fix this issue and keep the feature. |
Yes, it is for colors that are overbright in cases such as emissive colors with glow effects, or using modulate to brighten something. I wouldn't suggest using allow_greater on the RAW mode sliders and limiting them to 1, because afaik the main reason raw mode is used at all is for overbright colors. RGB mode uses code specifically (see get_slider_max *edit) to set different slider max values in the case where you switched from raw and still want to edit the overbright color I guess but I'm not sure that that part is usefull, and you could just as easily switch to HSV instead (which would be more helpful to edit an overbright color) now that raw is a separate tab from RGB, but HSV does clamp the overbright color so that's pointless currently. A proper way to deal with overbright colors on all color modes (probably a separate intensity slider) is the only elegant fix I think, but I think making RGB mode use |
ok, after allowing both RGB and RAW modes to have greater values, we are back again to this issue #62894, for some reason the slider maximum value changes after converting from RAW to RGB. The issue is now clear, maximum slider values are not defined for RGB, I think it do calculates it manually which causes this issue. |
dc45daf
to
4a55155
Compare
Hi there, I was going to ask, while we're at it, is it difficult to make it possible to accept negative values as well? I know the most common use case is overbright colors, but negative colors are also used in many graphics tricks, and being able to export one would be great. The thing is that each component in |
The issue is that many properties can't handle negative colors by design (or it'll result in unintended effects). We'd need additional property hints to denote that specific properties can't use negative colors, similar to the existing |
359646e
to
ce4e330
Compare
ce4e330
to
611734c
Compare
@@ -276,7 +276,6 @@ class ColorPicker : public VBoxContainer { | |||
void _copy_color_to_hsv(); | |||
void _copy_hsv_to_color(); | |||
|
|||
PickerShapeType _get_actual_shape() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like unrelated change.
EDIT:
It's covered by #99662
It's better to keep PRs more focused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is here for nearly a year now, and #99662 has merge conflict and was opened 9 months after this PR.
Still not convinced about slider max value change. While it's possible to input bigger number in the SpinBox, you lose ability to adjust overbright via dragging, and I know some people like doing that. Not to mention that pressing Enter to accept SpinBox value will close the popup. |
For RAW and RGB modes, We can allow dragging using the |
With all these |
Maybe i can use this to return the slider max value by default |
Makes sense. |
611734c
to
d389463
Compare
Failed because Spinbox and Slider are shared, will have to update them manually for this to work. |
d389463
to
26ac62e
Compare
Added a new class First i have tried to disconnect the Didn't test it yet since it's still building after the rebase, Just need to know if this approach looks fine. Also I can reuse |
26ac62e
to
cd23f68
Compare
cd23f68
to
d7af676
Compare
Works as expected. Only the alpha slider shares it's value with the alpha spinbox, I ended up using the new Screencast.from.01-26-2025.02.34.15.AM.webm |
@@ -106,20 +112,21 @@ class ColorModeRGB : public ColorMode { | |||
class ColorModeRAW : public ColorMode { | |||
public: | |||
String labels[3] = { "R", "G", "B" }; | |||
float slider_max[4] = { 100, 100, 100, 1 }; | |||
float slider_max[4] = { 1, 1, 1, 1 }; | |||
float spinbox_max[4] = { 10, 10, 10, 255 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: The 4th value is never used because we don't apply this to the alpha SpinBox
. Maybe i can reduce the array size to 3
.