Skip to content

Commit

Permalink
Enable ColorPicker RGB+RAW modes to have greater values for over br…
Browse files Browse the repository at this point in the history
…ight.

(cherry picked from commit blazium-engine/blazium@f7c6762)
  • Loading branch information
WhalesState authored and Spartan322 committed Oct 23, 2024
1 parent 3a91796 commit 72ade00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scene/gui/color_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 72ade00

Please sign in to comment.