Skip to content

Commit

Permalink
Untangle ColorPicker includes
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Nov 22, 2024
1 parent 9e60984 commit 289e548
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 34 deletions.
1 change: 1 addition & 0 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "scene/3d/fog_volume.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/grid_container.h"
#include "scene/main/window.h"
#include "scene/resources/font.h"
#include "scene/resources/mesh.h"
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#include "scene/gui/center_container.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/flow_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/split_container.h"
#include "scene/gui/subviewport_container.h"
#include "scene/resources/3d/sky_material.h"
Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
#include "editor/window_wrapper.h"
#include "scene/gui/separator.h"
#include "scene/gui/texture_rect.h"
#include "scene/main/node.h"
#include "scene/main/window.h"
#include "script_text_editor.h"
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "editor/editor_string_names.h"
#include "editor/gui/editor_toaster.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/split_container.h"

Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/theme_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
#include "scene/gui/tab_bar.h"
#include "scene/gui/tab_container.h"
Expand Down
6 changes: 6 additions & 0 deletions editor/plugins/theme_editor_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@
#include "scene/gui/check_button.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/color_rect.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/tree.h"
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "scene/gui/rich_text_label.h"
#include "scene/gui/separator.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
#include "scene/gui/view_panner.h"
#include "scene/main/window.h"
Expand Down
2 changes: 0 additions & 2 deletions scene/gui/color_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

#include "scene/gui/color_picker.h"

struct Color;

class ColorMode {
public:
ColorPicker *color_picker = nullptr;
Expand Down
20 changes: 10 additions & 10 deletions scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,25 @@

#include "color_picker.h"

#include "core/input/input.h"
#include "core/io/image.h"
#include "core/math/color.h"
#include "scene/gui/aspect_ratio_container.h"
#include "scene/gui/color_mode.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/style_box_flat.h"
#include "scene/resources/style_box_texture.h"
#include "scene/theme/theme_db.h"
#include "servers/display_server.h"
#include "thirdparty/misc/ok_color_shader.h"

List<Color> ColorPicker::preset_cache;
List<Color> ColorPicker::recent_preset_cache;

void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
Expand Down Expand Up @@ -159,10 +163,6 @@ void ColorPicker::_update_theme_item_cache() {
theme_cache.base_scale = get_theme_default_base_scale();
}

Ref<Shader> ColorPicker::wheel_shader;
Ref<Shader> ColorPicker::circle_shader;
Ref<Shader> ColorPicker::circle_ok_color_shader;

void ColorPicker::init_shaders() {
wheel_shader.instantiate();
wheel_shader->set_code(R"(
Expand Down
40 changes: 18 additions & 22 deletions scene/gui/color_picker.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,24 @@
#ifndef COLOR_PICKER_H
#define COLOR_PICKER_H

#include "scene/gui/aspect_ratio_container.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/popup.h"
#include "scene/gui/separator.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/style_box_flat.h"

class AspectRatioContainer;
class ColorMode;
class ColorModeRGB;
class ColorModeHSV;
class ColorModeRAW;
class ColorModeOKHSL;
class ColorPickerShape;
class GridContainer;
class HSlider;
class Label;
class LineEdit;
class MarginContainer;
class MenuButton;
class OptionButton;
class PopupMenu;
class SpinBox;
class StyleBoxFlat;
class TextureRect;

class ColorPresetButton : public BaseButton {
GDCLASS(ColorPresetButton, BaseButton);
Expand Down Expand Up @@ -110,11 +106,11 @@ class ColorPicker : public VBoxContainer {
static const int SLIDER_COUNT = 4;

private:
static Ref<Shader> wheel_shader;
static Ref<Shader> circle_shader;
static Ref<Shader> circle_ok_color_shader;
static List<Color> preset_cache;
static List<Color> recent_preset_cache;
static inline Ref<Shader> wheel_shader;
static inline Ref<Shader> circle_shader;
static inline Ref<Shader> circle_ok_color_shader;
static inline List<Color> preset_cache;
static inline List<Color> recent_preset_cache;

#ifdef TOOLS_ENABLED
Object *editor_settings = nullptr;
Expand Down

0 comments on commit 289e548

Please sign in to comment.