Skip to content

Commit

Permalink
Highlight scripts used by current scene
Browse files Browse the repository at this point in the history
  • Loading branch information
aXu-AP committed Nov 5, 2024
1 parent b00e1cb commit f168d0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,9 @@
<member name="text_editor/script_list/group_help_pages" type="bool" setter="" getter="">
If [code]true[/code], class reference pages are grouped together at the bottom of the Script Editor's script list.
</member>
<member name="text_editor/script_list/highlight_scene_scripts" type="bool" setter="" getter="">
If [code]true[/code], the scripts that are used by the current scene are highlighted in the Script Editor's script list.
</member>
<member name="text_editor/script_list/list_script_names_as" type="int" setter="" getter="">
Specifies how script paths should be displayed in Script Editor's script list. If using the "Name" option and some scripts share the same file name, more parts of their paths are revealed to avoid conflicts.
</member>
Expand Down
1 change: 1 addition & 0 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/script_list/sort_members_outline_alphabetically", false, true);
_initial_set("text_editor/script_list/script_temperature_enabled", true);
_initial_set("text_editor/script_list/script_temperature_history_size", 15);
_initial_set("text_editor/script_list/highlight_scene_scripts", true);
_initial_set("text_editor/script_list/group_help_pages", true);
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "text_editor/script_list/sort_scripts_by", 0, "Name,Path,None");
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "text_editor/script_list/list_script_names_as", 0, "Name,Parent Directory And Name,Full Path");
Expand Down
6 changes: 2 additions & 4 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2185,8 +2185,6 @@ void ScriptEditor::_update_script_colors() {
continue;
}

script_list->set_item_custom_bg_color(i, Color(0, 0, 0, 0));

if (script_temperature_enabled) {
int pass = n->get_meta("__editor_pass", -1);
if (pass < 0) {
Expand All @@ -2212,7 +2210,7 @@ void ScriptEditor::_update_script_names() {

HashSet<Ref<Script>> used;
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (edited) {
if (edited && EDITOR_GET("text_editor/script_list/highlight_scene_scripts")) {
_find_scripts(edited, edited, used);
}

Expand Down Expand Up @@ -2382,7 +2380,7 @@ void ScriptEditor::_update_script_names() {
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 */
if (sedata_filtered[i].used) {
script_list->set_item_custom_bg_color(index, Color(88 / 255.0, 88 / 255.0, 60 / 255.0));
script_list->set_item_custom_bg_color(index, Color(.5, .5, .5, .125));
}
if (tab_container->get_current_tab() == sedata_filtered[i].index) {
script_list->select(index);
Expand Down

0 comments on commit f168d0c

Please sign in to comment.