mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Save color palette as resources to reuse later
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
This commit is contained in:
parent
eb5103093c
commit
e6a49ab6ac
13 changed files with 456 additions and 11 deletions
|
|
@ -49,6 +49,7 @@ class PopupMenu;
|
|||
class SpinBox;
|
||||
class StyleBoxFlat;
|
||||
class TextureRect;
|
||||
class FileDialog;
|
||||
|
||||
class ColorPresetButton : public BaseButton {
|
||||
GDCLASS(ColorPresetButton, BaseButton);
|
||||
|
|
@ -106,6 +107,14 @@ public:
|
|||
static const int SLIDER_COUNT = 4;
|
||||
|
||||
private:
|
||||
enum class MenuOption {
|
||||
MENU_SAVE,
|
||||
MENU_SAVE_AS,
|
||||
MENU_LOAD,
|
||||
MENU_QUICKLOAD,
|
||||
MENU_CLEAR,
|
||||
};
|
||||
|
||||
static inline Ref<Shader> wheel_shader;
|
||||
static inline Ref<Shader> circle_shader;
|
||||
static inline Ref<Shader> circle_ok_color_shader;
|
||||
|
|
@ -129,6 +138,9 @@ private:
|
|||
Label *picker_preview_label = nullptr;
|
||||
Ref<StyleBoxFlat> picker_preview_style_box;
|
||||
Color picker_color;
|
||||
FileDialog *file_dialog = nullptr;
|
||||
Button *menu_btn = nullptr;
|
||||
PopupMenu *options_menu = nullptr;
|
||||
|
||||
MarginContainer *internal_margin = nullptr;
|
||||
Control *uv_edit = nullptr;
|
||||
|
|
@ -144,6 +156,8 @@ private:
|
|||
HBoxContainer *recent_preset_hbc = nullptr;
|
||||
Button *btn_add_preset = nullptr;
|
||||
Button *btn_pick = nullptr;
|
||||
Label *palette_name = nullptr;
|
||||
String palette_path;
|
||||
Button *btn_preset = nullptr;
|
||||
Button *btn_recent_preset = nullptr;
|
||||
PopupMenu *shape_popup = nullptr;
|
||||
|
|
@ -159,6 +173,10 @@ private:
|
|||
ColorPresetButton *selected_recent_preset = nullptr;
|
||||
Ref<ButtonGroup> preset_group;
|
||||
Ref<ButtonGroup> recent_preset_group;
|
||||
#ifdef TOOLS_ENABLED
|
||||
Callable quick_open_callback;
|
||||
Callable palette_saved_callback;
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
OptionButton *mode_option_button = nullptr;
|
||||
|
||||
|
|
@ -226,6 +244,7 @@ private:
|
|||
|
||||
bool center_slider_grabbers = true;
|
||||
|
||||
Ref<Texture2D> menu_option;
|
||||
Ref<Texture2D> screen_picker;
|
||||
Ref<Texture2D> expanded_arrow;
|
||||
Ref<Texture2D> folded_arrow;
|
||||
|
|
@ -279,6 +298,10 @@ private:
|
|||
void _html_focus_exit();
|
||||
void _pick_button_pressed();
|
||||
void _pick_finished();
|
||||
void _update_menu_items();
|
||||
void _update_menu();
|
||||
void _options_menu_cbk(int p_which);
|
||||
|
||||
// Legacy color picking.
|
||||
void _pick_button_pressed_legacy();
|
||||
void _picker_texture_input(const Ref<InputEvent> &p_event);
|
||||
|
|
@ -286,6 +309,8 @@ private:
|
|||
inline int _get_preset_size();
|
||||
void _add_preset_button(int p_size, const Color &p_color);
|
||||
void _add_recent_preset_button(int p_size, const Color &p_color);
|
||||
void _save_palette(bool p_is_save_as);
|
||||
void _load_palette();
|
||||
|
||||
void _show_hide_preset(const bool &p_is_btn_pressed, Button *p_btn_preset, Container *p_preset_container);
|
||||
void _update_drop_down_arrow(const bool &p_is_btn_pressed, Button *p_btn_preset);
|
||||
|
|
@ -305,6 +330,8 @@ protected:
|
|||
public:
|
||||
#ifdef TOOLS_ENABLED
|
||||
void set_editor_settings(Object *p_editor_settings);
|
||||
void set_quick_open_callback(const Callable &p_file_selected);
|
||||
void set_palette_saved_callback(const Callable &p_palette_saved);
|
||||
#endif
|
||||
HSlider *get_slider(int idx);
|
||||
Vector<float> get_active_slider_values();
|
||||
|
|
@ -322,6 +349,8 @@ public:
|
|||
Color get_pick_color() const;
|
||||
void set_old_color(const Color &p_color);
|
||||
Color get_old_color() const;
|
||||
void _quick_open_palette_file_selected(const String &p_path);
|
||||
void _palette_file_selected(const String &p_path);
|
||||
|
||||
void set_display_old_color(bool p_enabled);
|
||||
bool is_displaying_old_color() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue