From 8b5992f6658a125f63424a687e15e75ccd36906c Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Tue, 7 Jan 2020 23:09:40 -0300 Subject: [PATCH] Make possible to edit the GraphEdit's selection rect colors --- doc/classes/GraphEdit.xml | 4 ++++ editor/editor_themes.cpp | 2 ++ scene/gui/graph_edit.cpp | 10 ++-------- scene/resources/default_theme/default_theme.cpp | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 3041a7cb7fa..d8732f4f49b 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -316,6 +316,10 @@ + + + + diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 15fb6a95216..2cacc767c8c 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1012,6 +1012,8 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("grid_major", "GraphEdit", Color(0.0, 0.0, 0.0, 0.15)); theme->set_color("grid_minor", "GraphEdit", Color(0.0, 0.0, 0.0, 0.07)); } + theme->set_color("selection_fill", "GraphEdit", theme->get_color("box_selection_fill_color", "Editor")); + theme->set_color("selection_stroke", "GraphEdit", theme->get_color("box_selection_stroke_color", "Editor")); theme->set_color("activity", "GraphEdit", accent_color); theme->set_icon("minus", "GraphEdit", theme->get_icon("ZoomLess", "EditorIcons")); theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons")); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index d1650fea1e0..be465751b6f 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -777,14 +777,8 @@ void GraphEdit::_top_layer_draw() { } if (box_selecting) { - top_layer->draw_rect( - box_selecting_rect, - get_color("box_selection_fill_color", "Editor")); - - top_layer->draw_rect( - box_selecting_rect, - get_color("box_selection_stroke_color", "Editor"), - false); + top_layer->draw_rect(box_selecting_rect, get_color("selection_fill")); + top_layer->draw_rect(box_selecting_rect, get_color("selection_stroke"), false); } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 67351f07d27..cc76df62e59 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -851,6 +851,8 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); + theme->set_color("selection_fill", "GraphEdit", Color(1, 1, 1, 0.3)); + theme->set_color("selection_stroke", "GraphEdit", Color(1, 1, 1, 0.8)); theme->set_color("activity", "GraphEdit", Color(1, 1, 1)); theme->set_constant("bezier_len_pos", "GraphEdit", 80 * scale); theme->set_constant("bezier_len_neg", "GraphEdit", 160 * scale);