Merge pull request #55541 from KoBeWi/outcognito_scripts

This commit is contained in:
Rémi Verschelde 2022-01-14 21:04:13 +01:00 committed by GitHub
commit 3efa6644c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 2 deletions

View File

@ -1771,6 +1771,7 @@ struct _ScriptEditorItemData {
String name;
String sort_key;
Ref<Texture2D> icon;
bool tool = false;
int index = 0;
String tooltip;
bool used = false;
@ -1894,6 +1895,7 @@ void ScriptEditor::_update_script_colors() {
int hist_size = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_history_size");
Color hot_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
hot_color.set_s(hot_color.get_s() * 0.9);
Color cold_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
for (int i = 0; i < script_list->get_item_count(); i++) {
@ -1953,6 +1955,7 @@ void ScriptEditor::_update_script_names() {
se->set_meta("_edit_res_path", path);
}
String name = se->get_name();
Ref<Script> scr = se->get_edited_resource();
_ScriptEditorItemData sd;
sd.icon = icon;
@ -1962,6 +1965,9 @@ void ScriptEditor::_update_script_names() {
sd.used = used.has(se->get_edited_resource());
sd.category = 0;
sd.ref = se;
if (scr.is_valid()) {
sd.tool = scr->is_tool();
}
switch (sort_by) {
case SORT_BY_NAME: {
@ -2081,8 +2087,14 @@ void ScriptEditor::_update_script_names() {
}
}
Color tool_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
tool_color.set_s(tool_color.get_s() * 1.5);
for (int i = 0; i < sedata_filtered.size(); i++) {
script_list->add_item(sedata_filtered[i].name, sedata_filtered[i].icon);
if (sedata_filtered[i].tool) {
script_list->set_item_icon_modulate(script_list->get_item_count() - 1, tool_color);
}
int index = script_list->get_item_count() - 1;
script_list->set_item_tooltip(index, sedata_filtered[i].tooltip);
script_list->set_item_metadata(index, sedata_filtered[i].index); /* Saving as metadata the script's index in the tab container and not the filtered one */

View File

@ -392,9 +392,18 @@ String ScriptTextEditor::get_name() {
}
Ref<Texture2D> ScriptTextEditor::get_theme_icon() {
if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) {
if (get_parent_control()) {
String icon_name = script->get_class();
if (script->is_built_in()) {
icon_name += "Internal";
}
if (get_parent_control()->has_theme_icon(icon_name, "EditorIcons")) {
return get_parent_control()->get_theme_icon(icon_name, "EditorIcons");
} else if (get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) {
return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons");
}
}
return Ref<Texture2D>();
}

View File

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1-.56445 2.2578c-.2364329.0758517-.4668872.16921-.68945.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941c-.1119126.2211335-.2072287.4502818-.28516.68555l-2.2539.5625v2l2.2578.56445c.075942.2357685.1692993.465568.2793.6875l-1.1934 1.9902 1.4141 1.4141 1.9941-1.1953c.2211335.111913.4502818.207229.68555.28516l.5625 2.2539h2l.56445-2.2578c.2357685-.07594.465568-.169299.6875-.2793l1.9902 1.1934 1.4141-1.4141-1.1953-1.9941c.111913-.221133.207229-.4502818.28516-.68555l2.2539-.5625v-2l-2.2578-.56445c-.075942-.2357685-.169299-.4655679-.2793-.6875l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953c-.221133-.1119126-.4502818-.2072287-.68555-.28516l-.5625-2.2539zm1 5c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z" fill="none" stroke="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 861 B

View File

@ -2655,6 +2655,15 @@ String VisualScriptEditor::get_name() {
}
Ref<Texture2D> VisualScriptEditor::get_theme_icon() {
String icon_name = "VisualScript";
if (script->is_built_in()) {
icon_name += "Internal";
}
if (Control::has_theme_icon(icon_name, "EditorIcons")) {
return get_parent_control()->get_theme_icon(icon_name, "EditorIcons");
}
return Control::get_theme_icon(SNAME("VisualScript"), SNAME("EditorIcons"));
}

View File

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><circle cx="3" cy="3.000024" fill="#6e6e6e" r="0"/><path d="m11 10a2 2 0 0 0 -1.7324 1 2 2 0 0 0 0 2 2 2 0 0 0 1.7324 1h-2v2h2a2 2 0 0 0 1.7324-1 2 2 0 0 0 0-2 2 2 0 0 0 -1.7324-1h2v-2z" fill="#e0e0e0"/><path d="m3 10v6h2a3 3 0 0 0 3-3v-3h-2v3a1 1 0 0 1 -1 1v-4z" fill="#e0e0e0"/><path d="m7 1-.56445 2.2578a5 5 0 0 0 -.68945.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941a5 5 0 0 0 -.28516.68555l-2.2539.5625v2h5.2715a2 2 0 0 1 -.27148-1 2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1 -.26953 1h5.2695v-2l-2.2578-.56445a5 5 0 0 0 -.2793-.6875l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953a5 5 0 0 0 -.68555-.28516l-.5625-2.2539h-2z" fill="none" stroke="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 742 B