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,23 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const MickeyTool = preload("./../../core/editor/tools/magic/mickey_tool.gd")
const ToolDB = preload("./../../core/editor/database/tool_db.gd")
const Manager = preload("./../../core/editor/godot/manager.gd")
var _tool_db : ToolDB = null
var _manager : Manager = null
func _init(manager : Manager, tool_db : ToolDB) -> void:
_manager = manager
_tool_db = tool_db
func execute(_value : Variant = null) -> bool:
return false

View file

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

View file

@ -0,0 +1,104 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const EditorTool = preload("./../../../core/editor/tools/editor_tool.gd")
const HelperEditorTool = preload("./../../../core/editor/tools/helper_editor_tool.gd")
const ScriptEditorTool = preload("./../../../core/editor/tools/script_editor_tool.gd")
const TextEditorTool = preload("./../../../core/editor/tools/text_editor_tool.gd")
var _tools : Array[EditorTool] = [
ScriptEditorTool.new(),
HelperEditorTool.new(),
TextEditorTool.new()
]
func execute(value : Variant = null) -> bool:
if !is_instance_valid(value) or !(value is Control):
return true
var control : Control = value
if !control.is_node_ready() or !control.is_inside_tree():
return false
for x : MickeyTool in _tool_db.get_tools():
if x.has(control):
x.set_queue_free(false)
return true
var index : int = control.get_index()
if !_manager.is_valid_item_index(index):
return false
var root : Node = _get_root()
if is_instance_valid(root):
var mt : MickeyTool = _tools[0].build(control)
var is_editor : bool = _is_editor(mt, control)
if !is_editor:
for z : int in range(1, _tools.size(), 1):
var x : EditorTool = _tools[z]
mt = x.build(control)
if mt != null:
break
if mt != null:
mt.focus.connect(_manager.focus_tool)
mt.new_symbol.connect(_manager.set_symbol)
mt.clear.connect(_manager.clear_editors)
mt.ochorus(root)
_tool_db.append(mt)
_manager.tool_created()
_manager.update_metadata(mt)
mt.trigger_focus()
return false
if is_editor:
return true
printerr("Error!, Can not build control for ", control.name)
return false
func _is_editor(mt : MickeyTool, control : Control) -> bool:
if is_instance_valid(mt):
return true
if control is ScriptEditorBase:
var sce : ScriptEditor = EditorInterface.get_script_editor()
if sce and control in sce.get_open_script_editors():
if control.name.begins_with("@"):
if !("Script" in control.name):
return false
return true
return _manager.get_editor_list().get_item_tooltip(control.get_index()).is_empty()
return false
func _get_root() -> Node:
var root : Node = _manager.get_current_root()
if !is_instance_valid(root):
var splitters : Array[Node] = _manager.get_base_container().get_all_splitters()
if splitters.size() == 0:
for x : MickeyTool in _tool_db.get_tools():
x.reset()
_manager.get_base_container().initialize_editor_container()
root = _manager.get_current_root()
else:
for x : Node in splitters:
if is_instance_valid(x) and !x.is_queued_for_deletion():
root = x
break
return root

View file

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

View file

@ -0,0 +1,162 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const BaseContainer = preload("./../../../core/base/container.gd")
const SpliterItem = preload("./../../../core/ui/multi_split_container/split_container_item.gd")
func execute(value : Variant = null) -> bool:
if value is Array:
if value.size() == 3:
if value[0] is Container and value[1] is int and value[2] is StringName:
var from : Container = value[0]
var index : int = value[1]
var type : StringName = value[2]
if from is BaseContainer.SplitterContainer.SplitterEditorContainer.Editor:
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
if x.get_root() == from and x.get_control().get_index() == index:
if type == &"LEFT":
var c : Node = _manager.get_base_container().get_container_item(x.get_root())
var cindex : int = 0
if !c:
return false
cindex = c.get_index()
_manager.split_column.execute(x)
if !c.is_node_ready():
await c.ready
c = _manager.get_base_container().get_container_item(x.get_root())
if is_instance_valid(c):
if cindex > -1 and cindex < c.get_parent().get_child_count() and c.get_index() != cindex:
c.get_parent().move_child.call_deferred(c, cindex)
elif type == &"RIGHT":
var c : Node = _manager.get_base_container().get_container_item(x.get_root())
var cindex : int = 0
if !c:
return false
cindex = c.get_index() + 1
_manager.split_column.execute(x)
if !c.is_node_ready():
await c.ready
c = _manager.get_base_container().get_container_item(x.get_root())
if is_instance_valid(c):
if cindex > -1 and cindex < c.get_parent().get_child_count() and c.get_index() != cindex:
c.get_parent().move_child.call_deferred(c, cindex)
elif type == &"TOP":
var c : Node = _manager.get_base_container().get_container(x.get_root())
var cindex : int = 0
if !c:
return false
var root : Node = c.get_parent()
if !root:
return false
cindex = root.get_index()
_manager.split_row.execute(x)
if !c.is_node_ready():
await c.ready
c = _manager.get_base_container().get_container_item(x.get_root())
if is_instance_valid(c):
var row : Node = c
for __ : int in range(0, 2, 1):
row = c.get_parent()
if !is_instance_valid(row):
break
if is_instance_valid(row):
var has : bool = false
for ___ : int in range(0, 3, 1):
if has:
break
for __ : int in range(0, 3, 1):
await Engine.get_main_loop().process_frame
if is_instance_valid(row) and is_instance_valid(c):
var _root : Node = c.get_parent()
if row.has_node(_root.get_path()) :
has = true
break
if has and c and cindex > -1:
for __ : int in range(0, 2, 1):
c = c.get_parent()
if !c:
return false
root = c.get_parent()
if root and cindex < root.get_child_count() and c.get_index() != cindex:
root.move_child(c, cindex)
return true
elif type == &"BOTTOM":
_manager.split_row.execute(x)
var c : Node = _manager.get_base_container().get_container(x.get_root())
var cindex : int = 0
if !c:
return false
if !c.is_node_ready():
await c.ready
cindex = c.get_index() + 1
if c.get_index() < c.get_parent().get_child_count() - 1:
if is_instance_valid(c):
var row : Node = c
for __ : int in range(0, 2, 1):
row = c.get_parent()
if !is_instance_valid(row):
break
if is_instance_valid(row):
var z : int = c.get_index()
if z > 0:
var has : bool = false
for ___ : int in range(0, 3, 1):
if has:
break
for __ : int in range(0, 3, 1):
await Engine.get_main_loop().process_frame
if is_instance_valid(row) and is_instance_valid(c):
var _root : Node = c.get_parent()
if row.has_node(_root.get_path()) and _root is SpliterItem:
has = true
break
if has and c and cindex > -1:
for __ : int in range(0, 2, 1):
c = c.get_parent()
if !c:
return false
var root : Node = c.get_parent()
if root and cindex < root.get_child_count() and c.get_index() != cindex:
root.move_child(c, cindex)
return true
return false

View file

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

View file

@ -0,0 +1,24 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#Override app function.
func execute(value : Variant = null) -> bool:
if value is Array:
if value.size() > 1:
if value[0] is TabContainer and value[1] is int:
var control : TabContainer = value[0]
var index : int = value[1]
for x : MickeyTool in _tool_db.get_tools():
if is_instance_valid(x):
if x.get_root() == control:
if x.get_control().get_index() == index:
x.trigger_focus()
return true
return false

View file

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

View file

