diff options
| author | Paulb23 | 2016-09-15 15:35:25 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-09-18 23:21:48 +0200 |
| commit | 8dca3f3f42540cf801379e76abc48c8cf4476aa0 (patch) | |
| tree | 8e5348df8114acdb166f619ac94cc35a99819ba4 | |
| parent | d2aa006ddbb39c35e594a36d010f51491acef54f (diff) | |
| download | godot-8dca3f3f42540cf801379e76abc48c8cf4476aa0.tar.gz godot-8dca3f3f42540cf801379e76abc48c8cf4476aa0.tar.zst godot-8dca3f3f42540cf801379e76abc48c8cf4476aa0.zip | |
Fix highlight current script when script temputure is disabled
(cherry picked from commit fbd0b6f995667b0874ad76b79c9fbf9c46ed7df9)
| -rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 9d3571a56..c7892bbef 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2046,10 +2046,8 @@ struct _ScriptEditorItemData { void ScriptEditor::_update_script_colors() { - bool enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); bool highlight_current = EditorSettings::get_singleton()->get("text_editor/highlight_current_script"); - if (!enabled) - return; int hist_size = EditorSettings::get_singleton()->get("text_editor/script_temperature_history_size"); Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color"); @@ -2063,22 +2061,25 @@ void ScriptEditor::_update_script_colors() { continue; script_list->set_item_custom_bg_color(i,Color(0,0,0,0)); - if (!n->has_meta("__editor_pass")) { - continue; - } - - int pass=n->get_meta("__editor_pass"); - int h = edit_pass - pass; - if (h>hist_size) { - continue; - } - int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; - float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); bool current = tab_container->get_current_tab() == c; if (current && highlight_current) { script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/current_script_background_color")); - } else { + + } else if (script_temperature_enabled) { + + if (!n->has_meta("__editor_pass")) { + continue; + } + + int pass=n->get_meta("__editor_pass"); + int h = edit_pass - pass; + if (h>hist_size) { + continue; + } + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); + script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); } } |
