Skip to content

Commit

Permalink
v.1.5.9 - Custom Docs Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Loregret committed Sep 14, 2023
1 parent febdbba commit 40624ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addons/script_panel_plus/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions addons/script_panel_plus/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
26 changes: 16 additions & 10 deletions addons/script_panel_plus/script_panel/script_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 40624ce

Please sign in to comment.