@ -0,0 +1,114 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const BaseList = preload("./../../../core/base/list.gd")
var unfocus_enabled : bool = true
var unfocus_color : Color = Color.DARK_GRAY
func _init(manager : Manager, tool_db : ToolDB) -> void:
super(manager, tool_db)
_setup()
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if settings.settings_changed.is_connected(_on_change):
settings.settings_changed.disconnect(_on_change)
func _on_change() -> void:
var dt : Array = ["plugin/script_splitter/editor/out_focus_color_enabled","plugin/script_splitter/editor/out_focus_color_value"]
var settings : EditorSettings = EditorInterface.get_editor_settings()
var changes : PackedStringArray = settings.get_changed_settings()
for c in changes:
if c in dt:
_setup()
var current : Node = _manager.get_base_container().get_current_container()
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
var root : Control = x.get_root()
if root.modulate != Color.WHITE:
if unfocus_enabled:
root.modulate = unfocus_color
else:
root.modulate = Color.WHITE
elif unfocus_enabled:
if is_instance_valid(current):
if x.get_root() != current:
root.modulate = unfocus_color
break
func _setup() -> void:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if !settings.settings_changed.is_connected(_on_change):
settings.settings_changed.connect(_on_change)
for x : Array in [
["unfocus_enabled", "plugin/script_splitter/editor/out_focus_color_enabled"]
,["unfocus_color", "plugin/script_splitter/editor/out_focus_color_value"]
]:
if settings.has_setting(x[1]):
set(x[0], settings.get_setting(x[1]))
else:
settings.set_setting(x[1], get(x[0]))
func execute(value : Variant = null) -> bool:
if value is ScriptEditorBase:
var control : Control = value.get_base_editor()
for x : MickeyTool in _tool_db.get_tools():
if x.has(control):
value = x
break
if value is MickeyTool:
var index : int = value.get_index()
var editor_list : BaseList = _manager.get_editor_list()
if editor_list.item_count() > index and index > -1:
var control : Node = value.get_control()
var root : Node = value.get_root()
if root is TabContainer:
var base : Manager.BaseContainer = _manager.get_base_container()
var _index : int = control.get_index()
if root.current_tab != _index and _index > -1 and _index < root.get_tab_count():
if root.has_method(&"set_tab"):
root.call(&"set_tab", _index)
else:
root.set(&"current_tab", _index)
var container : Control = base.get_current_container()
if is_instance_valid(container) and unfocus_enabled:
container.modulate = unfocus_color
base.set_current_container(root)
if is_instance_valid(root):
root.modulate = Color.WHITE
var new_container : Node = base.get_container(root)
if is_instance_valid(new_container) and new_container.has_method(&"expand_splited_container"):
new_container.call(&"expand_splited_container", base.get_container_item(root))
if is_instance_valid(container):
container = base.get_container(container)
if is_instance_valid(container) and container != new_container and container.has_method(&"expand_splited_container"):
container.call(&"expand_splited_container", null)
var grant_conainer : Node = base.get_editor_root_container(new_container)
if is_instance_valid(grant_conainer):
var parent : Node = grant_conainer.get_parent()
if is_instance_valid(parent) and parent.has_method(&"expand_splited_container"):
parent.call(&"expand_splited_container", base.get_editor_root_container(new_container))
if !editor_list.is_selected(index):
editor_list.select(index)
_manager.io.update()
_manager.get_editor_list().updated.emit()
return false

View file

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

View file

@ -0,0 +1,256 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const BaseList = preload("./../../../core/base/list.gd")
const EDITOR = preload("./../../../core/ui/window/editor.tscn")
var expanded : bool = false
var _updating : bool = false
func update() -> void:
if _updating:
return
_updating = true
_update.call_deferred()
func _update() -> void:
var base : Manager.BaseContainer = _manager.get_base_container()
var container : Node = base.get_current_container()
if is_instance_valid(container):
if expanded:
var cb : Node = base.get_container_item(container)
var ct : Array[Node] = container.get_tree().get_nodes_in_group(&"__SP_BR__")
for x : Node in container.get_tree().get_nodes_in_group(&"__SP_IC__"):
var v : bool = cb == x
for y : Node in x.get_children():
if y is Control:
y.visible = v
for __ : int in range(0, 2, 1):
for x : Node in ct:
if x is Control:
var v : bool = false
for y : Node in x.get_children():
if y is Control and y.visible:
v = true
break
x.visible = v
var can_split : bool = _can_split(container)
var can_merge_column : bool = _can_merge_column(base)
var can_merge_row : bool = _can_merge_row(base)
var can_sub_split : int = _sub()
var can_make_float : bool = (container.get_parent() is VBoxContainer)
for x : Node in (Engine.get_main_loop()).get_nodes_in_group(&"__script_splitter__IO__"):
x.enable(&"SPLIT_COLUMN",can_split)
x.enable(&"MERGE_COLUMN",can_merge_column)
x.enable(&"SPLIT_ROW",can_split)
x.enable(&"MERGE_ROW",can_merge_row)
x.enable(&"SPLIT_SUB", can_sub_split == 0)
x.enable(&"MERGE_SPLIT_SUB", can_sub_split == 1)
x.enable(&"MAKE_FLOATING", can_make_float)
_updating = false
func _can_split(container : Node) -> bool:
return container != null and container.get_child_count() > 1
func _can_merge_column(base : Manager.BaseContainer) -> bool:
return base != null and base.get_current_splitters().size() > 1
func _can_merge_row(base : Manager.BaseContainer) -> bool:
return base != null and base.get_all_containers().size() > 1
func _sub() -> int:
var sc : ScriptEditor = EditorInterface.get_script_editor()
if !is_instance_valid(sc.get_current_script()):
return -1
var ed : ScriptEditorBase = sc.get_current_editor()
var be : Control = ed.get_base_editor()
if be is CodeEdit:
if be.get_parent() is VSplitContainer:
return 1
return 0
return -1
func _on_pin(btn : Button) -> void:
var st : String = btn.get_meta(&"I")
if st.is_empty():
btn.queue_free()
return
var bl : Manager.BaseList = _manager.get_editor_list()
for x : int in bl.item_count():
if st == bl.get_item_tooltip(x):
bl.select(x)
return
func _make_pin(tree : SceneTree, fn : String, tp : String, icn : Texture2D, mod : Color) -> void:
if mod == Color.BLACK:
mod = Color.WHITE
for x : Node in tree.get_nodes_in_group(&"__SP_PIN_ROOT__"):
var btn : Button = Button.new()
btn.text = fn
btn.icon = icn
btn.set_meta(&"I", tp)
btn.pressed.connect(_on_pin.bind(btn))
btn.add_to_group(&"__SP_B_PIN__")
btn.set(&"theme_override_colors/icon_normal_color", mod)
btn.set(&"theme_override_colors/icon_focus_color", mod)
btn.set(&"theme_override_colors/icon_pressed_color", mod)
btn.set(&"theme_override_colors/icon_hover_color", mod)
btn.set(&"theme_override_colors/icon_hover_pressed_color", mod)
btn.set(&"theme_override_colors/icon_disabled_color", mod)
btn.set(&"theme_override_font_sizes/font_size", 12.0)
x.add_child(btn)
func _remove_pin(tree : SceneTree, tp : String) -> bool:
for x : Node in tree.get_nodes_in_group(&"__SP_PIN_ROOT__"):
if x.has_meta(&"I"):
if x.get_meta(&"I") == tp:
x.queue_free()
return true
return false
func execute(value : Variant = null) -> bool:
if value == null:
update()
return true
if value is StringName:
if value.is_empty():
update()
return true
var base : Manager.BaseContainer = _manager.get_base_container()
var container : Node = base.get_current_container()
var id : StringName = value
match id:
&"EXPAND":
if is_instance_valid(container):
var ct : Array[Node] = container.get_tree().get_nodes_in_group(&"__SP_BR__")
if expanded:
for x : Node in container.get_tree().get_nodes_in_group(&"__SP_IC__"):
for y : Node in x.get_children():
if y is Control:
y.visible = true
for x : Node in ct:
if x is Control:
x.visible = true
else:
var cb : Node = base.get_container_item(container)
for x : Node in container.get_tree().get_nodes_in_group(&"__SP_IC__"):
var v : bool = cb == x
for y : Node in x.get_children():
if y is Control:
y.visible = v
for __ : int in range(0, 2, 1):
for x : Node in ct:
if x is Control:
var v : bool = false
for y : Node in x.get_children():
if y is Control and y.visible:
v = true
break
x.visible = v
expanded = !expanded
for x : Node in container.get_tree().get_nodes_in_group(&"__script_splitter__IO__"):
if x.has_method(&"get_button"):
var button : Button = x.call(&"get_button", id)
if is_instance_valid(button):
if expanded:
button.modulate = Color.GREEN
else:
button.modulate = Color.WHITE
return true
&"PIN":
for x : MickeyTool in _tool_db.get_tools():
if x.get_root() == container:
if container is TabContainer:
if container.current_tab == x.get_control().get_index():
var list : Manager.BaseList = _manager.get_editor_list()
var idx : int = x.get_index()
if list.item_count() > idx and idx > -1:
var nm : String = list.get_item_text(idx)
var ps : String = list.get_item_tooltip(idx)
if _remove_pin(container.get_tree(), ps):
return true
_make_pin(container.get_tree(), nm, ps, list.get_item_icon(idx), list.get_item_icon_modulate(idx))
&"SPLIT_COLUMN":
if _can_split(container):
_manager.split_column.execute()
&"SPLIT_ROW":
if _can_split(container):
_manager.split_row.execute()
&"MERGE_COLUMN":
if _can_merge_column(base):
_manager.merge_tool.execute([null, false])
&"MERGE_ROW":
if _can_merge_row(base):
_manager.merge_tool.execute([null, true])
&"SPLIT_SUB":
if _sub() == 0:
for x : Node in Engine.get_main_loop().get_nodes_in_group(&"__SCRIPT_SPLITTER__"):
x.script_split()
break
&"MERGE_SPLIT_SUB":
if _sub() == 1:
for x : Node in Engine.get_main_loop().get_nodes_in_group(&"__SCRIPT_SPLITTER__"):
x.script_merge()
break
&"MAKE_FLOATING":
if (container.get_parent() is VBoxContainer):
for x : ToolDB.MickeyTool in _tool_db.get_tools():
if x.has(container):
var y : Node = (_manager._base_container._editor_container.get_parent())
var new_window : Window = EDITOR.instantiate()
y.add_child(new_window)
var root : Node = new_window.call(&"get_root")
root.initialize(null, _manager.get_base_container())
root.initialize_editor_contianer()
var _root : Node = x.get_root()
x.ochorus(root.call(&"get_current_editor"))
if _root.get_child_count() < 1:
var item : Node = _manager.get_base_container().get_container_item(_root)
if item.get_child_count() == 1:
var cont : Node = _manager.get_base_container().get_container(_root)
if cont.get_child_count() == 1:
cont.queue_free()
else:
item.queue_free()
else:
if _root.get_parent() is VBoxContainer:
_root.get_parent().queue_free()
else:
_root.queue_free()
new_window.setup()
new_window.update()
_manager.update()
return false
return false

