Skip to content

Commit

Permalink
Merge pull request #778 from Spartan322/4.3-add/overbright-colorpicker
Browse files Browse the repository at this point in the history
[4.3] Enable `ColorPicker` RGB+RAW modes to have overbright values
  • Loading branch information
Spartan322 authored Oct 25, 2024
2 parents abe786d + 72ade00 commit 9056ffe
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 @@ -96,6 +97,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_slider_step() const override { return 1.0 / 255.0; }
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 9056ffe

Please sign in to comment.