Fix highlight current script when script temputure is disabled

This commit is contained in:
Paulb23 2016-09-15 15:35:25 +01:00
parent 4613cb7874
commit fbd0b6f995

View file

@ -1362,10 +1362,8 @@ struct _ScriptEditorItemData {
void ScriptEditor::_update_script_colors() { 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"); 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"); 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"); Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color");
@ -1379,6 +1377,13 @@ void ScriptEditor::_update_script_colors() {
continue; continue;
script_list->set_item_custom_bg_color(i,Color(0,0,0,0)); script_list->set_item_custom_bg_color(i,Color(0,0,0,0));
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 if (script_temperature_enabled) {
if (!n->has_meta("__editor_pass")) { if (!n->has_meta("__editor_pass")) {
continue; continue;
} }
@ -1391,10 +1396,6 @@ void ScriptEditor::_update_script_colors() {
int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; 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); 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 {
script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v));
} }
} }