View file

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

View file

@ -0,0 +1,91 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func _get_tool(value : Variant) -> MickeyTool:
var container : MickeyTool = null
if value == null:
container = _tool_db.get_by_reference(_manager.get_base_container().get_current_container())
elif value is Node:
container = _tool_db.get_by_reference(value)
elif value is Resource:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value.resource_path
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
container = _tool_db.get_tool_id(x)
break
elif value is String:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
container = _tool_db.get_tool_id(x)
break
return container
func execute(value : Variant = null) -> bool:
if value is Array:
var mk : MickeyTool = _get_tool(value[0])
if is_instance_valid(mk) and value[1] is bool:
if mk and mk.is_valid():
var root : Node = mk.get_root()
var control : Node = root
if control.is_in_group(&"__SC_SPLITTER__"):
var cbase : Manager.BaseContainer = _manager.get_base_container()
if value[1]:
control = cbase.get_container(control)
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
var node : Control = x.get_root()
if control == cbase.get_container(node):
x.reset()
control.queue_free()
else:
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
var node : Control = x.get_root()
if node:
if node == control:
x.reset()
else:
x.reset()
var base : Manager.BaseContainer = _manager.get_base_container()
if root == base.get_current_container():
var nodes : Array[Node] = control.get_tree().get_nodes_in_group(&"__SC_SPLITTER__")
var container : Node = base.get_container_item(root)
for n : Node in nodes:
if n == root:
continue
var _container : Node = base.get_container_item(n)
if _container.get_parent() == container.get_parent():
var i0 : int = _container.get_index()
var i1 : int = container.get_index()
if i0 == i1 - 1 or i0 == i1 + 1:
base.set_current_container(n)
return true
var z : int = nodes.find(root)
if z != -1:
if z == 0:
if nodes.size() > 1:
base.set_current_container(nodes[1])
else:
if nodes.size() > 1:
base.set_current_container(nodes[z - 1])
return true
#if control.get_child_count() == 0 or root.get_child_count() == 0:
#control.queue_free()
return false

View file

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

View file

@ -0,0 +1,77 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
var _refreshing : bool = true
func _init(manager : Manager, tool_db : ToolDB) -> void:
super(manager, tool_db)
_setup()
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if settings.settings_changed.is_connected(_on_change):
settings.settings_changed.disconnect(_on_change)
func _on_change() -> void:
var dt : Array = ["plugin/script_splitter/behaviour/refresh_warnings_on_save"]
var settings : EditorSettings = EditorInterface.get_editor_settings()
var changes : PackedStringArray = settings.get_changed_settings()
for c in changes:
if c in dt:
_setup()
break
func _setup() -> void:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if !settings.settings_changed.is_connected(_on_change):
settings.settings_changed.connect(_on_change)
for x : Array in [
["_refreshing", "plugin/script_splitter/behaviour/refresh_warnings_on_save"]
]:
if settings.has_setting(x[1]):
set(x[0], settings.get_setting(x[1]))
else:
settings.set_setting(x[1], get(x[0]))
func execute(_value : Variant = null) -> bool:
if !_refreshing:
return true
var sp : Array[Node] = Engine.get_main_loop().get_nodes_in_group(&"__SC_SPLITTER__")
var current : Control = _manager.get_base_container().get_current_container()
var ctool : MickeyTool = null
var ltool : MickeyTool = null
if sp.size() < 2:
return true
for x : Variant in _tool_db.get_tools():
if is_instance_valid(x):
if x.is_valid():
var i : int = sp.find(x.get_root())
var container : Node = sp[i]
if container is TabContainer:
var indx : int = x.get_control().get_index()
if container.current_tab == indx:
if container == current:
ctool = x
ltool = x
_manager.select_editor_by_index(x.get_index())
if is_instance_valid(ctool) and ctool != ltool:
_manager.select_editor_by_index(ctool.get_index())
return true

View file

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

View file

