Skip to content

4.4 update tab tooltip based on script_editor resource_path #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions addons/script-tabs/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,23 @@ func _on_tab_hovered(idx):


func _on_scripts_tab_bar_gui_input(event: InputEvent):
if event is InputEventMouseMotion:
var tab_control = _scripts_tab_container.get_tab_control(_last_tab_hovered)
var path = ''
if tab_control:
path = tab_control.get("metadata/_edit_res_path")
_scripts_tab_bar.tooltip_text = '' if path == null else path
if _last_tab_hovered == -1: return

if event is InputEventMouseMotion:
var script_editor := get_editor_interface().get_script_editor()
var script_open_array := script_editor.get_open_scripts()
var script_open_counter: int = 0
var result := [script_open_array[0].resource_path] if _last_tab_hovered == 0 else []
if result.size() < 1:
for i in range(0, _last_tab_hovered + 1):
var tab_title: String = _scripts_tab_bar.get_tab_title(i)
if tab_title.ends_with(".gd"):
result.append(script_open_array[script_open_counter].resource_path)
script_open_counter += 1
else:
result.append(tab_title)
_scripts_tab_bar.set_tab_tooltip(_last_tab_hovered, result[_last_tab_hovered])

if event is InputEventMouseButton:
if event.is_pressed() and event.button_index == MOUSE_BUTTON_MIDDLE:
_simulate_item_clicked(_last_tab_hovered, MOUSE_BUTTON_MIDDLE)
Expand Down