From 72ade00e2b1861fe700155408a17f9940c3abe9e Mon Sep 17 00:00:00 2001 From: Mounir Tohami <53877170+WhalesState@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:14:28 +0300 Subject: [PATCH] Enable `ColorPicker` RGB+RAW modes to have greater values for over bright. (cherry picked from commit blazium-engine/blazium@f7c6762df94867d93465612ec6be86b28593dc47) --- scene/gui/color_mode.h | 3 +++ scene/gui/color_picker.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/scene/gui/color_mode.h b/scene/gui/color_mode.h index dd2db5bf272..380969bfbe6 100644 --- a/scene/gui/color_mode.h +++ b/scene/gui/color_mode.h @@ -48,6 +48,7 @@ class ColorMode { virtual float get_spinbox_arrow_step() const { return get_slider_step(); }; virtual String get_slider_label(int idx) const = 0; virtual float get_slider_max(int idx) const = 0; + virtual bool can_allow_greater() const { return false; }; virtual float get_slider_value(int idx) const = 0; virtual Color get_color() const = 0; @@ -95,6 +96,7 @@ class ColorModeRGB : public ColorMode { virtual float get_slider_step() const override { return 1; } virtual String get_slider_label(int idx) const override; virtual float get_slider_max(int idx) const override; + virtual bool can_allow_greater() const override { return true; }; virtual float get_slider_value(int idx) const override; virtual Color get_color() const override; @@ -116,6 +118,7 @@ class ColorModeRAW : public ColorMode { virtual float get_spinbox_arrow_step() const override { return 0.01; } virtual String get_slider_label(int idx) const override; virtual float get_slider_max(int idx) const override; + virtual bool can_allow_greater() const override { return true; }; virtual float get_slider_value(int idx) const override; virtual Color get_color() const override; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index d4e40e284f5..f36e63d133d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -633,6 +633,7 @@ void ColorPicker::_update_color(bool p_update_sliders) { float spinbox_arrow_step = modes[current_mode]->get_spinbox_arrow_step(); for (int i = 0; i < current_slider_count; i++) { sliders[i]->set_max(modes[current_mode]->get_slider_max(i)); + sliders[i]->set_allow_greater(modes[current_mode]->can_allow_greater()); sliders[i]->set_step(step); values[i]->set_custom_arrow_step(spinbox_arrow_step); sliders[i]->set_value(modes[current_mode]->get_slider_value(i));