@ -0,0 +1,26 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
if value is Array:
var control : Control = value[0]
var index : int = value[1]
if index < 0:
return false
for x : MickeyTool in _tool_db.get_tools():
if x.get_root() == control and x.get_control().get_index() == index:
var _index : int = x.get_index()
x.reset()
_manager.get_editor_list().remove(_index)
return true
return false

View file

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

View file

@ -0,0 +1,21 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
if value is Array:
if value[0] is Control and value[1] is int:
if value[1] < 0:
return false
for x : MickeyTool in _tool_db.get_tools():
if x.get_index() == value[1]:
if x.is_valid():
x.ochorus(value[0])
return true
return false

View file

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

View file

@ -0,0 +1,30 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
if value is Array:
var idx : int = value[0]
var node : Node = value[1]
if idx < 0:
return false
for x : MickeyTool in _tool_db.get_tools():
if x.get_root() == node:
if x.get_control().get_index() == idx:
var list : Manager.BaseList = _manager.get_editor_list()
var indx : int = x.get_index()
if list.item_count() > indx and indx > -1:
var el : ItemList = list.get_editor_list()
el.item_clicked.emit(indx,el.get_local_mouse_position(), MOUSE_BUTTON_RIGHT)
return true
return false

View file

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

View file

@ -0,0 +1,30 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
if value is int:
if value < 0:
return false
for x : MickeyTool in _tool_db.get_tools():
if x.get_index() == value:
var root : Variant = x.get_root()
if is_instance_valid(root):
if root is TabContainer:
if !(root.get_window().has_focus()):
root.get_window().grab_focus()
var index : int = x.get_control().get_index()
if root.current_tab != index and index > -1 and root.get_tab_count() > index:
if root.has_method(&"set_tab"):
root.call(&"set_tab", index)
else:
root.current_tab = index
return true
return false

View file

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

View file

@ -0,0 +1,46 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
var _tool : MickeyTool = null
if value == null:
value = _manager.get_base_container().get_current_container()
elif value is Resource:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value.resource_path
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
elif value is String:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
elif value is MickeyTool:
_tool = value
if _tool == null:
if value is MickeyTool:
_tool = value
elif value is Node:
_tool = _tool_db.get_by_reference(value)
if is_instance_valid(_tool) and _tool.is_valid():
if _manager._focus_tool.unfocus_enabled:
_tool.get_root().modulate = _manager._focus_tool.unfocus_color
var idx : int = _tool.get_index()
if idx > -1 and _manager.get_editor_list().item_count() > idx:
_manager.move_tool(_manager.get_base_container().new_column(), idx)
_manager.io.update()
return true
return false

View file

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

View file

@ -0,0 +1,45 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(value : Variant = null) -> bool:
var _tool : MickeyTool = null
if value == null:
value = _manager.get_base_container().get_current_container()
elif value is Resource:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value.resource_path
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
elif value is String:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
if _tool == null:
if value is MickeyTool:
_tool = value
elif value is Node:
_tool = _tool_db.get_by_reference(value)
if is_instance_valid(_tool) and _tool.is_valid():
if _manager._focus_tool.unfocus_enabled:
_tool.get_root().modulate = _manager._focus_tool.unfocus_color
var idx : int = _tool.get_index()
if idx > -1 and _manager.get_editor_list().item_count() > idx:
_manager.move_tool(_manager.get_base_container().new_row(), idx)
_manager.io.update()
return true
return false

View file

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

View file

@ -0,0 +1,79 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const BaseContainer = preload("./../../../core/base/container.gd")
var _last_tool : MickeyTool = null
func execute(value : Variant = null) -> bool:
if value is Array:
if value.size() == 3:
if value[0] is Container and value[1] is int and value[2] is Container:
var from : Container = value[0]
var index : int = value[1]
var to : Container = value[2]
if from == to:
return false
if from is BaseContainer.SplitterContainer.SplitterEditorContainer.Editor and to is BaseContainer.SplitterContainer.SplitterEditorContainer.Editor:
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
if x.get_root() == from and x.get_control().get_index() == index:
if _last_tool == x:
return false
_last_tool = x
x.ochorus(to)
_manager.clear_editors()
set_deferred(&"_last_tool", null)
return true
else:
if value[0] is String and value[1] is String and value[2] is bool:
var base : Manager.BaseList = _manager.get_editor_list()
var from : String = value[0]
var left : bool = value[2]
var to : String = value[1]
var fm : MickeyTool = null
var tm : MickeyTool = null
if from == to:
return false
for x : MickeyTool in _tool_db.get_tools():
if !x.is_valid():
continue
var t : String = base.get_item_tooltip(x.get_index())
if from == t:
fm = x
elif to == t:
tm = x
if is_instance_valid(fm) and is_instance_valid(tm) and fm != tm:
var froot : Node = fm.get_root()
var troot : Node = tm.get_root()
if froot == troot:
if left:
if froot is TabContainer:
_manager.move_item_container(froot, fm.get_index(), maxi(tm.get_index() - 1, 0))
froot.move_child(fm.get_control(), maxi(tm.get_control().get_index() - 1,0))
else:
if froot is TabContainer:
_manager.move_item_container(froot, fm.get_index(), tm.get_index())
froot.move_child(fm.get_control(), tm.get_control().get_index())
else:
if froot.get_child_count() == 1:
if _manager.merge_tool.execute([tm.get_control(), froot.get_parent().get_child_count() == 1]):
fm.ochorus(troot)
#if froot.get_parent().get_child_count() == 1:
#froot.get_parent().queue_free()
#else:
#froot.queue_free()
#_manager.get_base_container().update_split_container()
else:
fm.ochorus(troot)
return true
return false

View file

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

View file

@ -0,0 +1,105 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
var LIST_VISIBLE_SELECTED_COLOR : Color = Color.from_string("7b68ee", Color.CORNFLOWER_BLUE)
var LIST_VISIBLE_OTHERS_COLOR : Color = Color.from_string("4835bb", Color.DARK_BLUE)
var _script_list_selection : bool = false
func _init(manager : Manager, tool_db : ToolDB) -> void:
super(manager, tool_db)
_setup()
func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if settings.settings_changed.is_connected(_on_change):
settings.settings_changed.disconnect(_on_change)
func _on_change() -> void:
var dt : Array = [
"plugin/script_splitter/behaviour/refresh_warnings_on_saveplugin/script_splitter/editor/list/selected_color"
,"plugin/script_splitter/behaviour/refresh_warnings_on_saveplugin/script_splitter/editor/list/others_color"
]
var settings : EditorSettings = EditorInterface.get_editor_settings()
var changes : PackedStringArray = settings.get_changed_settings()
for c in changes:
if c in dt:
_setup()
break
func _setup() -> void:
var settings : EditorSettings = EditorInterface.get_editor_settings()
if !settings.settings_changed.is_connected(_on_change):
settings.settings_changed.connect(_on_change)
for x : Array in [
["LIST_VISIBLE_SELECTED_COLOR", "plugin/script_splitter/behaviour/refresh_warnings_on_saveplugin/script_splitter/editor/list/selected_color"]
,["LIST_VISIBLE_OTHERS_COLOR", "plugin/script_splitter/behaviour/refresh_warnings_on_saveplugin/script_splitter/editor/list/others_color"]
]:
if settings.has_setting(x[1]):
set(x[0], settings.get_setting(x[1]))
else:
settings.set_setting(x[1], get(x[0]))
func execute(value : Variant = null) -> bool:
if !value is Array or value.size() < 1:
return false
if _script_list_selection:
return true
_script_list_selection = true
var _editor_list : ItemList = value[0]
var _script_list : ItemList = value[1]
var selected : String = ""
var others_selected : PackedStringArray = []
var current : TabContainer = _manager.get_base_container().get_current_container()
for x : MickeyTool in _tool_db.get_tools():
if x.is_valid():
var _root : Node = x.get_root()
if _root.current_tab == x.get_control().get_index():
var idx : int = x.get_index()
if _editor_list.item_count > idx and idx > -1:
if _root == current:
selected = _editor_list.get_item_tooltip(idx)
else:
others_selected.append(_editor_list.get_item_tooltip(idx))
var color : Color = LIST_VISIBLE_SELECTED_COLOR
var color_ctn : Color = LIST_VISIBLE_SELECTED_COLOR
var others : Color = LIST_VISIBLE_OTHERS_COLOR
color.a = 0.5
others.a = 0.5
color_ctn.a = 0.25
for x : int in _script_list.item_count:
var mt : String = _script_list.get_item_tooltip(x)
if selected == mt:
_script_list.set_item_custom_bg_color(x, color)
_script_list.set_item_custom_fg_color(x, Color.WHITE)
_script_list.select(x, true)
elif others_selected.has(mt):
_script_list.set_item_custom_bg_color(x, others)
else:
_script_list.set_item_custom_bg_color(x, Color.TRANSPARENT)
_script_list.ensure_current_is_visible()
set_deferred(&"_script_list_selection", false)
return false

View file

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

View file

@ -0,0 +1,80 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const BaseList = preload("./../../../core/base/list.gd")
var _buffer : Dictionary = {}
func execute(value : Variant = null) -> bool:
var list : BaseList = _manager.get_editor_list()
if is_instance_valid(value) and value is MickeyTool:
_update(value, list)
else:
var arr : Array[MickeyTool] = _tool_db.get_tools()
for x : int in range(arr.size() - 1, -1, -1):
var _tool : Variant = arr[x]
if !is_instance_valid(_tool):
arr.remove_at(x)
continue
_update(_tool, list)
var dict : Dictionary = {}
for x : ToolDB.MickeyTool in _tool_db.get_tools():
if !x.is_valid():
continue
var _root : Node = x.get_root_control()
if dict.has(_root):
continue
dict[_root] = true
if _root.has_method(&"update"):
_root.call_deferred(&"update")
return true
func _update(mk : MickeyTool, list : BaseList) -> void:
if !is_instance_valid(mk) or !mk.is_valid():
return
var index : int = mk.get_index()
if index > -1 and list.item_count() > index:
var icon : Texture2D = list.get_item_icon(index)
var modulate : Color = list.get_item_icon_modulate(index)
if icon and modulate != Color.WHITE and modulate != Color.BLACK:
var root : Node = mk.get_root()
var make : bool = true
if root.has_method(&"set_icon_color"):
make = root.call(&"set_icon_color", modulate)
if make:
if _buffer.has(icon):
icon = _buffer[icon]
else:
var new_icon : Texture2D = mod_image(icon, modulate)
_buffer[icon] = new_icon
icon = new_icon
mk.update_metadata(
list.get_item_text(index),
list.get_item_tooltip(index),
icon
)
func mod_image(icon: Texture2D, modulate_color: Color) -> Texture2D:
var image : Image = icon.get_image()
if image.get_format() != Image.FORMAT_RGBA8:
image.convert(Image.FORMAT_RGBA8)
var width : int = image.get_width()
var height : int = image.get_height()
for x : int in range(width):
for y : int in range(height):
var original_color: Color = image.get_pixel(x, y)
var modulated_color: Color = modulate_color
if original_color.a > 0.0:
modulated_color.a = original_color.a
image.set_pixel(x, y, modulated_color)
return ImageTexture.create_from_image(image)

View file

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

View file

@ -0,0 +1,63 @@
@tool
extends "./../../../core/editor/app.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func execute(arr : Variant = null) -> bool:
var value : Variant = arr[0]
var type : int = arr[1]
var _tool : MickeyTool = null
if value == null:
value = _manager.get_base_container().get_current_container()
elif value is Resource:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value.resource_path
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
elif value is String:
var list : ItemList = _manager.get_editor_list().get_editor_list()
var pth : String = value
for x : int in list.item_count:
if pth == list.get_item_tooltip(x):
_tool = _tool_db.get_tool_id(x)
break
if _tool == null:
if value is MickeyTool:
_tool = value
elif value is Node:
_tool = _tool_db.get_by_reference(value)
if is_instance_valid(_tool):
var root : Node = _tool.get_root()
var indx : int = _tool.get_control().get_index()
var index : PackedInt32Array = []
for x : MickeyTool in _tool_db.get_tools():
if x.get_root() == root:
if type < 0:
if x.get_control().get_index() < indx:
index.append(x.get_index())
elif type > 0:
if x.get_control().get_index() > indx:
index.append(x.get_index())
else:
if x.get_control().get_index() != indx:
index.append(x.get_index())
index.sort()
for z : int in range(index.size() - 1, -1, -1):
_manager.get_editor_list().remove(index[z])
return false

View file

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

View file

@ -0,0 +1,23 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
var _task : Array[Callable] = []
func has(callable : Callable) -> bool:
return _task.has(callable)
func add(task : Callable) -> void:
if task.is_valid():
_task.append(task)
func update() -> void:
for task : Callable in _task:
if task.is_valid():
task.call()
_task.clear()

View file

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

View file

@ -0,0 +1,64 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const MickeyTool = preload("./../../../core/editor/tools/magic/mickey_tool.gd")
var _tools : Array[MickeyTool] = []
func get_tools() -> Array[MickeyTool]:
return _tools
func append(mk : MickeyTool) -> void:
_tools.append(mk)
func garbage(val : int) -> void:
if val == 1:
for x : Variant in _tools:
if is_instance_valid(x):
(x as MickeyTool).set_queue_free(true)
elif val == 0:
for x : int in range(_tools.size() - 1, -1, -1):
var variant : Variant = _tools[x]
if !is_instance_valid(variant):
_tools.remove_at(x)
if !variant.is_valid():
if !is_instance_valid(variant.get_owner()):
var root : Node = variant.get_root()
if is_instance_valid(root):
variant.get_root().queue_free()
variant.set_queue_free(true)
if (variant as MickeyTool).is_queue_free():
_tools.remove_at(x)
func get_tool_id(id : int) -> MickeyTool:
for x : MickeyTool in _tools:
if x.get_index() == id:
return x
return null
func has_tool_id(id : int) -> bool:
for x : MickeyTool in _tools:
if x.get_index() == id:
return true
return false
func clear() -> void:
for x : MickeyTool in _tools:
if is_instance_valid(x):
x.reset()
_tools.clear()
func get_by_reference(control : Node) -> MickeyTool:
for x : MickeyTool in _tools:
if x.has(control):
return x
return null

View file

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

View file

@ -0,0 +1,404 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const CreateTool = preload("./../../../core/editor/application/create_tool.gd")
const UpdateMetadata = preload("./../../../core/editor/application/update_metadata.gd")
const FocusTool = preload("./../../../core/editor/application/focus_tool.gd")
const SelectByIndex = preload("./../../../core/editor/application/select_by_index.gd")
const FocusByTab = preload("./../../../core/editor/application/focus_by_tab.gd")
const ReparentTool = preload("./../../../core/editor/application/reparent_tool.gd")
const MergeTool = preload("./../../../core/editor/application/merge_tool.gd")
const SplitColumn = preload("./../../../core/editor/application/split_column.gd")
const SplitRow = preload("./../../../core/editor/application/split_row.gd")
const RemoveByTab = preload("./../../../core/editor/application/remove_by_tab.gd")
const RefreshWarnings = preload("./../../../core/editor/application/refresh_warnings.gd")
const UpdateListSelection = preload("./../../../core/editor/application/update_list_selection.gd")
const SwapTab = preload("./../../../core/editor/application/swap_tab.gd")
const RmbMenu = preload("./../../../core/editor/application/rmb_menu.gd")
const UserTabClose = preload("./../../../core/editor/application/user_tab_close.gd")
const Io = preload("./../../../core/editor/application/io.gd")
const CustomSplit = preload("./../../../core/editor/application/custom_split.gd")
const ToolDB = preload("./../../../core/editor/database/tool_db.gd")
const Task = preload("./../../../core/editor/coroutine/task.gd")
const BaseContainer = preload("./../../../core/base/container.gd")
const BaseList = preload("./../../../core/base/list.gd")
signal update_request()
# API
var split_column : SplitColumn = null
var split_row : SplitRow = null
var refresh_warnings : RefreshWarnings = null
var merge_tool : MergeTool = null
# APPLICATION
var _create_tool : CreateTool = null
var _focus_tool : FocusTool = null
var _update_metadata : UpdateMetadata = null
var _select_by_index : SelectByIndex = null
var _focus_by_tab : FocusByTab = null
var _remove_by_tab : RemoveByTab = null
var _reparent_tool : ReparentTool = null
var _update_list_selection : UpdateListSelection = null
var _rmb_menu : RmbMenu = null
var _user_tab_close : UserTabClose = null
var _custom_split : CustomSplit = null
var io : Io = null
var swap_tab : SwapTab = null
# DB
var _tool_db : ToolDB = null
# REF
var _base_container : BaseContainer = null
var _base_list : BaseList = null
var _task : Task = null
func _app_setup() -> void:
_task = Task.new()
_tool_db = ToolDB.new()
_focus_tool = FocusTool.new(self, _tool_db)
_update_metadata = UpdateMetadata.new(self, _tool_db)
_create_tool = CreateTool.new(self, _tool_db)
_select_by_index = SelectByIndex.new(self, _tool_db)
_focus_by_tab = FocusByTab .new(self, _tool_db)
_reparent_tool = ReparentTool.new(self, _tool_db)
merge_tool = MergeTool.new(self, _tool_db)
_remove_by_tab = RemoveByTab.new(self, _tool_db)
_update_list_selection = UpdateListSelection.new(self, _tool_db)
swap_tab = SwapTab.new(self, _tool_db)
_rmb_menu = RmbMenu.new(self, _tool_db)
_user_tab_close = UserTabClose.new(self, _tool_db)
_custom_split = CustomSplit.new(self, _tool_db)
io = Io.new(self, _tool_db)
split_column = SplitColumn.new(self, _tool_db)
split_row = SplitRow.new(self, _tool_db)
refresh_warnings = RefreshWarnings.new(self, _tool_db)
_base_list.update_selections_callback = _update_list_selection.execute
func update_list(__ : Variant) -> void:
_base_list.update_list_selection()
func get_current_tool(ref : Node = null) -> ToolDB.MickeyTool:
if ref == null:
ref = _base_container.get_current_container()
return _tool_db.get_by_reference(ref)
func _init(base_container : BaseContainer, base_list : BaseList) -> void:
_base_container = base_container
_base_list = base_list
#_base_list.set_handler(self)
#
_base_list.updated.connect(update_all_metadata)
_base_list.item_selected.connect(_on_item_selected)
_base_list.move_item.connect(_move_item_list)
_base_container.update.connect(update_metadata)
_base_container.focus_by_tab.connect(_on_focus_tab)
_base_container.remove_by_tab.connect(_on_remove_tab)
_base_container.swap_tab.connect(_onswap_tab)
_base_container.same_swap_tab.connect(_on_same_swap_tab)
_base_container.change_container.connect(update_list)
_base_container.rmb_click.connect(_on_tab_rmb)
_base_container.exiting.connect(_on_exiting)
_app_setup()
func _on_exiting() -> void:
_tool_db.clear()
func get_total_editors() -> int:
var container : Control = _base_container.get_current_container()
if is_instance_valid(container):
return container.get_child_count()
return 0
func get_current_totaL_editors(current : Node) -> int:
var container : Control = null
if current == null:
container = _base_container.get_current_container()
elif current is Node:
container = _tool_db.get_by_reference(current).get_root()
if is_instance_valid(container):
return container.get_child_count()
return 0
func get_total_split_container(by_row : bool) -> int:
if by_row:
var rows : Array = []
for x : Node in _base_container.get_all_containers():
var parent : Node = x.get_parent()
if parent:
if !rows.has(parent):
rows.append(parent)
return rows.size()
else:
return _base_container.get_all_containers().size()
func get_total_splitters() -> int:
return _base_container.get_all_splitters().size()
func get_current_total_splitters(current : Node) -> int:
if current is CodeEdit:
var container : Control = null
var value : ToolDB.MickeyTool = _tool_db.get_by_reference(current)
if is_instance_valid(value) and value.is_valid():
container = _base_container.get_container(value.get_root())
if is_instance_valid(container):
return container.get_child_count()
return 0
return _base_container.get_current_splitters().size()
func clear() -> void:
_tool_db.clear()
func reset_by_control(control : Node) -> void:
var tls : Array[ToolDB.MickeyTool] = []
for x : ToolDB.MickeyTool in _tool_db.get_tools():
if x.is_valid():
if control.find_child(x.get_control().name, true, false):
tls.append(x)
for t : ToolDB.MickeyTool in tls:
t.reset()
func reset() -> void:
_tool_db.clear()
_base_container.reset()
_base_list.reset()
func _onswap_tab(from : Container, index : int, to : Container) -> void:
swap_tab.execute([from, index, to])
func _on_same_swap_tab(from : Container, index : int, type : StringName) -> void:
_custom_split.execute([from, index, type])
func _on_focus_tab(tab : TabContainer, index : int) -> void:
_focus_by_tab.execute([tab, index])
func _on_remove_tab(tab : TabContainer, index : int) -> void:
_remove_by_tab.execute([tab, index])
func _on_item_selected(i : int) -> void:
_select_by_index.execute(i)
func is_valid_item_index(index : int) -> bool:
return index > -1 and _base_list.item_count() > index and !_base_list.get_item_tooltip(index).is_empty() and !_base_list.get_item_text(index).is_empty()
func update() -> bool:
if !_base_container.has_method(&"is_active") or !_base_container.is_active():
return false
_task.update()
_tool_db.garbage(1)
var update_required : bool = false
for x : Node in _base_container.get_editors():
update_required = !_create_tool.execute(x) || update_required
_tool_db.garbage(0)
_base_container.garbage()
_select_by_index.execute(_base_list.get_selected_id())
_update_root()
_base_container.update_split_container()
_base_list.update_list()
return !update_required
# API
func set_symbol(__ : String) -> void:
var tl : ToolDB.MickeyTool = _tool_db.get_tool_id(_base_list.get_selected_id())
if is_instance_valid(tl):
_focus_tool.execute(tl)
var gui : Node = tl.get_gui()
if gui is CodeEdit:
_center.call_deferred(gui)
else:
for x : Node in gui.get_children():
if x is RichTextLabel:
_center.call_deferred(x)
func _center(gui : Variant) -> void:
if is_instance_valid(gui):
if gui is CodeEdit:
if gui.get_caret_count() > 0:
gui.scroll_vertical = gui.get_scroll_pos_for_line(maxi(gui.get_caret_line(0) - 1, 0))
gui.center_viewport_to_caret.call_deferred(0)
func unsplit_column(current : Variant) -> void:
if merge_tool.execute([current, false]):
update_request.emit()
func unsplit_row(current : Variant) -> void:
if merge_tool.execute([current, true]):
update_request.emit()
func move_tool(control : Control, index : int) -> bool:
return _reparent_tool.execute([control, index])
func get_current_root() -> Control:
return _base_container.get_current_editor()
func get_editor_list() -> BaseList:
return _base_list
func get_base_container() -> BaseContainer:
return _base_container
func get_editor_container() -> TabContainer:
return _base_container.get_editor_container()
func select_editor_by_index(index : int) -> void:
_base_list.select(index)
func focus_tool(mk : Variant) -> void:
_focus_tool.execute(mk)
func tool_created() -> void:
_base_container.tool_created()
func update_metadata(mk : Variant = null) -> void:
_task.add(_update_metadata.execute.bind(mk))
update_request.emit()
func update_all_metadata() -> void:
if !_task.has(_update_metadata.execute):
_task.add(_update_metadata.execute)
update_request.emit()
func clear_editors() -> void:
if !_task.has(_clear_editor):
_task.add(_clear_editor)
update_request.emit()
func _clear_editor() -> void:
var spls : Array[Node] = _base_container.get_all_splitters()
var total : int = spls.size()
if total > 1:
total = 0
for x : Node in spls:
if is_instance_valid(x):
if x.is_queued_for_deletion():
continue
total += 1
if total > 1:
for x : Node in spls:
if x.get_child_count() == 0:
if total < 2:
return
var c : Node = _base_container.get_container_item(x)
if c and !c.is_queued_for_deletion():
var container : Node = _base_container.get_container(x)
if container and container.get_child_count() < 2:
container.get_parent().queue_free()
c.queue_free()
total -= 1
func _update_root() -> void:
var root : Control = _base_container.get_root_container()
if root:
var v : bool = false
var nodes : Array[Node] = root.get_tree().get_nodes_in_group(&"__SP_IC__")
var total : int = nodes.size()
for x : Node in nodes:
if total < 2:
break
if x.get_child_count() == 0:
x.queue_free()
total -= 1
else:
if x.get_child(0).get_child_count() == 0:
x.queue_free()
total -= 1
for x : Node in _base_container.get_all_splitters():
if x.get_child_count() > 0:
v = true
break
root.get_parent().visible = v
func get_control_tool_by_current(current : Variant) -> Node:
var root : Node = null
if null == current or current is PackedStringArray and current.size() == 0:
current = get_base_container().get_current_container()
if current is TabContainer:
var i : int = current.current_tab
if i > -1:
current = current.get_child(i)
if current:
if current is String:
for x : int in _base_list.item_count():
if current == _base_list.get_item_tooltip(x):
var mk : ToolDB.MickeyTool = _tool_db.get_tool_id(x)
if mk:
root = mk.get_control()
break
elif current is Node:
for x : ToolDB.MickeyTool in _tool_db.get_tools():
if x.has(current):
root = x.get_control()
break
return root
func _on_tab_rmb(index : int, tab : TabContainer) -> void:
_rmb_menu.execute([index, tab])
func left_tab_close(value : Variant) -> void:
_user_tab_close.execute([value, -1])
func right_tab_close(value : Variant) -> void:
_user_tab_close.execute([value, 1])
func others_tab_close(value : Variant) -> void:
_user_tab_close.execute([value, 0])
func _move_item_list(from : int, to : int) -> void:
move_item_container(null, from, to)
func move_item_container(container : TabContainer, from : int, to : int) -> void:
var vfrom : int = -1
var vto : int = -1
if container == null:
vfrom = from
vto = to
else:
for x : ToolDB.MickeyTool in _tool_db.get_tools():
if x.get_root() == container:
var _idx : int = x.get_control().get_index()
if _idx == from:
vfrom = x.get_index()
elif _idx == to:
vto = x.get_index()
if vfrom == -1 or vto == -1:
return
_base_container.move_container(vfrom, vto)

