- New selfmade Font
- persistent files - Hiscore
This commit is contained in:
parent
4676b83b61
commit
4c881027a1
56 changed files with 1711 additions and 175 deletions
31
addons/SignalVisualizer/Visualizer/resizable_label.gd
Normal file
31
addons/SignalVisualizer/Visualizer/resizable_label.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
@tool
|
||||
extends Label
|
||||
|
||||
# Properties
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
|
||||
|
||||
# Lifecycle
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
|
||||
|
||||
# Signals
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
|
||||
|
||||
# Methods
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func get_text_size() -> Vector2:
|
||||
return get_theme_default_font().get_string_size(text)
|
94
addons/SignalVisualizer/Visualizer/signal_graph_node.gd
Normal file
94
addons/SignalVisualizer/Visualizer/signal_graph_node.gd
Normal file
|
@ -0,0 +1,94 @@
|
|||
@tool
|
||||
class_name SignalGraphNode extends GraphNode
|
||||
|
||||
# Properties
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
var connections: Array = [] :
|
||||
get: return connections
|
||||
set(new_value):
|
||||
connections = new_value
|
||||
|
||||
# Lifecycle
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _ready():
|
||||
selectable = true
|
||||
resizable = true
|
||||
draggable = true
|
||||
|
||||
# Signals
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _on_resize_request(new_minsize):
|
||||
size = new_minsize
|
||||
|
||||
# Methods
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func has_source_signal_description(signal_name: String, destination_node_name: String) -> bool:
|
||||
for child in get_children():
|
||||
if child.name == "source_" + signal_name + "_" + destination_node_name:
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func get_source_slot(signal_name: String, destination_node_name: String) -> int:
|
||||
var index = 0
|
||||
for child in get_children():
|
||||
if child.name == "source_" + signal_name + "_" + destination_node_name:
|
||||
return index
|
||||
|
||||
index += 1
|
||||
|
||||
return -1
|
||||
|
||||
func get_next_source_slot(signal_name: String, destination_node_name: String) -> int:
|
||||
var index = 0
|
||||
for child in get_children():
|
||||
if child.name.begins_with("source_"):
|
||||
if child.name == "source_" + signal_name + "_" + destination_node_name:
|
||||
return index
|
||||
|
||||
index += 1
|
||||
|
||||
return -1
|
||||
|
||||
func has_destination_signal_description(signal_name: String, method_signature: String) -> bool:
|
||||
for child in get_children():
|
||||
if child.name == "destination_" + signal_name + "_" + _sanitize_method_signature(method_signature):
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func get_destination_slot(signal_name: String, method_signature: String) -> int:
|
||||
var index = 0
|
||||
for child in get_children():
|
||||
if child.name == "destination_" + signal_name + "_" + _sanitize_method_signature(method_signature):
|
||||
return index
|
||||
|
||||
index += 1
|
||||
|
||||
return -1
|
||||
|
||||
func get_next_destination_slot(signal_name: String, method_signature: String) -> int:
|
||||
var index = 0
|
||||
for child in get_children():
|
||||
if child.name.begins_with("destination_"):
|
||||
if child.name == "destination_" + signal_name + "_" + _sanitize_method_signature(method_signature):
|
||||
return index
|
||||
|
||||
index += 1
|
||||
|
||||
return -1
|
||||
|
||||
func _sanitize_method_signature(signature: String) -> String:
|
||||
return signature.replace("::", "__")
|
12
addons/SignalVisualizer/Visualizer/signal_graph_node.tscn
Normal file
12
addons/SignalVisualizer/Visualizer/signal_graph_node.tscn
Normal file
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cq10iaub18e54"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SignalVisualizer/Visualizer/signal_graph_node.gd" id="1_ovklj"]
|
||||
|
||||
[node name="SignalGraphNode" type="GraphNode"]
|
||||
custom_minimum_size = Vector2(100, 50)
|
||||
offset_right = 232.0
|
||||
offset_bottom = 54.0
|
||||
resizable = true
|
||||
script = ExtResource("1_ovklj")
|
||||
|
||||
[connection signal="resize_request" from="." to="." method="_on_resize_request"]
|
57
addons/SignalVisualizer/Visualizer/signal_graph_node_item.gd
Normal file
57
addons/SignalVisualizer/Visualizer/signal_graph_node_item.gd
Normal file
|
@ -0,0 +1,57 @@
|
|||
@tool
|
||||
class_name SignalGraphNodeItem extends Control
|
||||
|
||||
signal open_script(metadata: SignalGraphNodeItem.Metadata)
|
||||
|
||||
class Metadata:
|
||||
var signal_name: String
|
||||
var method_signature: String
|
||||
var node_name: String
|
||||
|
||||
func _init(signal_name: String, method_signature: String, node_name: String):
|
||||
self.signal_name = signal_name
|
||||
self.method_signature = method_signature
|
||||
self.node_name = node_name
|
||||
|
||||
# Properties
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
@onready var label: Label = %DescriptionLabel
|
||||
|
||||
var signal_data: Metadata = null
|
||||
|
||||
var text: String = "" :
|
||||
get: return text
|
||||
set(new_value):
|
||||
text = new_value
|
||||
if label:
|
||||
label.text = text
|
||||
|
||||
# Lifecycle
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _ready():
|
||||
_update()
|
||||
|
||||
# Signals
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _on_open_signal_in_script_button_pressed():
|
||||
open_script.emit(signal_data)
|
||||
|
||||
# Methods
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _update():
|
||||
label.text = text
|
||||
|
||||
var text_size = label.get_text_size()
|
||||
custom_minimum_size = Vector2((text_size.x * 2) + 50, text_size.y * 3)
|
|
@ -0,0 +1,43 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b2lwtwp6kpwtb"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SignalVisualizer/Visualizer/signal_graph_node_item.gd" id="1_jrd34"]
|
||||
[ext_resource type="Script" path="res://addons/SignalVisualizer/Visualizer/resizable_label.gd" id="2_4wwd5"]
|
||||
|
||||
[node name="SignalItem" type="Control"]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(51, 23)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_jrd34")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
custom_minimum_size = Vector2(100, 50)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="DescriptionLabel" type="Label" parent="HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
vertical_alignment = 1
|
||||
clip_text = true
|
||||
script = ExtResource("2_4wwd5")
|
||||
|
||||
[node name="OpenSignalInScriptButton" type="Button" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Open"
|
||||
flat = true
|
||||
|
||||
[connection signal="pressed" from="HBoxContainer/OpenSignalInScriptButton" to="." method="_on_open_signal_in_script_button_pressed"]
|
67
addons/SignalVisualizer/Visualizer/signal_visualizer_dock.gd
Normal file
67
addons/SignalVisualizer/Visualizer/signal_visualizer_dock.gd
Normal file
|
@ -0,0 +1,67 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
signal open_script(node_name: String, method_signature: String)
|
||||
|
||||
var SignalGraphNode = preload("res://addons/SignalVisualizer/Visualizer/signal_graph_node.tscn")
|
||||
var GraphNodeItem = preload("res://addons/SignalVisualizer/Visualizer/signal_graph_node_item.tscn")
|
||||
|
||||
# Properties
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
const SOURCE_COLOR: Color = Color.SKY_BLUE
|
||||
const DESTINATION_COLOR: Color = Color.CORAL
|
||||
const CONNECTION_TYPE: int = 0
|
||||
|
||||
@onready var arrange_nodes_checkbox: CheckBox = %ArrangeNodesCheckBox
|
||||
@onready var signal_details_checkbox: CheckBox = %SignalDetailsCheckBox
|
||||
@onready var signal_tree: Tree = %SignalTree
|
||||
@onready var graph: GraphEdit = %Graph
|
||||
|
||||
# Lifecycle
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
|
||||
|
||||
# Signals
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func _on_clear_graph_button_pressed():
|
||||
clear()
|
||||
|
||||
func _on_generate_graph_button_pressed():
|
||||
clear()
|
||||
|
||||
var scene_signal_graph = SignalGraphUtility.create_signal_graph_from_node(get_tree().edited_scene_root, true)
|
||||
SignalGraphUtility.generate_signal_graph_nodes(scene_signal_graph, graph, _on_open_signal_in_script)
|
||||
SignalGraphUtility.generate_signal_graph_tree(scene_signal_graph, signal_tree)
|
||||
|
||||
if arrange_nodes_checkbox.button_pressed:
|
||||
graph.arrange_nodes()
|
||||
|
||||
func _on_open_signal_in_script(data: SignalGraphNodeItem.Metadata):
|
||||
open_script.emit(data.node_name, data.method_signature)
|
||||
|
||||
# Methods
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
# |===================================|
|
||||
|
||||
func clear():
|
||||
_clear_graph_nodes()
|
||||
_clear_tree()
|
||||
|
||||
func _clear_graph_nodes():
|
||||
graph.clear_connections()
|
||||
for child in graph.get_children():
|
||||
if child is SignalGraphNode:
|
||||
child.queue_free()
|
||||
|
||||
func _clear_tree():
|
||||
signal_tree.clear()
|
|
@ -0,0 +1,78 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dppfamjc0ji40"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SignalVisualizer/Visualizer/signal_visualizer_dock.gd" id="1_akar5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmnff63evbdhv" path="res://addons/SignalVisualizer/Clear.svg" id="2_m8bsv"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxj8ep08wbnm6" path="res://addons/SignalVisualizer/GraphEdit.svg" id="3_dtmqs"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ae0jg"]
|
||||
|
||||
[node name="SignalVisualizerDock" type="Control"]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(2.08165e-12, 200)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_akar5")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
clip_contents = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(2.08165e-12, 50)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
alignment = 2
|
||||
|
||||
[node name="ArrangeNodesCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Arrange Nodes"
|
||||
|
||||
[node name="SignalDetailsCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Signal Details"
|
||||
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_ae0jg")
|
||||
|
||||
[node name="ClearGraphButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Clear Graph"
|
||||
icon = ExtResource("2_m8bsv")
|
||||
|
||||
[node name="GenerateGraphButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Generate Graph"
|
||||
icon = ExtResource("3_dtmqs")
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="SignalTree" type="Tree" parent="VBoxContainer/HSplitContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 2.08165e-12)
|
||||
layout_mode = 2
|
||||
column_titles_visible = true
|
||||
|
||||
[node name="Graph" type="GraphEdit" parent="VBoxContainer/HSplitContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/ClearGraphButton" to="." method="_on_clear_graph_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/GenerateGraphButton" to="." method="_on_generate_graph_button_pressed"]
|
Loading…
Add table
Add a link
Reference in a new issue