From 40624ceb23be8f514fb4d57f13e795ff9f6d3417 Mon Sep 17 00:00:00 2001 From: Loregret Date: Thu, 14 Sep 2023 12:46:39 +0300 Subject: [PATCH] v.1.5.9 - Custom Docs Fix --- addons/script_panel_plus/plugin.cfg | 2 +- addons/script_panel_plus/plugin.gd | 3 +++ .../script_panel/script_panel.gd | 26 ++++++++++++------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/addons/script_panel_plus/plugin.cfg b/addons/script_panel_plus/plugin.cfg index 05d419a..d820f99 100644 --- a/addons/script_panel_plus/plugin.cfg +++ b/addons/script_panel_plus/plugin.cfg @@ -3,5 +3,5 @@ name="Script Panel Plus" description="Script Panel Plus is a replacement plugin for a built-in Godot's scripting panel. It has more features and makes script-organizing a better experience." author="Loregret" -version="1.5.8" +version="1.5.9" script="plugin.gd" diff --git a/addons/script_panel_plus/plugin.gd b/addons/script_panel_plus/plugin.gd index 7d6ea2a..8032c40 100644 --- a/addons/script_panel_plus/plugin.gd +++ b/addons/script_panel_plus/plugin.gd @@ -189,6 +189,7 @@ func hide_all_bottom_bars() -> void: func hide_current_bottom_bar() -> void: var cur_bottom_bar := get_current_bottom_bar() if cur_bottom_bar: cur_bottom_bar.visible = false + else: hide_all_bottom_bars() func show_current_bottom_bar() -> void: var cur_bottom_bar := get_current_bottom_bar() @@ -221,10 +222,12 @@ func hide_screen_select_button() -> void: func get_current_bottom_bar() -> Control: var result: Control + # Script if engine_script_editor.get_current_editor(): var i = engine_script_editor.get_current_editor().\ find_children("*", "CodeTextEditor", true, false)[0] result = i.get_child(1) + # Docs else: if not engine_script_list.is_anything_selected(): return result diff --git a/addons/script_panel_plus/script_panel/script_panel.gd b/addons/script_panel_plus/script_panel/script_panel.gd index 9a0c3a7..6e169a3 100644 --- a/addons/script_panel_plus/script_panel/script_panel.gd +++ b/addons/script_panel_plus/script_panel/script_panel.gd @@ -219,7 +219,6 @@ func check_for_script_change() -> void: check_rename_status(current_script) methods_list_update() - if prev_script: _on_script_change(prev_script) current_script_changed.emit() @@ -845,22 +844,29 @@ func _on_script_change(prev_script: ScriptItem) -> void: if is_instance_valid(_editor): check_errors(_editor) func add_script_item_by_engine_index(index: int, push_front := false) -> void: - ## SCRIPT - if engine_script_list.get_item_tooltip(index).find(".gd") != -1 or\ - engine_script_list.get_item_tooltip(index).find(".cs") != -1: - var text := engine_script_list.get_item_text(index) - var path := engine_script_list.get_item_tooltip(index) - var type := "scripts" - add_script_item(text, path, type, push_front) - ## DOCUMENT - elif engine_script_list.get_item_tooltip(index).find\ + if engine_script_list.get_item_tooltip(index).find\ ("Class Reference") != -1: var text := engine_script_list.get_item_tooltip(index).get_slice(" Class Reference", 0) + + if text.contains('.gd'): # Means Custom Docs + text = text.replace('"', "") + text = text.replace('.gd', "") + text = text.split("/", false, 0)[-1] as String + text = text.to_pascal_case() + var path := engine_script_list.get_item_tooltip(index) var type := "docs" add_script_item(text, path, type, push_front) + ## SCRIPT + elif engine_script_list.get_item_tooltip(index).find(".gd") != -1 or\ + engine_script_list.get_item_tooltip(index).find(".cs") != -1: + var text := engine_script_list.get_item_text(index) + var path := engine_script_list.get_item_tooltip(index) + var type := "scripts" + add_script_item(text, path, type, push_front) + ## FILE else: var text := engine_script_list.get_item_text(index)