View file

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

View file

@ -0,0 +1,18 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const MickeyTool = preload("./../../../core/editor/tools/magic/mickey_tool.gd")
const MickeyToolRoute = preload("./../../../core/editor/tools/magic/mickey_tool_route.gd")
func build(control : Node) -> MickeyTool:
return _build_tool(control)
func _build_tool(_control : Node) -> MickeyTool:
return null

View file

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

View file

@ -0,0 +1,49 @@
@tool
extends "./../../../core/editor/tools/editor_tool.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func _build_tool(control : Node) -> MickeyTool:
if control is ScriptEditorBase:
return null
if control.name.begins_with("@"):
return null
var mickey : MickeyTool = null
for x : Node in control.get_children():
if x is RichTextLabel:
var canvas : VBoxContainer = VBoxContainer.new()
canvas.size_flags_vertical = Control.SIZE_EXPAND_FILL
canvas.size_flags_vertical = Control.SIZE_EXPAND_FILL
var childs : Array[Node] = control.get_children()
for n : Node in childs:
control.remove_child(n)
canvas.add_child(n)
canvas.size = control.size
mickey = MickeyToolRoute.new(control, canvas, canvas)
break
return mickey
func _handler(control : Node) -> MickeyTool:
var mickey : MickeyTool = null
if control is RichTextLabel:
var canvas : VBoxContainer = VBoxContainer.new()
canvas.size_flags_vertical = Control.SIZE_EXPAND_FILL
canvas.size_flags_vertical = Control.SIZE_EXPAND_FILL
if canvas.get_child_count() < 1:
var childs : Array[Node] = control.get_children()
for n : Node in childs:
control.remove_child(n)
canvas.add_child(n)
canvas.size = control.size
mickey = MickeyToolRoute.new(control, canvas, canvas)
return mickey

View file

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

View file

