mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add color pickers to script editor
This commit is contained in:
parent
80a3d205f1
commit
b9f59ae6ca
8 changed files with 458 additions and 5 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "editor/code_editor.h"
|
||||
#include "scene/gui/color_picker.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/option_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class RichTextLabel;
|
||||
|
|
@ -84,6 +85,14 @@ class ScriptTextEditor : public ScriptEditorBase {
|
|||
PopupMenu *highlighter_menu = nullptr;
|
||||
PopupMenu *context_menu = nullptr;
|
||||
|
||||
int inline_color_line = -1;
|
||||
int inline_color_start = -1;
|
||||
int inline_color_end = -1;
|
||||
PopupPanel *inline_color_popup = nullptr;
|
||||
ColorPicker *inline_color_picker = nullptr;
|
||||
OptionButton *inline_color_options = nullptr;
|
||||
Ref<Texture2D> color_alpha_texture;
|
||||
|
||||
GotoLinePopup *goto_line_popup = nullptr;
|
||||
ScriptEditorQuickOpen *quick_open = nullptr;
|
||||
ConnectionInfoDialog *connection_info_dialog = nullptr;
|
||||
|
|
@ -160,6 +169,16 @@ class ScriptTextEditor : public ScriptEditorBase {
|
|||
EDIT_EMOJI_AND_SYMBOL,
|
||||
};
|
||||
|
||||
enum COLOR_MODE {
|
||||
MODE_RGB,
|
||||
MODE_STRING,
|
||||
MODE_HSV,
|
||||
MODE_OKHSL,
|
||||
MODE_RGB8,
|
||||
MODE_HEX,
|
||||
MODE_MAX
|
||||
};
|
||||
|
||||
void _enable_code_editor();
|
||||
|
||||
protected:
|
||||
|
|
@ -185,6 +204,15 @@ protected:
|
|||
void _error_clicked(const Variant &p_line);
|
||||
void _warning_clicked(const Variant &p_line);
|
||||
|
||||
bool _is_valid_color_info(const Dictionary &p_info);
|
||||
Array _inline_object_parse(const String &p_text, int p_line);
|
||||
void _inline_object_draw(const Dictionary &p_info, const Rect2 &p_rect);
|
||||
void _inline_object_handle_click(const Dictionary &p_info, const Rect2 &p_rect);
|
||||
String _picker_color_stringify(const Color &p_color, COLOR_MODE p_mode);
|
||||
void _picker_color_changed(const Color &p_color);
|
||||
void _update_color_constructor_options();
|
||||
void _update_color_text();
|
||||
|
||||
void _notification(int p_what);
|
||||
|
||||
HashMap<String, Ref<EditorSyntaxHighlighter>> highlighters;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue