diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-11-07 13:18:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 13:18:27 +0100 |
commit | 8e76c5701b5af2b185eab504786cb66b28a01b4a (patch) | |
tree | 6b2b18ce0451c456d547a04acf79527d44b40805 /editor | |
parent | 18d06f4d4f6e02458578db0f14e1a341987db1ed (diff) | |
parent | 66bfa92e84e2334666eb453e33d2f16a353784d9 (diff) |
Merge pull request #32997 from Calinou/editor-color-picker-add-tooltip
Add a tooltip to Color properties in the editor inspector
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index d3d91e6e0d..e14beabfa2 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1884,6 +1884,23 @@ void EditorPropertyColor::_bind_methods() { void EditorPropertyColor::update_property() { picker->set_pick_color(get_edited_object()->get(get_edited_property())); + const Color color = picker->get_pick_color(); + + // Add a tooltip to display each channel's values without having to click the ColorPickerButton + if (picker->is_editing_alpha()) { + picker->set_tooltip(vformat( + "R: %s\nG: %s\nB: %s\nA: %s", + rtos(color.r).pad_decimals(2), + rtos(color.g).pad_decimals(2), + rtos(color.b).pad_decimals(2), + rtos(color.a).pad_decimals(2))); + } else { + picker->set_tooltip(vformat( + "R: %s\nG: %s\nB: %s", + rtos(color.r).pad_decimals(2), + rtos(color.g).pad_decimals(2), + rtos(color.b).pad_decimals(2))); + } } void EditorPropertyColor::setup(bool p_show_alpha) { |