Initial Commit

This commit is contained in:
Mario Steele 2026-02-23 18:38:03 -06:00
commit 48a5e71e00
1136 changed files with 64347 additions and 0 deletions

View file

@ -0,0 +1,13 @@
@tool
extends Button
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func _pressed() -> void:
if owner and owner.has_method(name):
owner.call(name)

View file

@ -0,0 +1 @@
uid://d64ag8slx57b

View file

@ -0,0 +1,108 @@
@tool
extends Panel
# from: https://github.com/cherriesandmochi/gdmaim
@export var code_edit : CodeEdit
var _search_results : Array[Vector2i]
var _cur_search_result : int = 0
func is_search_focused() -> bool:
return $VBoxContainer/Search.has_focus()
func open() -> void:
var node : Node = (get_viewport().gui_get_focus_owner())
if node is CodeEdit:
code_edit = node
if code_edit == null:
return
if code_edit.get_selected_text():
$VBoxContainer/Search.text = code_edit.get_selected_text()
_update_search()
show()
$VBoxContainer/Search.grab_focus()
func close() -> void:
hide()
if code_edit:
code_edit.grab_focus()
code_edit.set_search_text("")
code_edit.queue_redraw()
func get_search_text() -> String:
return $VBoxContainer/Search.text
func update_search() -> void:
var txt : String = get_search_text()
if txt.length() == 0:
return
_update_search(txt)
func _update_search(_new_text : String = "") -> void:
var node : Node = (get_viewport().gui_get_focus_owner())
if node is CodeEdit:
code_edit = node
if code_edit == null:
close()
return
var updated_text : String = $VBoxContainer/Search.text
var flags : int = (
TextEdit.SEARCH_MATCH_CASE * int($VBoxContainer/MatchCase.button_pressed) +
TextEdit.SEARCH_WHOLE_WORDS * int($VBoxContainer/WholeWords.button_pressed))
code_edit.set_search_text(updated_text)
code_edit.set_search_flags(flags)
code_edit.queue_redraw()
_search_results.clear()
_cur_search_result = 0
var result : Vector2i = code_edit.search(updated_text, flags, 0, 0)
while result.x != -1:
_search_results.append(result)
if result.y + 1 == code_edit.get_line_count():
break
result = code_edit.search(updated_text, flags, result.y + 1, 0)
if _search_results.has(result):
break
_update_matches()
func _update_matches() -> void:
$VBoxContainer/Matches.modulate = Color.WHITE
if !$VBoxContainer/Search.text:
$VBoxContainer/Matches.text = ""
elif !_search_results:
$VBoxContainer/Matches.text = "No match"
$VBoxContainer/Matches.modulate = Color.SALMON
else:
_cur_search_result = posmod(_cur_search_result, _search_results.size())
$VBoxContainer/Matches.text = str(_cur_search_result + 1) + " of " + str(_search_results.size()) + " matches"
code_edit.set_caret_line(_search_results[_cur_search_result].y)
code_edit.set_caret_column(_search_results[_cur_search_result].x)
func _on_search_text_submitted(_new_text : String) -> void:
_cur_search_result += 1
_update_matches()
func _on_previous_pressed() -> void:
_cur_search_result -= 1
_update_matches()
func _on_next_pressed() -> void:
_cur_search_result += 1
_update_matches()

View file

@ -0,0 +1 @@
uid://bvqs6iskv4kx2

View file