@ -0,0 +1,228 @@
@tool
extends RefCounted
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
const Notfy = preload("./../../../../core/util/control.gd")
signal focus(_tool : Object)
signal new_symbol(symbol : String)
signal clear()
var _owner : Control = null
var _root_control : Control = null
var _control : Control = null
var _index : int = -1
var _queue_free : bool = false
func set_queue_free(q : bool) -> void:
_queue_free = q
func is_queue_free() -> bool:
return _queue_free
func is_valid() -> bool:
for x : Variant in [_owner, _root_control, _control]:
if !is_instance_valid(x) or (x as Node).is_queued_for_deletion() or !(x as Node).is_inside_tree():
return false
return _owner != get_root()
func update_metadata(tittle : String, tooltips : String, icon : Texture2D) -> void:
if is_instance_valid(_control):
var parent : Node = _root_control
for __ : int in range(0, 4, 1):
if parent is TabContainer or parent == null:
break
parent = parent.get_parent()
if parent is TabContainer:
var index : int = _root_control.get_index()
if index > -1 and parent.get_tab_count() > index:
if !tittle.is_empty() and parent.get_tab_title(index) != tittle:
parent.set_tab_title(index, tittle)
_root_control.name = tittle
if !tooltips.is_empty() and parent.get_tab_tooltip(index) != tooltips:
parent.set_tab_tooltip(index, tooltips)
parent.set_tab_icon(index, icon)
func ochorus(root : Node) -> void:
if is_instance_valid(_root_control) and is_instance_valid(root):
var parent : Node = _root_control.get_parent()
if parent != root:
_connect_callback(false)
if parent:
_root_control.reparent(root)
else:
root.add_child(_root_control)
if _owner == root:
if _root_control.get_index() != _index:
if _owner.get_child_count() > _index:
_owner.move_child(_root_control, _index)
else:
if root is TabContainer:
var tittle_id : int = _root_control.get_index()
if tittle_id > -1 and tittle_id < root.get_tab_count():
var tl : String = root.get_tab_title(tittle_id)
if tl.is_empty() or (tl.begins_with("@") and "Text" in tl):
root.set_tab_title(tittle_id, "Editor")
_connect_callback(true)
_root_control.visible = true
func trigger_focus() -> void:
focus.emit(self)
func get_owner() -> Node:
return _owner
func get_root() -> Node:
if _root_control:
return _root_control.get_parent()
return null
func get_root_control() -> Node:
if _root_control:
var node : Node = _root_control.get_parent()
if node:
return node.get_parent()
return null
func get_control() -> Node:
return _root_control
func get_gui() -> Node:
return _control
func has(current_control : Node) -> bool:
return _owner == current_control or _root_control == current_control or _control == current_control or get_root() == current_control
func _init(owner_control : Control, current_root_control : Control, current_control : Control) -> void:
_owner = owner_control
_root_control = current_root_control
_control = current_control
_index = current_root_control.get_index()
_owner.tree_exiting.connect(reset)
for x : Control in [
_owner, _root_control, _control
]:
x.set_script(Notfy)
if _owner == x:
x.panic()
if x.has_signal(&"notification"):
if !x.is_connected(&"notification", _on_not):
x.connect(&"notification", _on_not)
_con_focus(_control, true)
func _con_focus(n : Node, con : bool) -> void:
if n is Control:
if n.focus_mode != Control.FOCUS_NONE:
if con:
if !_control.gui_input.is_connected(_on_input):
_control.gui_input.connect(_on_input)
else:
if _control.gui_input.is_connected(_on_input):
_control.gui_input.disconnect(_on_input)
for x : Node in n.get_children():
_con_focus(x, con)
func _get_callables(gui : Control) -> Array:
return [
[gui.focus_entered, _i_like_coffe],
#[gui.focus_exited, _i_like_candy],
#[gui.visibility_changed, _i_like_coffe],
]
func _connect_callback(con : bool) -> void:
var gui : Control = _control
if gui is VBoxContainer:
gui = gui.get_child(0)
var arr : Array = _get_callables(gui)
if gui is CodeEdit:
arr.append([gui.symbol_lookup, _on_symb])
if _control.focus_mode != Control.FOCUS_NONE:
_con_focus(_control, con)
for x : Array in arr:
if con:
if !x[0].is_connected(x[1]):
x[0].connect(x[1])
else:
if x[0].is_connected(x[1]):
x[0].disconnect(x[1])
if con:
if is_instance_valid(gui):
focus.emit.call_deferred(self)
elif is_instance_valid(_control):
_control.modulate = Color.WHITE
func _on_not(what : int) -> void:
if what == NOTIFICATION_PREDELETE:
reset()
func get_index() -> int:
if is_instance_valid(_owner) and _owner.is_inside_tree():
return _owner.get_index()
return -1
func _i_like_coffe() -> void:
focus.emit(self)
func reset() -> void:
for x : Variant in [
_owner, _root_control, _control
]:
if is_instance_valid(x):
x.set_script(null)
if _control is CodeEdit and !_control.is_queued_for_deletion() and _control.get_parent() is VSplitContainer:
for x : Node in Engine.get_main_loop().get_nodes_in_group(&"__SCRIPT_SPLITTER__"):
x.script_merge(_control)
break
ochorus(_owner)
set_queue_free(true)
_owner = null
_root_control = null
_control = null
clear.emit()
func _context_update(window : Window, control : Control) -> void:
if is_instance_valid(window) and is_instance_valid(control):
var screen_rect: Rect2 = DisplayServer.screen_get_usable_rect(window.current_screen)
var gvp: Vector2 = control.get_screen_position() + control.get_local_mouse_position()
gvp.y = min(gvp.y, screen_rect.position.y + screen_rect.size.y - window.size.y + 16.0)
gvp.x = min(gvp.x, screen_rect.position.x + screen_rect.size.x - window.size.x + 16.0)
window.set_deferred(&"position", gvp)
func _on_input(input : InputEvent) -> void:
if input is InputEventMouseMotion:
return
if input is InputEventMouseButton:
if input.pressed and input.button_index == MOUSE_BUTTON_RIGHT:
for x : Node in _owner.get_children():
var variant : Node = x
if variant is Window and _control is Control:
_context_update.call_deferred(variant, _control)
trigger_focus()
func _on_symb(symbol: String, _line : int, _column: int, _edit : CodeEdit = null) -> void:
new_symbol.emit(symbol)

View file

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

View file

@ -0,0 +1,50 @@
@tool
extends "./../../../../core/editor/tools/magic/mickey_tool.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func has(current_control : Node) -> bool:
if super(current_control):
return true
for x : Node in current_control.get_children():
if super(x):
return true
return false
func ochorus(root : Node) -> void:
if is_instance_valid(_root_control) and is_instance_valid(root):
var parent : Node = _root_control.get_parent()
if parent != root:
_connect_callback(false)
if _owner == root:
var childs : Array[Node] = _root_control.get_children()
for n : Node in childs:
_root_control.remove_child(n)
_owner.add_child(n)
_root_control.queue_free()
else:
if parent:
_root_control.reparent(root)
else:
root.add_child(_root_control)
if root is Control:
_root_control.size = root.size
if root is TabContainer:
var tittle_id : int = _root_control.get_index()
if tittle_id > -1 and tittle_id < root.get_tab_count():
var tl : String = root.get_tab_title(tittle_id)
if tl.is_empty() or (tl.begins_with("@") and "Text" in tl):
root.set_tab_title(tittle_id, "Editor")
_connect_callback(true)
_root_control.visible = true

View file

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

View file

@ -0,0 +1,26 @@
@tool
extends "./../../../core/editor/tools/editor_tool.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func _build_tool(control : Node) -> MickeyTool:
if control is ScriptEditorBase:
var editor : Control = control.get_base_editor()
var mickey_tool : MickeyTool = null
if editor is CodeEdit:
var rcontrol : Node = editor.get_parent()
if is_instance_valid(rcontrol):
for __ : int in range(5):
if rcontrol == null:
break
elif rcontrol is VSplitContainer:
mickey_tool = MickeyTool.new(rcontrol.get_parent(), rcontrol, editor)
break
rcontrol = rcontrol.get_parent()
return mickey_tool
return null

View file

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

View file

@ -0,0 +1,22 @@
@tool
extends "./../../../core/editor/tools/editor_tool.gd"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Script Splitter
# https://github.com/CodeNameTwister/Script-Splitter
#
# Script Splitter addon for godot 4
# author: "Twister"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
func _build_tool(control : Node) -> MickeyTool:
if control is ScriptEditorBase:
var editor : Control = control.get_base_editor()
var mickey_tool : MickeyTool = null
if editor is CodeEdit:
var parent : Node = control.get_parent()
if parent != null and parent.is_node_ready() and !control.get_parent() is VSplitContainer:
mickey_tool = MickeyTool.new(control, editor, editor)
else:
mickey_tool = MickeyTool.new(control, editor, editor)
return mickey_tool
return null

View file

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