@ -0,0 +1,74 @@
[gd_scene load_steps=7 format=3 uid="uid://bomtra3fmv57j"]
[ext_resource type="Script" uid="uid://bvqs6iskv4kx2" path="res://addons/script_splitter/core/ui/window/code_search.gd" id="1_dym63"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_58b8g"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_m7op6"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jjfj5"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7k12u"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_dylah"]
[node name="CodeSearch" type="Panel"]
custom_minimum_size = Vector2(0, 30)
script = ExtResource("1_dym63")
[node name="VBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Search" type="LineEdit" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Matches" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 13
[node name="Previous" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_58b8g")
text = "<"
flat = true
[node name="Next" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_m7op6")
text = ">"
flat = true
[node name="MatchCase" type="CheckBox" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 13
theme_override_styles/focus = SubResource("StyleBoxEmpty_jjfj5")
text = "Match Case"
flat = true
[node name="WholeWords" type="CheckBox" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 13
theme_override_styles/focus = SubResource("StyleBoxEmpty_7k12u")
text = "Whole Words"
flat = true
[node name="Close" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 8
theme_override_styles/focus = SubResource("StyleBoxEmpty_dylah")
text = "X"
flat = true
[connection signal="text_changed" from="VBoxContainer/Search" to="." method="_update_search"]
[connection signal="text_submitted" from="VBoxContainer/Search" to="." method="_on_search_text_submitted"]
[connection signal="pressed" from="VBoxContainer/Previous" to="." method="_on_previous_pressed"]
[connection signal="pressed" from="VBoxContainer/Next" to="." method="_on_next_pressed"]
[connection signal="pressed" from="VBoxContainer/MatchCase" to="." method="_update_search"]
[connection signal="pressed" from="VBoxContainer/WholeWords" to="." method="_update_search"]
[connection signal="pressed" from="VBoxContainer/Close" to="." method="close"]

View file

@ -0,0 +1,134 @@
@tool
extends Window
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const GRANT_KEY_CODES : PackedInt64Array = [
KEY_S, KEY_SPACE, KEY_K, KEY_G, KEY_SLASH
]
@export var _root : Node = null
@export var _search : Control = null
func get_root() -> Node:
return _root
func _ready() -> void:
_search.visible = false
set_physics_process(false)
var _size : Vector2 = Engine.get_main_loop().root.size
_size = _size * 0.75
_size.x = maxf(_size.x, 512.0)
_size.y = maxf(_size.y, 512.0)
size = _size
show()
move_to_center()
$PanelContainer/VBoxContainer/HBoxContainer/always_top.button_pressed = always_on_top
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
_on_close()
func _enter_tree() -> void:
if !close_requested.is_connected(_on_close):
close_requested.connect(_on_close)
if !focus_entered.is_connected(_on_focus):
focus_entered.connect(_on_focus)
if !focus_exited.is_connected(_out_focus):
focus_exited.connect(_out_focus)
if !tree_exiting.is_connected(_on_close):
tree_exiting.connect(_on_close)
func _out_focus() -> void:
always_on_top = $PanelContainer/VBoxContainer/HBoxContainer/always_top.button_pressed
func setup() -> void:
if _root:
var x : Node = _root.get_child(1).get_child(0)
x.child_exiting_tree.connect(update)
func _on_focus(__ : Variant = null) -> void:
always_on_top = false
_search.code_edit = null
_focus(_root)
_search.visible = _search.visible and null != _search.code_edit
func _focus(n : Node, focus : bool = false) -> void:
if n:
if focus and n is Control:
var c : Control = n
if c.focus_mode != Control.FOCUS_NONE:
c.grab_focus.call_deferred()
if c is CodeEdit:
_search.code_edit = c
if _search.visible:
_search.update_search()
for x : Node in n.get_children():
if x is TabContainer:
if !x.tab_changed.is_connected(_on_focus):
x.tab_changed.connect(_on_focus)
_focus(x.get_current_tab_control(), true)
break
_focus(x, focus)
func _on_close() -> void:
for x : Node in Engine.get_main_loop().get_nodes_in_group(&"__SCRIPT_SPLITTER__"):
x.call(&"remove_from_control", self)
if !is_queued_for_deletion():
queue_free()
func _resizez(n : Node) -> void:
if n is Control:
if n.size > _root.size:
n.set_deferred(&"size", _root.size)
for x : Node in n.get_children():
_resizez(x)
func update(__ : Variant = null) -> void:
if _root.get_child_count() == 0:
queue_free()
return
call_deferred(&"set_physics_process", true)
func _physics_process(__: float) -> void:
set_physics_process(false)
if !_root or _root.get_child_count() == 0 or _root.get_child(1).get_child(0).get_child_count() == 0:
queue_free()
return
_resizez(_root)
func _input(event: InputEvent) -> void:
if event is InputEventKey:
if event.ctrl_pressed and event.shift_pressed == false:
if event.keycode == KEY_F:
_search.open()
get_viewport().set_input_as_handled()
return
elif event.keycode in GRANT_KEY_CODES:
var vp : Viewport = (Engine.get_main_loop().root)
vp.push_input(event)
get_viewport().set_input_as_handled()
elif event.keycode == KEY_ESCAPE:
if _search.visible and (_search.has_focus() or _search.is_search_focused()):
_search.close()
get_viewport().set_input_as_handled()
func center() -> void:
move_to_center()
func always_top() -> void:
pass

View file

@ -0,0 +1 @@
uid://b18w1ib1rv47t

View file

@ -0,0 +1,63 @@
[gd_scene load_steps=8 format=3 uid="uid://c1ou1s1ynw4nq"]
[ext_resource type="Script" uid="uid://b18w1ib1rv47t" path="res://addons/script_splitter/core/ui/window/editor.gd" id="1_7ydjp"]
[ext_resource type="Script" uid="uid://dyo7c2g4uwn0g" path="res://addons/script_splitter/core/ui/splitter/splitter_container.gd" id="2_l3fsh"]
[ext_resource type="Texture2D" uid="uid://cejhhnje48450" path="res://addons/script_splitter/assets/fill_expand.svg" id="2_y3itc"]
[ext_resource type="PackedScene" uid="uid://bomtra3fmv57j" path="res://addons/script_splitter/core/ui/window/code_search.tscn" id="3_j866e"]
[ext_resource type="Texture2D" uid="uid://r6u1jtnbr4eg" path="res://addons/script_splitter/assets/atop.png" id="3_qfcg7"]
[ext_resource type="Script" uid="uid://d64ag8slx57b" path="res://addons/script_splitter/core/ui/window/button.gd" id="4_4imua"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j866e"]
bg_color = Color(0.21176471, 0.23921569, 0.2901961, 1)
[node name="Editor" type="Window" node_paths=PackedStringArray("_root", "_search")]
auto_translate_mode = 2
oversampling_override = 1.0
title = "Script Splitter: Pop Script"
initial_position = 4
size = Vector2i(968, 558)
script = ExtResource("1_7ydjp")
_root = NodePath("PanelContainer/VBoxContainer/MarginContainer")
_search = NodePath("PanelContainer/VBoxContainer/CodeSearch")
[node name="PanelContainer" type="PanelContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_j866e")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="center" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Center"
icon = ExtResource("2_y3itc")
flat = true
script = ExtResource("4_4imua")
[node name="always_top" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
toggle_mode = true
text = "Always Top"
icon = ExtResource("3_qfcg7")
flat = true
script = ExtResource("4_4imua")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
script = ExtResource("2_l3fsh")
[node name="CodeSearch" parent="PanelContainer/VBoxContainer" instance=ExtResource("3_j866e")]
visible = false
layout_mode = 2