Add dialog system addon
Available here: https://github.com/EXPWorlds/Godot-Dialog-System
This commit is contained in:
parent
b12c7e85e8
commit
49c84f10d1
26 changed files with 2278 additions and 0 deletions
76
addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn
Normal file
76
addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Dialog_Editor" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_min_size = Vector2( 0, 256 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Close_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_right = 47.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Close the Dialog Editor."
|
||||||
|
text = "Close"
|
||||||
|
|
||||||
|
[node name="Back_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_left = 51.0
|
||||||
|
margin_right = 93.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Return to the Story Editor."
|
||||||
|
text = "Back"
|
||||||
|
|
||||||
|
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_left = 97.0
|
||||||
|
margin_right = 101.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Add_Node_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_left = 105.0
|
||||||
|
margin_right = 180.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Add a new node to the graph."
|
||||||
|
text = "Add Node"
|
||||||
|
|
||||||
|
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_left = 184.0
|
||||||
|
margin_right = 188.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Human_Readable_LBL" type="Label" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
margin_left = 192.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 378.0
|
||||||
|
margin_bottom = 17.0
|
||||||
|
text = "Human Readable Description"
|
||||||
|
|
||||||
|
[node name="GraphEdit" type="GraphEdit" parent="VBoxContainer"]
|
||||||
|
margin_top = 24.0
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 600.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
right_disconnects = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Back_BTN" to="." method="_on_Back_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Add_Node_BTN" to="." method="_on_Add_Node_BTN_pressed"]
|
||||||
|
[connection signal="connection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_connection_request"]
|
||||||
|
[connection signal="disconnection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_disconnection_request"]
|
52
addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn
Normal file
52
addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="WindowDialog" type="WindowDialog"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -540.0
|
||||||
|
margin_top = -384.0
|
||||||
|
margin_right = 540.0
|
||||||
|
margin_bottom = 384.0
|
||||||
|
window_title = "Node Editor"
|
||||||
|
resizable = true
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 13.0
|
||||||
|
margin_top = 13.0
|
||||||
|
margin_right = -13.0
|
||||||
|
margin_bottom = -13.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TextEdit" type="TextEdit" parent="VBoxContainer"]
|
||||||
|
margin_right = 1054.0
|
||||||
|
margin_bottom = 718.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
smooth_scrolling = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="OK_BTN" type="Button" parent="VBoxContainer"]
|
||||||
|
margin_left = 503.0
|
||||||
|
margin_top = 722.0
|
||||||
|
margin_right = 550.0
|
||||||
|
margin_bottom = 742.0
|
||||||
|
hint_tooltip = "Close the node editor."
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 0
|
||||||
|
text = "Close"
|
||||||
|
[connection signal="text_changed" from="VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/OK_BTN" to="." method="_on_OK_BTN_pressed"]
|
21
addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd
Normal file
21
addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
tool
|
||||||
|
extends WindowDialog
|
||||||
|
|
||||||
|
onready var _Text_Editor = self.get_node("VBoxContainer/TextEdit")
|
||||||
|
|
||||||
|
var _Target_Node
|
||||||
|
|
||||||
|
#Public Methods
|
||||||
|
|
||||||
|
func set_target_node(node):
|
||||||
|
self._Target_Node = node
|
||||||
|
self._Text_Editor.text = node.get_text()
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_OK_BTN_pressed():
|
||||||
|
self.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_TextEdit_text_changed():
|
||||||
|
self._Target_Node.set_text(self._Text_Editor.text)
|
111
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn
Normal file
111
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg" type="Texture" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
[node name="Line" type="GraphNode"]
|
||||||
|
margin_right = 324.0
|
||||||
|
margin_bottom = 137.0
|
||||||
|
rect_min_size = Vector2( 324, 137 )
|
||||||
|
title = "Line"
|
||||||
|
offset = Vector2( 40, 40 )
|
||||||
|
show_close = true
|
||||||
|
resizable = true
|
||||||
|
slot/0/left_enabled = true
|
||||||
|
slot/0/left_type = 0
|
||||||
|
slot/0/left_color = Color( 1, 1, 1, 1 )
|
||||||
|
slot/0/right_enabled = true
|
||||||
|
slot/0/right_type = 0
|
||||||
|
slot/0/right_color = Color( 1, 1, 1, 1 )
|
||||||
|
slot/1/left_enabled = false
|
||||||
|
slot/1/left_type = 0
|
||||||
|
slot/1/left_color = Color( 1, 1, 1, 1 )
|
||||||
|
slot/1/right_enabled = false
|
||||||
|
slot/1/right_type = 0
|
||||||
|
slot/1/right_color = Color( 1, 1, 1, 1 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
margin_left = 16.0
|
||||||
|
margin_top = 39.0
|
||||||
|
margin_right = 380.0
|
||||||
|
margin_bottom = 131.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_right = 364.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
|
||||||
|
[node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_right = 328.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
rect_min_size = Vector2( 256, 64 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
smooth_scrolling = true
|
||||||
|
|
||||||
|
[node name="Editor_BTN" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 332.0
|
||||||
|
margin_right = 364.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
rect_min_size = Vector2( 32, 0 )
|
||||||
|
hint_tooltip = "Expand this node's text editor."
|
||||||
|
icon = ExtResource( 2 )
|
||||||
|
expand_icon = true
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_top = 68.0
|
||||||
|
margin_right = 364.0
|
||||||
|
margin_bottom = 92.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Save_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_right = 125.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Save the current text as a template that can quickly loaded into new nodes."
|
||||||
|
text = "Save Template As"
|
||||||
|
|
||||||
|
[node name="Load_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 129.0
|
||||||
|
margin_right = 235.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Load a template from file."
|
||||||
|
text = "Load Template"
|
||||||
|
|
||||||
|
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 239.0
|
||||||
|
margin_right = 243.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
|
||||||
|
[node name="Link_LBL" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 247.0
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = 286.0
|
||||||
|
margin_bottom = 19.0
|
||||||
|
text = "Slots: "
|
||||||
|
|
||||||
|
[node name="Link_SpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 290.0
|
||||||
|
margin_right = 364.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Change the number of output slots on this node."
|
||||||
|
min_value = 1.0
|
||||||
|
value = 1.0
|
||||||
|
rounded = true
|
||||||
|
allow_greater = true
|
||||||
|
[connection signal="close_request" from="." to="." method="_on_Line_close_request"]
|
||||||
|
[connection signal="offset_changed" from="." to="." method="_on_Line_offset_changed"]
|
||||||
|
[connection signal="resize_request" from="." to="." method="_on_Line_resize_request"]
|
||||||
|
[connection signal="text_changed" from="VBoxContainer/HBoxContainer2/TextEdit" to="." method="_on_TextEdit_text_changed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Editor_BTN" to="." method="_on_Editor_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Save_BTN" to="." method="_on_Save_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Load_BTN" to="." method="_on_Load_BTN_pressed"]
|
||||||
|
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Link_SpinBox" to="." method="_on_Link_SpinBox_value_changed"]
|
|
@ -0,0 +1 @@
|
||||||
|
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v5l1.793-1.793 2.5 2.5 1.4141-1.4141-2.5-2.5 1.793-1.793h-5zm9 0 1.793 1.793-2.5 2.5 1.4141 1.4141 2.5-2.5 1.793 1.793v-5h-5zm-4.707 8.293-2.5 2.5-1.793-1.793v5h5l-1.793-1.793 2.5-2.5-1.4141-1.4141zm5.4141 0-1.4141 1.4141 2.5 2.5-1.793 1.793h5v-5l-1.793 1.793-2.5-2.5z" fill="#e0e0e0"/></svg>
|
After Width: | Height: | Size: 388 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg"
|
||||||
|
dest_files=[ "res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
114
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd
Normal file
114
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
tool
|
||||||
|
extends GraphNode
|
||||||
|
|
||||||
|
signal changed_offset(nid, vec2)
|
||||||
|
signal changed_size(this)
|
||||||
|
signal changed_slots(this)
|
||||||
|
signal erased(this)
|
||||||
|
signal pressed_editor(this)
|
||||||
|
signal pressed_load(this)
|
||||||
|
signal pressed_save(this)
|
||||||
|
signal text_changed(nid, new_text)
|
||||||
|
|
||||||
|
onready var _Link_SpinBox = self.get_node("VBoxContainer/HBoxContainer/Link_SpinBox")
|
||||||
|
onready var _Text_Editor = self.get_node("VBoxContainer/HBoxContainer2/TextEdit")
|
||||||
|
|
||||||
|
var _nid : int = 0
|
||||||
|
var _slot_amount : int = 1
|
||||||
|
|
||||||
|
#Virtual Methods
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self._update_slots()
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_Editor_BTN_pressed():
|
||||||
|
self.emit_signal("pressed_editor", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Line_close_request():
|
||||||
|
self.emit_signal("erased", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Line_offset_changed():
|
||||||
|
self.emit_signal("changed_offset", self._nid, self.offset)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Line_resize_request(new_minsize):
|
||||||
|
self.rect_size = new_minsize
|
||||||
|
self.emit_signal("changed_size", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Link_SpinBox_value_changed(value):
|
||||||
|
self._slot_amount = int(self._Link_SpinBox.value)
|
||||||
|
self._update_slots()
|
||||||
|
self.emit_signal("changed_slots", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_BTN_pressed():
|
||||||
|
self.emit_signal("pressed_load", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_BTN_pressed():
|
||||||
|
self.emit_signal("pressed_save", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_TextEdit_text_changed():
|
||||||
|
self.emit_signal("text_changed", self._nid, self._Text_Editor.text)
|
||||||
|
|
||||||
|
#Public Methods
|
||||||
|
|
||||||
|
func get_nid() -> int:
|
||||||
|
return self._nid
|
||||||
|
|
||||||
|
|
||||||
|
func get_slot_amount() -> int:
|
||||||
|
return self._slot_amount
|
||||||
|
|
||||||
|
|
||||||
|
func get_text() -> String:
|
||||||
|
return self._Text_Editor.text
|
||||||
|
|
||||||
|
|
||||||
|
func set_nid(new_nid):
|
||||||
|
self._nid = new_nid
|
||||||
|
var new_name = "NID " + str(new_nid)
|
||||||
|
self.title = new_name
|
||||||
|
self.name = new_name
|
||||||
|
|
||||||
|
|
||||||
|
func set_slot_amount(new_amount : int):
|
||||||
|
self._slot_amount = new_amount
|
||||||
|
|
||||||
|
|
||||||
|
func set_text(new_text : String):
|
||||||
|
self._Text_Editor.text = new_text
|
||||||
|
self.emit_signal("text_changed", self._nid, new_text)
|
||||||
|
|
||||||
|
#Private Methods
|
||||||
|
|
||||||
|
func _clear_link_labels():
|
||||||
|
var children = self.get_children()
|
||||||
|
for child in children:
|
||||||
|
if child is Label:
|
||||||
|
child.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _update_slots():
|
||||||
|
self.clear_all_slots()
|
||||||
|
self._clear_link_labels()
|
||||||
|
self.set_slot(0, true, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
|
||||||
|
var base_link_label = Label.new()
|
||||||
|
base_link_label.text = "0"
|
||||||
|
base_link_label.align = Label.ALIGN_RIGHT
|
||||||
|
self.add_child(base_link_label)
|
||||||
|
self.move_child(base_link_label, 0)
|
||||||
|
var last_output_link_label = base_link_label
|
||||||
|
for slot in range(1, self._slot_amount):
|
||||||
|
self.set_slot(slot, false, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
|
||||||
|
var output_link_label = Label.new()
|
||||||
|
output_link_label.text = str(slot)
|
||||||
|
output_link_label.align = Label.ALIGN_RIGHT
|
||||||
|
self.add_child_below_node(last_output_link_label, output_link_label)
|
||||||
|
last_output_link_label = output_link_label
|
224
addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd
Normal file
224
addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
tool
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_BTN_pressed
|
||||||
|
signal close_BTN_pressed
|
||||||
|
|
||||||
|
onready var _Graph = self.get_node("VBoxContainer/GraphEdit")
|
||||||
|
onready var _Human_Readable_LBL = self.get_node("VBoxContainer/VBoxContainer/Human_Readable_LBL")
|
||||||
|
|
||||||
|
var _Editor_TSCN = preload("res://addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn")
|
||||||
|
var _LineNode = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn")
|
||||||
|
var _NodeTemplate= preload("res://addons/EXP-System-Dialog/Resource_NodeTemplate/EXP_NodeTemplate.gd")
|
||||||
|
|
||||||
|
var _did : int = -1
|
||||||
|
var _Editor
|
||||||
|
var _Load_Template : EditorFileDialog
|
||||||
|
var _Save_Template_As : EditorFileDialog
|
||||||
|
var _Story_Editor
|
||||||
|
var _Target_Node
|
||||||
|
|
||||||
|
#Virtual Methods
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self._setup_dialogs()
|
||||||
|
self._Editor = _Editor_TSCN.instance()
|
||||||
|
self.add_child(self._Editor)
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_Add_Node_BTN_pressed():
|
||||||
|
var new_nid = self._Story_Editor.create_node(self._did, "line")
|
||||||
|
var new_line_node = self._LineNode.instance()
|
||||||
|
new_line_node.offset += self._Graph.scroll_offset
|
||||||
|
new_line_node.set_nid(new_nid)
|
||||||
|
new_line_node.connect("erased", self, "_on_Node_erased")
|
||||||
|
new_line_node.connect("changed_offset", self, "_on_Node_changed_offset")
|
||||||
|
new_line_node.connect("text_changed", self, "_on_Node_text_changed")
|
||||||
|
new_line_node.connect("pressed_save", self, "_on_Node_pressed_save")
|
||||||
|
new_line_node.connect("pressed_load", self, "_on_Node_pressed_load")
|
||||||
|
new_line_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
|
||||||
|
new_line_node.connect("changed_slots", self, "_on_Node_changed_slots")
|
||||||
|
new_line_node.connect("changed_size", self, "_on_Node_changed_size")
|
||||||
|
var slot_count = self._Story_Editor.get_node_property(self._did, new_nid, "slot_amount")
|
||||||
|
self._Story_Editor.set_node_property(self._did, new_nid, "rect_size", new_line_node.rect_size)
|
||||||
|
new_line_node.set_slot_amount(slot_count)
|
||||||
|
self._Graph.add_child(new_line_node)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Back_BTN_pressed():
|
||||||
|
self.emit_signal("back_BTN_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Close_BTN_pressed():
|
||||||
|
self.emit_signal("close_BTN_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_GraphEdit_connection_request(from, from_slot, to, to_slot):
|
||||||
|
self._Graph.connect_node(from, from_slot, to, to_slot)
|
||||||
|
var from_node = self._Graph.get_node(from)
|
||||||
|
var to_node = self._Graph.get_node(to)
|
||||||
|
var from_node_nid = from_node.get_nid()
|
||||||
|
var to_node_nid = to_node.get_nid()
|
||||||
|
self._Story_Editor.set_link(self._did, from_node_nid, from_slot, to_node_nid)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot):
|
||||||
|
self._Graph.disconnect_node(from, from_slot, to, to_slot)
|
||||||
|
var from_node = self._Graph.get_node(from)
|
||||||
|
var from_node_nid = from_node.get_nid()
|
||||||
|
self._Story_Editor.erase_link(self._did, from_node_nid, from_slot)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_Template_file_selected(filename):
|
||||||
|
var file_data = load(filename)
|
||||||
|
if not file_data.TYPE == "EXP_Dialog_Node_Template_editor":
|
||||||
|
return
|
||||||
|
|
||||||
|
self._Target_Node.set_text(file_data.template)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_changed_offset(nid, new_offset):
|
||||||
|
self._Story_Editor.set_node_property(self._did, nid, "graph_offset", new_offset)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_changed_size(changed_node):
|
||||||
|
var changed_node_nid = changed_node.get_nid()
|
||||||
|
self._Story_Editor.set_node_property(self._did, changed_node_nid, "rect_size", changed_node.rect_size)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_changed_slots(changed_node):
|
||||||
|
var changed_node_nid = changed_node.get_nid()
|
||||||
|
self._unlink_nid_from_story(changed_node_nid)
|
||||||
|
self._disconnect_all_from(changed_node)
|
||||||
|
self._Story_Editor.set_node_property(self._did, changed_node_nid, "slot_amount",
|
||||||
|
changed_node.get_slot_amount())
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_erased(deleted_node):
|
||||||
|
var deleted_nid = deleted_node.get_nid()
|
||||||
|
self._unlink_nid_from_story(deleted_nid)
|
||||||
|
self._Story_Editor.erase_node(self._did, deleted_nid)
|
||||||
|
self._disconnect_all_from(deleted_node)
|
||||||
|
deleted_node.queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_pressed_editor(node):
|
||||||
|
self._Editor.set_target_node(node)
|
||||||
|
self._Editor.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_pressed_load(node):
|
||||||
|
self._Target_Node = node
|
||||||
|
self._Load_Template.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_pressed_save(node):
|
||||||
|
self._Target_Node = node
|
||||||
|
self._Save_Template_As.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Node_text_changed(nid, new_text):
|
||||||
|
self._Story_Editor.set_node_property(self._did, nid, "text", new_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_Template_As_file_selected(filename):
|
||||||
|
var save_file = _NodeTemplate.new()
|
||||||
|
save_file.template = self._Target_Node.get_text()
|
||||||
|
ResourceSaver.save(filename, save_file)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Story_Editor_dialog_edit_pressed(story_editor, did : int):
|
||||||
|
self._Story_Editor = story_editor
|
||||||
|
self._did = did
|
||||||
|
self._Human_Readable_LBL.text = self._Story_Editor.get_dialog_property(self._did, "human_readable_description")
|
||||||
|
self._clear_nodes()
|
||||||
|
self._populate_graph()
|
||||||
|
self._link_node_connections()
|
||||||
|
|
||||||
|
#Private Methods
|
||||||
|
|
||||||
|
func _clear_nodes():
|
||||||
|
self._Graph.clear_connections()
|
||||||
|
var children = self._Graph.get_children()
|
||||||
|
for child in children:
|
||||||
|
if child is GraphNode:
|
||||||
|
child.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _disconnect_all_from(node):
|
||||||
|
var node_name = node.name
|
||||||
|
var connection_list = self._Graph.get_connection_list()
|
||||||
|
for connection in connection_list:
|
||||||
|
if connection["from"] == node.name or connection["to"] == node.name:
|
||||||
|
self._Graph.disconnect_node(connection["from"], connection["from_port"],
|
||||||
|
connection["to"], connection["to_port"])
|
||||||
|
|
||||||
|
|
||||||
|
func _link_node_connections():
|
||||||
|
var node_IDs = self._Story_Editor.get_nids(self._did)
|
||||||
|
for nID in node_IDs:
|
||||||
|
var slots = self._Story_Editor.get_link_slots(self._did, nID)
|
||||||
|
for slot in slots:
|
||||||
|
var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
|
||||||
|
var to = "NID " + str(to_node_nid)
|
||||||
|
var from = "NID " + str(nID)
|
||||||
|
self._Graph.connect_node(from, slot, to, 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _populate_graph():
|
||||||
|
var node_IDs = self._Story_Editor.get_nids(self._did)
|
||||||
|
for nID in node_IDs:
|
||||||
|
var new_node : GraphNode
|
||||||
|
match self._Story_Editor.get_node_property(self._did, nID, "type"):
|
||||||
|
"line":
|
||||||
|
new_node = _LineNode.instance()
|
||||||
|
var slot_count = self._Story_Editor.get_node_property(self._did, nID, "slot_amount")
|
||||||
|
new_node.set_slot_amount(slot_count)
|
||||||
|
self._Graph.add_child(new_node)
|
||||||
|
new_node.connect("erased", self, "_on_Node_erased")
|
||||||
|
var new_text = self._Story_Editor.get_node_property(self._did, nID, "text")
|
||||||
|
var new_rect_size = self._Story_Editor.get_node_property(self._did, nID, "rect_size")
|
||||||
|
new_node.rect_size = new_rect_size
|
||||||
|
new_node.set_text(new_text)
|
||||||
|
new_node.connect("text_changed", self, "_on_Node_text_changed")
|
||||||
|
new_node.connect("pressed_save", self, "_on_Node_pressed_save")
|
||||||
|
new_node.connect("pressed_load", self, "_on_Node_pressed_load")
|
||||||
|
new_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
|
||||||
|
new_node.connect("changed_slots", self, "_on_Node_changed_slots")
|
||||||
|
new_node.connect("changed_size", self, "_on_Node_changed_size")
|
||||||
|
|
||||||
|
new_node.set_nid(nID)
|
||||||
|
new_node.offset = self._Story_Editor.get_node_property(self._did, nID, "graph_offset")
|
||||||
|
new_node.connect("changed_offset", self, "_on_Node_changed_offset")
|
||||||
|
|
||||||
|
|
||||||
|
func _setup_dialogs():
|
||||||
|
self._Load_Template = EditorFileDialog.new()
|
||||||
|
self._Load_Template.mode = EditorFileDialog.MODE_OPEN_FILE
|
||||||
|
self._Load_Template.add_filter("*.res ; Template files")
|
||||||
|
self._Load_Template.resizable = true
|
||||||
|
self._Load_Template.access = EditorFileDialog.ACCESS_RESOURCES
|
||||||
|
self._Load_Template.current_dir = "res://"
|
||||||
|
self._Load_Template.connect("file_selected", self, "_on_Load_Template_file_selected")
|
||||||
|
self.add_child(self._Load_Template)
|
||||||
|
|
||||||
|
self._Save_Template_As = EditorFileDialog.new()
|
||||||
|
self._Save_Template_As.mode = EditorFileDialog.MODE_SAVE_FILE
|
||||||
|
self._Save_Template_As.add_filter("*.res ; Template files")
|
||||||
|
self._Save_Template_As.resizable = true
|
||||||
|
self._Save_Template_As.access = EditorFileDialog.ACCESS_RESOURCES
|
||||||
|
self._Save_Template_As.current_dir = "res://"
|
||||||
|
self._Save_Template_As.connect("file_selected", self, "_on_Save_Template_As_file_selected")
|
||||||
|
self.add_child(self._Save_Template_As)
|
||||||
|
|
||||||
|
|
||||||
|
func _unlink_nid_from_story(removed_nid):
|
||||||
|
self._Story_Editor.erase_all_links(self._did, removed_nid)
|
||||||
|
var nIDs = self._Story_Editor.get_nids(self._did)
|
||||||
|
for nID in nIDs:
|
||||||
|
var node_slots = self._Story_Editor.get_link_slots(self._did, nID)
|
||||||
|
for slot in node_slots:
|
||||||
|
var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
|
||||||
|
if to_node_nid == removed_nid:
|
||||||
|
self._Story_Editor.erase_link(self._did, nID, slot)
|
BIN
addons/EXP-System-Dialog/Images/de.png
Normal file
BIN
addons/EXP-System-Dialog/Images/de.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
34
addons/EXP-System-Dialog/Images/de.png.import
Normal file
34
addons/EXP-System-Dialog/Images/de.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/de.png-fbe4565917c56d102e03dea598024725.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/EXP-System-Dialog/Images/de.png"
|
||||||
|
dest_files=[ "res://.import/de.png-fbe4565917c56d102e03dea598024725.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
addons/EXP-System-Dialog/Images/icon.png
Normal file
BIN
addons/EXP-System-Dialog/Images/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 701 B |
34
addons/EXP-System-Dialog/Images/icon.png.import
Normal file
34
addons/EXP-System-Dialog/Images/icon.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/EXP-System-Dialog/Images/icon.png"
|
||||||
|
dest_files=[ "res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
addons/EXP-System-Dialog/Images/se.png
Normal file
BIN
addons/EXP-System-Dialog/Images/se.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
34
addons/EXP-System-Dialog/Images/se.png.import
Normal file
34
addons/EXP-System-Dialog/Images/se.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/EXP-System-Dialog/Images/se.png"
|
||||||
|
dest_files=[ "res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
|
@ -0,0 +1,83 @@
|
||||||
|
extends Reference
|
||||||
|
|
||||||
|
var _story : Dictionary = {}
|
||||||
|
var _names : Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
|
func get_dids() -> Array:
|
||||||
|
return self._story.keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_did_via_record_name(name : String) -> int:
|
||||||
|
assert(self._names.has(name))
|
||||||
|
return self._names[name]
|
||||||
|
|
||||||
|
|
||||||
|
func get_nid_from_slot(did : int, nid : int, slot : int) -> int:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
assert(self.has_nid(did, nid))
|
||||||
|
assert(self.has_slot(did, nid, slot))
|
||||||
|
return self._story[did]["nodes"][nid]["links"][slot]
|
||||||
|
|
||||||
|
|
||||||
|
func get_nid_via_exact_text(did : int, query : String) -> int:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
|
||||||
|
for nid in self._story[did]["nodes"].keys():
|
||||||
|
if self._story[did]["nodes"][nid]["text"] == query:
|
||||||
|
return nid
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
func get_nids(did : int) -> Array:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
return self._story[did]["nodes"].keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_slot_count(did : int, nid : int) -> int:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
assert(self.has_nid(did, nid))
|
||||||
|
return self._story[did]["nodes"][nid]["links"].size()
|
||||||
|
|
||||||
|
|
||||||
|
func get_slots(did : int, nid : int) -> Array:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
assert(self.has_nid(did, nid))
|
||||||
|
return self._story[did]["nodes"][nid]["links"].keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_text(did : int, nid : int) -> String:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
assert(self.has_nid(did, nid))
|
||||||
|
return self._story[did]["nodes"][nid]["text"]
|
||||||
|
|
||||||
|
|
||||||
|
func has_did(did : int) -> bool:
|
||||||
|
return self._story.has(did)
|
||||||
|
|
||||||
|
|
||||||
|
func has_nid(did : int, nid : int) -> bool:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
return self._story[did]["nodes"].has(nid)
|
||||||
|
|
||||||
|
|
||||||
|
func has_record_name(name : String) -> bool:
|
||||||
|
return self._names.has(name)
|
||||||
|
|
||||||
|
|
||||||
|
func has_slot(did: int, nid : int, slot : int) -> bool:
|
||||||
|
assert(self.has_did(did))
|
||||||
|
assert(self.has_nid(did, nid))
|
||||||
|
return self._story[did]["nodes"][nid]["links"].has(slot)
|
||||||
|
|
||||||
|
|
||||||
|
func read(file):
|
||||||
|
if not "TYPE" in file:
|
||||||
|
print_debug("Story reader failed to open file: ", str(file.filename))
|
||||||
|
return
|
||||||
|
if not file.TYPE == "EXP_Baked_Story" or file.TYPE == "EXP_Story_editor":
|
||||||
|
print_debug("Story reader failed to open file: ", str(file.filename))
|
||||||
|
return
|
||||||
|
|
||||||
|
self._story = file.story
|
||||||
|
self._names = file.names
|
|
@ -0,0 +1,6 @@
|
||||||
|
tool
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
export(String) var TYPE = "EXP_Baked_Story"
|
||||||
|
export(Dictionary) var story : Dictionary
|
||||||
|
export(Dictionary) var names : Dictionary
|
|
@ -0,0 +1,9 @@
|
||||||
|
tool
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
export(String) var TYPE = "EXP_Story_editor"
|
||||||
|
|
||||||
|
export(Dictionary) var names : Dictionary
|
||||||
|
export(Dictionary) var story : Dictionary
|
||||||
|
export(Array) var available_dids : Array
|
||||||
|
export(Array) var groups : Array
|
|
@ -0,0 +1,6 @@
|
||||||
|
tool
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
var TYPE = "EXP_Dialog_Node_Template_editor"
|
||||||
|
|
||||||
|
export(String) var template
|
|
@ -0,0 +1,109 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Dialog Record/dialog_record.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
|
bg_color = Color( 0.6, 0.6, 0.6, 0 )
|
||||||
|
border_color = Color( 0.8, 0.8, 0.8, 0 )
|
||||||
|
shadow_color = Color( 0, 0, 0, 0 )
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=2]
|
||||||
|
bg_color = Color( 0.6, 0.6, 0.6, 0 )
|
||||||
|
border_color = Color( 0.8, 0.8, 0.8, 0 )
|
||||||
|
shadow_color = Color( 0, 0, 0, 0 )
|
||||||
|
|
||||||
|
[node name="Dialog_Record" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
rect_min_size = Vector2( 0, 28 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_min_size = Vector2( 0, 24 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
color = Color( 1, 1, 1, 0.12549 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="ColorRect"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="CheckBox" type="CheckBox" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_right = 24.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
|
||||||
|
[node name="DID_LBL" type="Label" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 28.0
|
||||||
|
margin_top = 7.0
|
||||||
|
margin_right = 85.0
|
||||||
|
margin_bottom = 21.0
|
||||||
|
text = "DID: 101"
|
||||||
|
|
||||||
|
[node name="VSeparator" type="VSeparator" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 89.0
|
||||||
|
margin_right = 93.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
|
||||||
|
[node name="Edit_BTN" type="Button" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 97.0
|
||||||
|
margin_right = 138.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
hint_tooltip = "Edit this dialog record in the Dialog Editor."
|
||||||
|
text = "EDIT"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[node name="VSeparator4" type="VSeparator" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 142.0
|
||||||
|
margin_right = 146.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
|
||||||
|
[node name="Name_BTN" type="Button" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 150.0
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
hint_tooltip = "Edit this dialog record in the Dialog Editor."
|
||||||
|
text = "NAME"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[node name="VSeparator2" type="VSeparator" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 204.0
|
||||||
|
margin_right = 208.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
|
||||||
|
[node name="Group_BTN" type="OptionButton" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 212.0
|
||||||
|
margin_right = 274.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
hint_tooltip = "View groups applied to this dialog record."
|
||||||
|
text = "TAGS"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[node name="VSeparator3" type="VSeparator" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 278.0
|
||||||
|
margin_right = 282.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
|
||||||
|
[node name="Human_Readable_LineEdit" type="LineEdit" parent="ColorRect/HBoxContainer"]
|
||||||
|
margin_left = 286.0
|
||||||
|
margin_right = 476.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
custom_styles/focus = SubResource( 1 )
|
||||||
|
custom_styles/normal = SubResource( 2 )
|
||||||
|
text = "Human Readable Description"
|
||||||
|
expand_to_text_length = true
|
||||||
|
context_menu_enabled = false
|
||||||
|
[connection signal="toggled" from="ColorRect/HBoxContainer/CheckBox" to="." method="_on_CheckBox_toggled"]
|
||||||
|
[connection signal="pressed" from="ColorRect/HBoxContainer/Edit_BTN" to="." method="_on_Edit_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="ColorRect/HBoxContainer/Name_BTN" to="." method="_on_Name_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="ColorRect/HBoxContainer/Group_BTN" to="." method="_on_Group_BTN_pressed"]
|
||||||
|
[connection signal="focus_exited" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_focus_exited"]
|
||||||
|
[connection signal="text_changed" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_text_changed"]
|
|
@ -0,0 +1,91 @@
|
||||||
|
tool
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
signal changed_human_readable_text(did, text)
|
||||||
|
signal checked(this)
|
||||||
|
signal edit_pressed(did)
|
||||||
|
signal rename_pressed(this)
|
||||||
|
signal unchecked(this)
|
||||||
|
|
||||||
|
onready var _DID_LBL = self.get_node("ColorRect/HBoxContainer/DID_LBL")
|
||||||
|
onready var _Human_Readable_LineEdit = self.get_node("ColorRect/HBoxContainer/Human_Readable_LineEdit")
|
||||||
|
onready var _Group_List = self.get_node("ColorRect/HBoxContainer/Group_BTN")
|
||||||
|
onready var _Name_BTN = self.get_node("ColorRect/HBoxContainer/Name_BTN")
|
||||||
|
onready var _Select_CheckBox = self.get_node("ColorRect/HBoxContainer/CheckBox")
|
||||||
|
|
||||||
|
var _did : int = -1
|
||||||
|
var _Story_Editor
|
||||||
|
|
||||||
|
#Virtual Methods
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self.update_human_readable_description("Human Readable Description")
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_CheckBox_toggled(button_pressed):
|
||||||
|
if button_pressed:
|
||||||
|
self.emit_signal("checked", self)
|
||||||
|
else:
|
||||||
|
self.emit_signal("unchecked", self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Edit_BTN_pressed():
|
||||||
|
self.emit_signal("edit_pressed", self._did)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Group_BTN_pressed():
|
||||||
|
var groups = self._Story_Editor.dialog_get_groups(self._did)
|
||||||
|
self._Group_List.clear()
|
||||||
|
self._Group_List.text = "TAGS"
|
||||||
|
for group in groups:
|
||||||
|
self._Group_List.get_popup().add_item(group)
|
||||||
|
for idx in range(self._Group_List.get_item_count()):
|
||||||
|
self._Group_List.set_item_disabled(idx, true)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Human_Readable_LineEdit_focus_exited():
|
||||||
|
self._Human_Readable_LineEdit.deselect()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Human_Readable_LineEdit_text_changed(new_text):
|
||||||
|
self.emit_signal("changed_human_readable_text", self._did, new_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Name_BTN_pressed():
|
||||||
|
emit_signal("rename_pressed", self)
|
||||||
|
|
||||||
|
#Public Methods
|
||||||
|
|
||||||
|
func check():
|
||||||
|
self._Select_CheckBox.pressed = true
|
||||||
|
|
||||||
|
|
||||||
|
func get_did():
|
||||||
|
return self._did
|
||||||
|
|
||||||
|
|
||||||
|
func get_record_name():
|
||||||
|
return self._Name_BTN.text
|
||||||
|
|
||||||
|
|
||||||
|
func set_did(new_did : int):
|
||||||
|
self._did = new_did
|
||||||
|
self._DID_LBL.text = "DID: " + str(new_did)
|
||||||
|
|
||||||
|
|
||||||
|
func set_record_name(rename : String):
|
||||||
|
self._Name_BTN.text = rename
|
||||||
|
|
||||||
|
|
||||||
|
func set_story_editor(editor):
|
||||||
|
self._Story_Editor = editor
|
||||||
|
|
||||||
|
|
||||||
|
func uncheck():
|
||||||
|
self._Select_CheckBox.pressed = false
|
||||||
|
|
||||||
|
|
||||||
|
func update_human_readable_description(new_text):
|
||||||
|
self._Human_Readable_LineEdit.text = new_text
|
||||||
|
self.emit_signal("changed_human_readable_text", self._did, new_text)
|
|
@ -0,0 +1,92 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/rename_record_box.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Record_Rename_Box" type="WindowDialog"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -193.0
|
||||||
|
margin_top = -64.0
|
||||||
|
margin_right = 193.0
|
||||||
|
margin_bottom = 52.0
|
||||||
|
rect_min_size = Vector2( 386, 116 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
window_title = "Rename Dialog Record"
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 8.0
|
||||||
|
margin_top = 8.0
|
||||||
|
margin_right = -8.0
|
||||||
|
margin_bottom = -8.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 100.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Name_LBL" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 14.0
|
||||||
|
text = "Name:"
|
||||||
|
|
||||||
|
[node name="Spacer2" type="Control" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 18.0
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 22.0
|
||||||
|
rect_min_size = Vector2( 0, 4 )
|
||||||
|
|
||||||
|
[node name="Name_LineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 26.0
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 50.0
|
||||||
|
|
||||||
|
[node name="Spacer3" type="Control" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 54.0
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 58.0
|
||||||
|
rect_min_size = Vector2( 0, 4 )
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 62.0
|
||||||
|
margin_right = 370.0
|
||||||
|
margin_bottom = 82.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Cancel_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 106.0
|
||||||
|
margin_right = 160.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Cancel"
|
||||||
|
|
||||||
|
[node name="Spacer" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 164.0
|
||||||
|
margin_right = 196.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
rect_min_size = Vector2( 32, 0 )
|
||||||
|
|
||||||
|
[node name="Rename_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 200.0
|
||||||
|
margin_right = 264.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Rename"
|
||||||
|
[connection signal="text_entered" from="MarginContainer/VBoxContainer/Name_LineEdit" to="." method="_on_Name_LineEdit_text_entered"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Cancel_BTN" to="." method="_on_Cancel_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Rename_BTN" to="." method="_on_Rename_BTN_pressed"]
|
|
@ -0,0 +1,32 @@
|
||||||
|
tool
|
||||||
|
extends WindowDialog
|
||||||
|
|
||||||
|
signal rename_BTN_pressed(text)
|
||||||
|
|
||||||
|
onready var _Name_LineEdit = self.get_node("MarginContainer/VBoxContainer/Name_LineEdit")
|
||||||
|
|
||||||
|
var _Target_Record = null
|
||||||
|
|
||||||
|
#Public Methods
|
||||||
|
|
||||||
|
func get_target_record():
|
||||||
|
return self._Target_Record
|
||||||
|
|
||||||
|
|
||||||
|
func set_target_record(record):
|
||||||
|
self._Target_Record = record
|
||||||
|
self._Name_LineEdit.text = record.get_record_name()
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_Cancel_BTN_pressed():
|
||||||
|
self.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Rename_BTN_pressed():
|
||||||
|
self.visible = false
|
||||||
|
self.emit_signal("rename_BTN_pressed", self._Name_LineEdit.text)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Name_LineEdit_text_entered(new_text):
|
||||||
|
self._on_Rename_BTN_pressed()
|
268
addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn
Normal file
268
addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/story_editor.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="Story_Editor" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_min_size = Vector2( 0, 256 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Close_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_right = 47.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Close"
|
||||||
|
|
||||||
|
[node name="VSeparator5" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 51.0
|
||||||
|
margin_right = 55.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Story" type="MenuButton" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 59.0
|
||||||
|
margin_right = 103.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
text = "Story"
|
||||||
|
items = [ "New Story", null, 0, false, false, 0, 0, null, "", false, "Load Story", null, 0, false, false, 1, 0, null, "", false, "Save Story As", null, 0, false, false, 2, 0, null, "", false, "Bake Story As", null, 0, false, false, 3, 0, null, "", false, "Save CSV As", null, 0, false, false, 4, 0, null, "", false, "Load CSV", null, 0, false, false, 5, 0, null, "", false ]
|
||||||
|
|
||||||
|
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 107.0
|
||||||
|
margin_right = 111.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 115.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 163.0
|
||||||
|
margin_bottom = 17.0
|
||||||
|
text = "Dialog: "
|
||||||
|
|
||||||
|
[node name="Create_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 167.0
|
||||||
|
margin_right = 220.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Create a new dialog record."
|
||||||
|
text = "Create"
|
||||||
|
|
||||||
|
[node name="Delete_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 224.0
|
||||||
|
margin_right = 279.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Delete all checked dialog records."
|
||||||
|
text = "Delete"
|
||||||
|
|
||||||
|
[node name="Check_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 283.0
|
||||||
|
margin_right = 354.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Check all currently visible dialog records."
|
||||||
|
text = "Check All"
|
||||||
|
|
||||||
|
[node name="UnCheck_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 358.0
|
||||||
|
margin_right = 447.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Uncheck all currently visible dialog records."
|
||||||
|
text = "UnCheck All"
|
||||||
|
|
||||||
|
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 451.0
|
||||||
|
margin_right = 455.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 459.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 495.0
|
||||||
|
margin_bottom = 17.0
|
||||||
|
text = "Tags: "
|
||||||
|
|
||||||
|
[node name="Group_Manager_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 499.0
|
||||||
|
margin_right = 590.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Toggles the Group Manager open and closed. Use the Group Manager to add and delete groups that can be applied to dialog records in this story project."
|
||||||
|
toggle_mode = true
|
||||||
|
text = "Tag Manager"
|
||||||
|
|
||||||
|
[node name="VSeparator3" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 594.0
|
||||||
|
margin_right = 598.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="Apply_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 602.0
|
||||||
|
margin_right = 650.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Apply the group selected in the Group selector menu to all checked dialog records."
|
||||||
|
text = "Apply"
|
||||||
|
|
||||||
|
[node name="Remove_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 654.0
|
||||||
|
margin_right = 718.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Remove the group selected in the Group selector menu from all checked dialog records if the group is applied to them."
|
||||||
|
text = "Remove"
|
||||||
|
|
||||||
|
[node name="Group_Selector_BTN" type="OptionButton" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 722.0
|
||||||
|
margin_right = 779.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
hint_tooltip = "Select a group to apply or remove from dialog records."
|
||||||
|
text = "Tags"
|
||||||
|
|
||||||
|
[node name="VSeparator4" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 783.0
|
||||||
|
margin_right = 787.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
|
||||||
|
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_top = 24.0
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 572.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer3"]
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 548.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="VScrollBar" type="ScrollContainer" parent="VBoxContainer/HBoxContainer3/Panel"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_min_size = Vector2( 0, 128 )
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Dialog_Record_Root" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3/Panel/VScrollBar"]
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 548.0
|
||||||
|
rect_min_size = Vector2( 0, 128 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Group_Manager" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3"]
|
||||||
|
visible = false
|
||||||
|
margin_left = 824.0
|
||||||
|
margin_right = 1080.0
|
||||||
|
margin_bottom = 716.0
|
||||||
|
rect_min_size = Vector2( 256, 0 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
|
||||||
|
margin_right = 256.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
|
||||||
|
[node name="Add_Group_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
|
||||||
|
margin_right = 156.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
rect_min_size = Vector2( 128, 0 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="Add_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
|
||||||
|
margin_left = 160.0
|
||||||
|
margin_right = 197.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Add a group to this story project."
|
||||||
|
text = "Add"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Delete_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
|
||||||
|
margin_left = 201.0
|
||||||
|
margin_right = 256.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Remove the selected group from this story project."
|
||||||
|
text = "Delete"
|
||||||
|
|
||||||
|
[node name="Group_ItemList" type="ItemList" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
|
||||||
|
margin_top = 28.0
|
||||||
|
margin_right = 256.0
|
||||||
|
margin_bottom = 716.0
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
margin_top = 576.0
|
||||||
|
margin_right = 1024.0
|
||||||
|
margin_bottom = 600.0
|
||||||
|
rect_min_size = Vector2( 0, 24 )
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = 65.0
|
||||||
|
margin_bottom = 19.0
|
||||||
|
text = "Search by "
|
||||||
|
|
||||||
|
[node name="Search_OptionButton" type="OptionButton" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 69.0
|
||||||
|
margin_right = 233.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
text = "Human Readable LBL"
|
||||||
|
items = [ "Human Readable LBL", null, false, 0, null, "DID", null, false, 1, null ]
|
||||||
|
selected = 0
|
||||||
|
|
||||||
|
[node name="Search_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 237.0
|
||||||
|
margin_right = 493.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
rect_min_size = Vector2( 256, 0 )
|
||||||
|
|
||||||
|
[node name="Filter_MenuButton" type="MenuButton" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 497.0
|
||||||
|
margin_right = 537.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
hint_tooltip = "Select the groups that appear listed in the story editor."
|
||||||
|
keep_pressed_outside = true
|
||||||
|
text = "Tags"
|
||||||
|
flat = false
|
||||||
|
items = [ "-No Tags-", null, 1, true, false, 0, 0, null, "", false ]
|
||||||
|
|
||||||
|
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 541.0
|
||||||
|
margin_right = 545.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
|
||||||
|
[node name="Filename_LBL" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
margin_left = 549.0
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = 640.0
|
||||||
|
margin_bottom = 19.0
|
||||||
|
text = "Unsaved Story"
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Create_Dialog_BTN" to="." method="_on_Create_Dialog_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Delete_Dialog_BTN" to="." method="_on_Delete_Dialog_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Check_All_BTN" to="." method="_on_Check_All_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/UnCheck_All_BTN" to="." method="_on_Uncheck_All_BTN_pressed"]
|
||||||
|
[connection signal="toggled" from="VBoxContainer/HBoxContainer/Group_Manager_BTN" to="." method="_on_Group_Manager_BTN_toggled"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Apply_Group_BTN" to="." method="_on_Apply_Group_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Remove_Group_BTN" to="." method="_on_Remove_Group_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Group_Selector_BTN" to="." method="_on_Group_Selector_BTN_pressed"]
|
||||||
|
[connection signal="text_entered" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit" to="." method="_on_Add_Group_LineEdit_text_entered"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_BTN" to="." method="_on_Add_Group_BTN_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Delete_Group_BTN" to="." method="_on_Delete_Group_BTN_pressed"]
|
||||||
|
[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/Search_OptionButton" to="." method="_on_Search_OptionButton_item_selected"]
|
||||||
|
[connection signal="text_changed" from="VBoxContainer/HBoxContainer2/Search_LineEdit" to="." method="_on_Search_LineEdit_text_changed"]
|
753
addons/EXP-System-Dialog/Story Editor/story_editor.gd
Normal file
753
addons/EXP-System-Dialog/Story Editor/story_editor.gd
Normal file
|
@ -0,0 +1,753 @@
|
||||||
|
tool
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
signal changed_story
|
||||||
|
signal close_pressed
|
||||||
|
signal dialog_edit_pressed(story, did)
|
||||||
|
|
||||||
|
onready var _Dialog_Record_Root = self.get_node("VBoxContainer/HBoxContainer3/Panel/VScrollBar/Dialog_Record_Root")
|
||||||
|
onready var _Dir = Directory.new()
|
||||||
|
onready var _Filename_LBL = self.get_node("VBoxContainer/HBoxContainer2/Filename_LBL")
|
||||||
|
onready var _Filter_Menu = self.get_node("VBoxContainer/HBoxContainer2/Filter_MenuButton")
|
||||||
|
onready var _Group_List = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/Group_ItemList")
|
||||||
|
onready var _Group_Manager_Panel = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager")
|
||||||
|
onready var _Group_Selector = self.get_node("VBoxContainer/HBoxContainer/Group_Selector_BTN")
|
||||||
|
onready var _New_Group_LineEdit = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit")
|
||||||
|
onready var _Search_LineEdit = self.get_node("VBoxContainer/HBoxContainer2/Search_LineEdit")
|
||||||
|
onready var _Search_Option_BTN = self.get_node("VBoxContainer/HBoxContainer2/Search_OptionButton")
|
||||||
|
onready var _Story_Menu = self.get_node("VBoxContainer/HBoxContainer/Story")
|
||||||
|
|
||||||
|
var _Dialog_Record = preload("res://addons/EXP-System-Dialog/Story Editor/Dialog Record/Dialog_Record.tscn")
|
||||||
|
var _EXP_Baked_Story = preload("res://addons/EXP-System-Dialog/Resource_BakedStory/EXP_BakedStory.gd")
|
||||||
|
var _EXP_Story = preload("res://addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd")
|
||||||
|
var _Record_Rename_Box_TSCN = preload("res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/Rename_Record_Box.tscn")
|
||||||
|
|
||||||
|
var _available_dids : Array
|
||||||
|
var _Bake_Story_As : EditorFileDialog
|
||||||
|
var _checked_dialogs : Array = []
|
||||||
|
var _groups : Array
|
||||||
|
var _Load_CSV : EditorFileDialog
|
||||||
|
var _Load_Story : EditorFileDialog
|
||||||
|
var _record_names : Dictionary
|
||||||
|
var _Record_Rename_Box
|
||||||
|
var _Save_CSV_As : EditorFileDialog
|
||||||
|
var _Save_Story_As : EditorFileDialog
|
||||||
|
var _story : Dictionary
|
||||||
|
|
||||||
|
#Virtual Methods
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self._create_rename_box()
|
||||||
|
self._populate_story_menu()
|
||||||
|
self._setup_dialogs()
|
||||||
|
self._Filter_Menu.get_popup().connect("index_pressed", self, "_on_Filter_Menu_index_pressed")
|
||||||
|
self._Filter_Menu.get_popup().hide_on_checkable_item_selection = false
|
||||||
|
self._populate_filter_menu()
|
||||||
|
self._populate_searchby_menu()
|
||||||
|
|
||||||
|
#Callback Methods
|
||||||
|
|
||||||
|
func _on_Add_Group_BTN_pressed():
|
||||||
|
self._add_group()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Add_Group_LineEdit_text_entered(new_text):
|
||||||
|
self._add_group()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Apply_Group_BTN_pressed():
|
||||||
|
var id = self._Group_Selector.get_selected_id()
|
||||||
|
if id == -1:
|
||||||
|
return
|
||||||
|
|
||||||
|
var idx = self._Group_Selector.get_item_index(id)
|
||||||
|
var group = self._Group_Selector.get_popup().get_item_text(idx)
|
||||||
|
for record in self._checked_dialogs.duplicate():
|
||||||
|
var did = record.get_did()
|
||||||
|
self._dialog_apply_group(did, group)
|
||||||
|
record.uncheck()
|
||||||
|
self.emit_signal("changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Bake_Story_As_file_selected(filename : String):
|
||||||
|
self._bake_data_to(filename)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Bake_Story_BTN_pressed():
|
||||||
|
self._Bake_Story_As.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Check_All_BTN_pressed():
|
||||||
|
var records = self._Dialog_Record_Root.get_children()
|
||||||
|
for record in records:
|
||||||
|
if record.visible:
|
||||||
|
record.check()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Close_BTN_pressed():
|
||||||
|
self.emit_signal("close_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Create_Dialog_BTN_pressed():
|
||||||
|
self._create_dialog_record()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Delete_Dialog_BTN_pressed():
|
||||||
|
self._delete_checked_dialogs()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Delete_Group_BTN_pressed():
|
||||||
|
var idxs = self._Group_List.get_selected_items()
|
||||||
|
var group
|
||||||
|
for idx in idxs:
|
||||||
|
group = self._Group_List.get_item_text(idx)
|
||||||
|
self._Group_List.remove_item(idx)
|
||||||
|
self._delete_group(group)
|
||||||
|
self._populate_group_selector()
|
||||||
|
self._populate_filter_menu()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_changed_human_readable_text(did : int, new_text : String):
|
||||||
|
self.set_dialog_property(did, "human_readable_description", new_text)
|
||||||
|
self.emit_signal("changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_checked(dialog):
|
||||||
|
self._checked_dialogs.push_front(dialog)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_edit_pressed(did : int):
|
||||||
|
self.emit_signal("dialog_edit_pressed", self, did)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_unchecked(dialog):
|
||||||
|
self._checked_dialogs.erase(dialog)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Filter_Menu_index_pressed(idx):
|
||||||
|
var checked = self._Filter_Menu.get_popup().is_item_checked(idx)
|
||||||
|
if not checked:
|
||||||
|
self._Filter_Menu.get_popup().set_item_checked(idx, true)
|
||||||
|
else:
|
||||||
|
self._Filter_Menu.get_popup().set_item_checked(idx, false)
|
||||||
|
self._update_filter()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Group_Manager_BTN_toggled(button_pressed : bool):
|
||||||
|
if button_pressed:
|
||||||
|
self._Group_Manager_Panel.visible = true
|
||||||
|
else:
|
||||||
|
self._Group_Manager_Panel.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Group_Selector_BTN_pressed():
|
||||||
|
self._populate_group_selector()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_CSV_BTN_pressed():
|
||||||
|
self._Load_CSV.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_CSV_file_selected(filepath : String):
|
||||||
|
var csv_file = File.new()
|
||||||
|
var status = csv_file.open(filepath, File.READ)
|
||||||
|
|
||||||
|
if not status == OK:
|
||||||
|
print_debug("EXP_Story_Editor: Error loading file \"" + filepath + "\".")
|
||||||
|
return
|
||||||
|
|
||||||
|
csv_file.get_csv_line()
|
||||||
|
|
||||||
|
while not csv_file.eof_reached():
|
||||||
|
var line = csv_file.get_csv_line()
|
||||||
|
|
||||||
|
if line.empty():
|
||||||
|
continue
|
||||||
|
|
||||||
|
var did = int(line[0])
|
||||||
|
var nid = int(line[1])
|
||||||
|
var dialog = String(line[2])
|
||||||
|
|
||||||
|
if not self._story.has(did):
|
||||||
|
continue
|
||||||
|
if not self._story[did]["nodes"].has(nid):
|
||||||
|
continue
|
||||||
|
|
||||||
|
self._story[did]["nodes"][nid]["text"] = dialog
|
||||||
|
|
||||||
|
csv_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_Story_BTN_pressed():
|
||||||
|
self._Load_Story.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Load_Story_file_selected(filename : String):
|
||||||
|
var file_data = load(filename)
|
||||||
|
if not file_data.TYPE == "EXP_Story_editor":
|
||||||
|
return
|
||||||
|
|
||||||
|
self._clear_story()
|
||||||
|
self._load_data_from(file_data)
|
||||||
|
self._Filename_LBL.text = filename.get_file()
|
||||||
|
|
||||||
|
for group in self._groups:
|
||||||
|
self._Group_List.add_item(group)
|
||||||
|
self._populate_filter_menu()
|
||||||
|
|
||||||
|
for did in self.get_dids():
|
||||||
|
var new_dialog_record = _Dialog_Record.instance()
|
||||||
|
self._Dialog_Record_Root.add_child(new_dialog_record)
|
||||||
|
new_dialog_record.set_story_editor(self)
|
||||||
|
new_dialog_record.connect("checked", self, "_on_Dialog_checked")
|
||||||
|
new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
|
||||||
|
new_dialog_record.connect("changed_human_readable_text", self,
|
||||||
|
"_on_Dialog_changed_human_readable_text")
|
||||||
|
new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
|
||||||
|
new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
|
||||||
|
|
||||||
|
new_dialog_record.set_did(did)
|
||||||
|
var human_readable_description = self.get_dialog_property(did, "human_readable_description")
|
||||||
|
new_dialog_record.update_human_readable_description(human_readable_description)
|
||||||
|
|
||||||
|
if self._story[did].has("name"):
|
||||||
|
var record_name = self._story[did]["name"]
|
||||||
|
new_dialog_record.set_record_name(record_name)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_New_Story_BTN_pressed():
|
||||||
|
self._clear_story()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Record_Rename_pressed(record):
|
||||||
|
self._Record_Rename_Box.set_target_record(record)
|
||||||
|
self._Record_Rename_Box.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Remove_Group_BTN_pressed():
|
||||||
|
var id = self._Group_Selector.get_selected_id()
|
||||||
|
if id == -1:
|
||||||
|
return
|
||||||
|
|
||||||
|
var idx = self._Group_Selector.get_item_index(id)
|
||||||
|
var group = self._Group_Selector.get_popup().get_item_text(idx)
|
||||||
|
for record in self._checked_dialogs.duplicate():
|
||||||
|
var did = record.get_did()
|
||||||
|
self._dialog_remove_group(did, group)
|
||||||
|
record.uncheck()
|
||||||
|
self.emit_signal("changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Rename_Box_Rename(rename : String):
|
||||||
|
var record = self._Record_Rename_Box.get_target_record()
|
||||||
|
var old_name = record.get_record_name()
|
||||||
|
var record_did = record.get_did()
|
||||||
|
|
||||||
|
if rename.empty() or rename == "NAME":
|
||||||
|
record.set_record_name("NAME")
|
||||||
|
self._story[record_did].erase("name")
|
||||||
|
self._record_names.erase(old_name)
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._record_names.has(rename):
|
||||||
|
return
|
||||||
|
|
||||||
|
self._record_names.erase(old_name)
|
||||||
|
|
||||||
|
self._record_names[rename] = record_did
|
||||||
|
self._story[record_did]["name"] = rename
|
||||||
|
record.set_record_name(rename)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_CSV_BTN_pressed():
|
||||||
|
self._Save_CSV_As.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_CVS_As_file_selected(filepath : String):
|
||||||
|
var csv_file = File.new()
|
||||||
|
var status = csv_file.open(filepath, File.WRITE)
|
||||||
|
|
||||||
|
if not status == OK:
|
||||||
|
print_debug("EXP_Story_Editor: Error saving csv file \"" + filepath + "\".")
|
||||||
|
return
|
||||||
|
|
||||||
|
csv_file.store_csv_line(["DID", "NID", "Dialog"], ",")
|
||||||
|
|
||||||
|
for did in self._story.keys():
|
||||||
|
for nid in self._story[did]["nodes"].keys():
|
||||||
|
var dialog = self._story[did]["nodes"][nid]["text"]
|
||||||
|
csv_file.store_csv_line([did, nid, dialog], ",")
|
||||||
|
|
||||||
|
csv_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_Story_As_file_selected(filename : String):
|
||||||
|
self._save_data_to(filename)
|
||||||
|
self._Filename_LBL.text = filename.get_file()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Save_Story_BTN_pressed():
|
||||||
|
self._Save_Story_As.popup_centered_ratio(0.7)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Search_LineEdit_text_changed(new_text : String):
|
||||||
|
self._update_filter()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Search_OptionButton_item_selected(id):
|
||||||
|
self._update_filter()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_story_menu_option_pressed(id):
|
||||||
|
match id:
|
||||||
|
0:
|
||||||
|
self._on_New_Story_BTN_pressed()
|
||||||
|
1:
|
||||||
|
self._on_Load_Story_BTN_pressed()
|
||||||
|
2:
|
||||||
|
self._on_Save_Story_BTN_pressed()
|
||||||
|
3:
|
||||||
|
self._on_Bake_Story_BTN_pressed()
|
||||||
|
4:
|
||||||
|
self._on_Save_CSV_BTN_pressed()
|
||||||
|
5:
|
||||||
|
self._on_Load_CSV_BTN_pressed()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Uncheck_All_BTN_pressed():
|
||||||
|
var records = self._Dialog_Record_Root.get_children()
|
||||||
|
for record in records:
|
||||||
|
if record.visible:
|
||||||
|
record.uncheck()
|
||||||
|
|
||||||
|
#Public Methods
|
||||||
|
|
||||||
|
func create_node(did : int, type : String) -> int:
|
||||||
|
var new_nid = self._generate_nid(did)
|
||||||
|
var node_data = {"type": type, "text": "", "graph_offset": Vector2(40, 40),
|
||||||
|
"rect_size": Vector2(0,0) ,"links": {}, "slot_amount": 1}
|
||||||
|
self._story[did]["nodes"][new_nid] = node_data
|
||||||
|
return new_nid
|
||||||
|
|
||||||
|
func dialog_get_groups(did : int):
|
||||||
|
return self._story[did]["groups"]
|
||||||
|
|
||||||
|
|
||||||
|
func erase_all_links(did: int, nid : int):
|
||||||
|
self._story[did]["nodes"][nid]["links"].clear()
|
||||||
|
|
||||||
|
|
||||||
|
func erase_dialog(did : int):
|
||||||
|
self._story.erase(did)
|
||||||
|
self._make_did_available(did)
|
||||||
|
|
||||||
|
|
||||||
|
func erase_link(did : int, nid : int, slot : int):
|
||||||
|
self._story[did]["nodes"][nid]["links"].erase(slot)
|
||||||
|
|
||||||
|
|
||||||
|
func erase_node(did :int, nid :int):
|
||||||
|
self._story[did]["nodes"].erase(nid)
|
||||||
|
self._make_nid_available(did, nid)
|
||||||
|
|
||||||
|
|
||||||
|
func get_dialog_property(did : int, property: String):
|
||||||
|
return self._story[did][property]
|
||||||
|
|
||||||
|
|
||||||
|
func get_dids():
|
||||||
|
return self._story.keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_link_slots(did : int, nid : int):
|
||||||
|
return self._story[did]["nodes"][nid]["links"].keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_nid_link_from(did : int, nid: int, slot : int):
|
||||||
|
return self._story[did]["nodes"][nid]["links"][slot]
|
||||||
|
|
||||||
|
|
||||||
|
func get_nids(did : int):
|
||||||
|
return self._story[did]["nodes"].keys()
|
||||||
|
|
||||||
|
|
||||||
|
func get_node_property(did : int, nid : int, property: String):
|
||||||
|
return self._story[did]["nodes"][nid][property]
|
||||||
|
|
||||||
|
|
||||||
|
func set_dialog_property(did : int, property : String , data):
|
||||||
|
self._story[did][property] = data
|
||||||
|
|
||||||
|
|
||||||
|
func set_link(did : int, this_nid : int, slot : int, that_nid : int):
|
||||||
|
self._story[did]["nodes"][this_nid]["links"][slot] = that_nid
|
||||||
|
|
||||||
|
|
||||||
|
func set_node_property(did : int, nid : int, property : String , data):
|
||||||
|
self._story[did]["nodes"][nid][property] = data
|
||||||
|
|
||||||
|
|
||||||
|
func set_node_slot_count(did : int, nid : int, amount : int):
|
||||||
|
self._story[did]["nodes"][nid]["slot_amount"] = amount
|
||||||
|
|
||||||
|
#Private Methods
|
||||||
|
|
||||||
|
func _add_group():
|
||||||
|
var new_group_name = self._New_Group_LineEdit.text
|
||||||
|
if new_group_name == "" or self._groups.has(new_group_name):
|
||||||
|
return
|
||||||
|
|
||||||
|
self._groups.push_back(new_group_name)
|
||||||
|
self._New_Group_LineEdit.text = ""
|
||||||
|
self._Group_List.add_item(new_group_name)
|
||||||
|
self._populate_filter_menu()
|
||||||
|
|
||||||
|
var sort_list : Array
|
||||||
|
for idx in range(self._Group_List.get_item_count()):
|
||||||
|
var group = self._Group_List.get_item_text(idx)
|
||||||
|
sort_list.push_back(group)
|
||||||
|
sort_list.sort()
|
||||||
|
self._Group_List.clear()
|
||||||
|
for group in sort_list:
|
||||||
|
self._Group_List.add_item(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _bake_data() :
|
||||||
|
var baked_story = self._story.duplicate(true)
|
||||||
|
for did in baked_story.keys():
|
||||||
|
baked_story[did].erase("name")
|
||||||
|
baked_story[did].erase("groups")
|
||||||
|
baked_story[did].erase("available_nid")
|
||||||
|
baked_story[did].erase("human_readable_description")
|
||||||
|
for nid in baked_story[did]["nodes"].keys():
|
||||||
|
baked_story[did]["nodes"][nid].erase("type")
|
||||||
|
baked_story[did]["nodes"][nid].erase("graph_offset")
|
||||||
|
baked_story[did]["nodes"][nid].erase("rect_size")
|
||||||
|
baked_story[did]["nodes"][nid].erase("slot_amount")
|
||||||
|
return baked_story.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
|
func _bake_data_to(filename):
|
||||||
|
var file_data
|
||||||
|
if self._Dir.file_exists(filename):
|
||||||
|
file_data = load(filename)
|
||||||
|
if file_data.TYPE == "EXP_Baked_Story":
|
||||||
|
file_data.story = self._bake_data()
|
||||||
|
file_data.names = self._record_names.duplicate(true)
|
||||||
|
ResourceSaver.save(filename, file_data)
|
||||||
|
else:
|
||||||
|
file_data = _EXP_Baked_Story.new()
|
||||||
|
file_data.story = self._bake_data()
|
||||||
|
file_data.names = self._record_names.duplicate(true)
|
||||||
|
ResourceSaver.save(filename, file_data)
|
||||||
|
|
||||||
|
|
||||||
|
func _clear_group_manager():
|
||||||
|
self._groups.clear()
|
||||||
|
for idx in range(self._Group_List.get_item_count()):
|
||||||
|
self._Group_List.remove_item(0)
|
||||||
|
self._populate_group_selector()
|
||||||
|
self._Filter_Menu.get_popup().clear()
|
||||||
|
|
||||||
|
|
||||||
|
func _clear_story():
|
||||||
|
self._remove_all_records()
|
||||||
|
self._clear_group_manager()
|
||||||
|
self._populate_filter_menu()
|
||||||
|
self._story.clear()
|
||||||
|
self._available_dids.clear()
|
||||||
|
self._checked_dialogs.clear()
|
||||||
|
self._record_names.clear()
|
||||||
|
self._Filename_LBL.text = "Unsaved Story"
|
||||||
|
self.emit_signal("changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _create_dialog() -> int:
|
||||||
|
var new_did = self._generate_did()
|
||||||
|
var dialog_data = {"human_readable_description":
|
||||||
|
"New Dialog - Enter Human Readable Description",
|
||||||
|
"groups": [],
|
||||||
|
"available_nid": [],
|
||||||
|
"nodes": {}}
|
||||||
|
self._story[new_did] = dialog_data
|
||||||
|
return new_did
|
||||||
|
|
||||||
|
|
||||||
|
func _create_dialog_record():
|
||||||
|
var new_did = self._create_dialog()
|
||||||
|
|
||||||
|
var new_dialog_record = _Dialog_Record.instance()
|
||||||
|
self._Dialog_Record_Root.add_child(new_dialog_record)
|
||||||
|
new_dialog_record.set_story_editor(self)
|
||||||
|
|
||||||
|
new_dialog_record.connect("checked", self, "_on_Dialog_checked")
|
||||||
|
new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
|
||||||
|
new_dialog_record.connect("changed_human_readable_text", self,
|
||||||
|
"_on_Dialog_changed_human_readable_text")
|
||||||
|
new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
|
||||||
|
new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
|
||||||
|
|
||||||
|
new_dialog_record.set_did(new_did)
|
||||||
|
new_dialog_record.update_human_readable_description(
|
||||||
|
"New Dialog - Enter Human Readable Description.")
|
||||||
|
|
||||||
|
|
||||||
|
func _create_rename_box():
|
||||||
|
self._Record_Rename_Box = _Record_Rename_Box_TSCN.instance()
|
||||||
|
self._Record_Rename_Box.connect("rename_BTN_pressed", self, "_on_Rename_Box_Rename")
|
||||||
|
self.add_child(self._Record_Rename_Box)
|
||||||
|
|
||||||
|
|
||||||
|
func _delete_checked_dialogs():
|
||||||
|
for dialog in self._checked_dialogs:
|
||||||
|
self._delete_dialog(dialog)
|
||||||
|
self._checked_dialogs.clear()
|
||||||
|
self.emit_signal("changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _delete_dialog(dialog):
|
||||||
|
var did = dialog.get_did()
|
||||||
|
self.erase_dialog(did)
|
||||||
|
self._remove_record(dialog)
|
||||||
|
|
||||||
|
|
||||||
|
func _delete_group(group):
|
||||||
|
self._groups.erase(group)
|
||||||
|
self._remove_group_from_story(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _dialog_apply_group(did : int, group : String):
|
||||||
|
if not self._story[did]["groups"].has(group):
|
||||||
|
self._story[did]["groups"].push_back(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _dialog_remove_group(did : int, group : String):
|
||||||
|
if self._story[did]["groups"].has(group):
|
||||||
|
self._story[did]["groups"].erase(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _generate_did() -> int:
|
||||||
|
if not self._available_dids.empty():
|
||||||
|
return self._available_dids.pop_front()
|
||||||
|
else:
|
||||||
|
return self._story.size() + 1
|
||||||
|
|
||||||
|
|
||||||
|
func _generate_nid(did : int) -> int:
|
||||||
|
if not self._story[did]["available_nid"].empty():
|
||||||
|
return self._story[did]["available_nid"].pop_front()
|
||||||
|
else:
|
||||||
|
return self._story[did]["nodes"].size() + 1
|
||||||
|
|
||||||
|
|
||||||
|
func _load_data_from(new_story):
|
||||||
|
self._story = new_story.story.duplicate(true)
|
||||||
|
self._available_dids = new_story.available_dids.duplicate(true)
|
||||||
|
self._groups = new_story.groups.duplicate(true)
|
||||||
|
self._record_names = new_story.names.duplicate(true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _make_did_available(did : int):
|
||||||
|
self._available_dids.push_front(did)
|
||||||
|
self._available_dids.sort()
|
||||||
|
|
||||||
|
|
||||||
|
func _make_nid_available(did : int, nid : int):
|
||||||
|
self._story[did]["available_nid"].push_front(nid)
|
||||||
|
self._story[did]["available_nid"].sort()
|
||||||
|
|
||||||
|
|
||||||
|
func _make_records_visible():
|
||||||
|
var children = self._Dialog_Record_Root.get_children()
|
||||||
|
for child in children:
|
||||||
|
child.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _populate_filter_menu():
|
||||||
|
self._Filter_Menu.get_popup().clear()
|
||||||
|
self._Filter_Menu.get_popup().add_check_item("-No Tags-")
|
||||||
|
for group in self._groups:
|
||||||
|
self._Filter_Menu.get_popup().add_check_item(group)
|
||||||
|
for idx in range(self._Filter_Menu.get_popup().get_item_count()):
|
||||||
|
self._Filter_Menu.get_popup().set_item_checked(idx, true)
|
||||||
|
|
||||||
|
|
||||||
|
func _populate_group_selector():
|
||||||
|
self._Group_Selector.clear()
|
||||||
|
self._Group_Selector.text = "Tags"
|
||||||
|
for group in self._groups:
|
||||||
|
self._Group_Selector.get_popup().add_item(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _populate_searchby_menu():
|
||||||
|
self._Search_Option_BTN.clear()
|
||||||
|
self._Search_Option_BTN.get_popup().add_item("Human Readable LBL", 0)
|
||||||
|
self._Search_Option_BTN.get_popup().add_item("DID", 1)
|
||||||
|
self._Search_Option_BTN.get_popup().add_item("Record Name", 2)
|
||||||
|
self._Search_Option_BTN.select(0)
|
||||||
|
|
||||||
|
func _populate_story_menu():
|
||||||
|
self._Story_Menu.get_popup().clear()
|
||||||
|
self._Story_Menu.get_popup().add_item("New Story", 0)
|
||||||
|
self._Story_Menu.get_popup().add_item("Load Story", 1)
|
||||||
|
self._Story_Menu.get_popup().add_item("Save Story As", 2)
|
||||||
|
self._Story_Menu.get_popup().add_item("Bake Story As", 3)
|
||||||
|
self._Story_Menu.get_popup().add_item("Save CSV As", 4)
|
||||||
|
self._Story_Menu.get_popup().add_item("Load CSV", 5)
|
||||||
|
self._Story_Menu.get_popup().connect("id_pressed", self, "_on_story_menu_option_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _remove_all_records():
|
||||||
|
var dialog_records = self._Dialog_Record_Root.get_children()
|
||||||
|
for record in dialog_records:
|
||||||
|
self._remove_record(record)
|
||||||
|
|
||||||
|
|
||||||
|
func _remove_group_from_story(group : String):
|
||||||
|
for did in self._story:
|
||||||
|
if self._story[did]["groups"].has(group):
|
||||||
|
self._story[did]["groups"].erase(group)
|
||||||
|
|
||||||
|
|
||||||
|
func _remove_record(dialog_record):
|
||||||
|
dialog_record.disconnect("checked", self, "_on_Dialog_checked")
|
||||||
|
dialog_record.disconnect("unchecked", self, "_on_Dialog_unchecked")
|
||||||
|
dialog_record.disconnect("changed_human_readable_text", self,
|
||||||
|
"_on_Dialog_changed_human_readable_text")
|
||||||
|
dialog_record.disconnect("rename_pressed", self, "_on_Record_Rename_pressed")
|
||||||
|
var record_name = dialog_record.get_record_name()
|
||||||
|
if not record_name == "NAME":
|
||||||
|
self._record_names.erase(record_name)
|
||||||
|
|
||||||
|
dialog_record.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _save_data_to(filename):
|
||||||
|
var file_data
|
||||||
|
if self._Dir.file_exists(filename):
|
||||||
|
file_data = load(filename)
|
||||||
|
if file_data.TYPE == "EXP_Story_editor":
|
||||||
|
file_data.names = self._record_names.duplicate(true)
|
||||||
|
file_data.story = self._story.duplicate(true)
|
||||||
|
file_data.available_dids = self._available_dids.duplicate(true)
|
||||||
|
file_data.groups = self._groups.duplicate(true)
|
||||||
|
ResourceSaver.save(filename, file_data)
|
||||||
|
else:
|
||||||
|
file_data = _EXP_Story.new()
|
||||||
|
file_data.names = self._record_names.duplicate(true)
|
||||||
|
file_data.story = self._story.duplicate(true)
|
||||||
|
file_data.available_dids = self._available_dids.duplicate(true)
|
||||||
|
file_data.groups = self._groups.duplicate(true)
|
||||||
|
ResourceSaver.save(filename, file_data)
|
||||||
|
|
||||||
|
|
||||||
|
func _setup_dialogs():
|
||||||
|
self._Load_Story = EditorFileDialog.new()
|
||||||
|
self._Load_Story.mode = EditorFileDialog.MODE_OPEN_FILE
|
||||||
|
self._Load_Story.add_filter("*.tres ; Story files")
|
||||||
|
self._Load_Story.resizable = true
|
||||||
|
self._Load_Story.access = EditorFileDialog.ACCESS_RESOURCES
|
||||||
|
self._Load_Story.current_dir = "res://"
|
||||||
|
self._Load_Story.connect("file_selected", self, "_on_Load_Story_file_selected")
|
||||||
|
self.add_child(self._Load_Story)
|
||||||
|
|
||||||
|
self._Save_Story_As = EditorFileDialog.new()
|
||||||
|
self._Save_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
|
||||||
|
self._Save_Story_As.add_filter("*.tres ; Story files")
|
||||||
|
self._Save_Story_As.resizable = true
|
||||||
|
self._Save_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
|
||||||
|
self._Save_Story_As.current_dir = "res://"
|
||||||
|
self._Save_Story_As.connect("file_selected", self, "_on_Save_Story_As_file_selected")
|
||||||
|
self.add_child(self._Save_Story_As)
|
||||||
|
|
||||||
|
self._Bake_Story_As = EditorFileDialog.new()
|
||||||
|
self._Bake_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
|
||||||
|
self._Bake_Story_As.add_filter("*.tres ; Baked Story files")
|
||||||
|
self._Bake_Story_As.resizable = true
|
||||||
|
self._Bake_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
|
||||||
|
self._Bake_Story_As.current_dir = "res://"
|
||||||
|
self._Bake_Story_As.connect("file_selected", self, "_on_Bake_Story_As_file_selected")
|
||||||
|
self.add_child(self._Bake_Story_As)
|
||||||
|
|
||||||
|
self._Save_CSV_As = EditorFileDialog.new()
|
||||||
|
self._Save_CSV_As.mode = EditorFileDialog.MODE_SAVE_FILE
|
||||||
|
self._Save_CSV_As.add_filter("*.csv ; CSV files")
|
||||||
|
self._Save_CSV_As.resizable = true
|
||||||
|
self._Save_CSV_As.access = EditorFileDialog.ACCESS_FILESYSTEM
|
||||||
|
self._Save_CSV_As.current_dir = "res://"
|
||||||
|
self._Save_CSV_As.connect("file_selected", self, "_on_Save_CVS_As_file_selected")
|
||||||
|
self.add_child(self._Save_CSV_As)
|
||||||
|
|
||||||
|
self._Load_CSV = EditorFileDialog.new()
|
||||||
|
self._Load_CSV .mode = EditorFileDialog.MODE_OPEN_FILE
|
||||||
|
self._Load_CSV .add_filter("*.csv ; CSV files")
|
||||||
|
self._Load_CSV .resizable = true
|
||||||
|
self._Load_CSV .access = EditorFileDialog.ACCESS_FILESYSTEM
|
||||||
|
self._Load_CSV .current_dir = "res://"
|
||||||
|
self._Load_CSV .connect("file_selected", self, "_on_Load_CSV_file_selected")
|
||||||
|
self.add_child(self._Load_CSV)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_filter():
|
||||||
|
var new_text = self._Search_LineEdit.text
|
||||||
|
self._make_records_visible()
|
||||||
|
|
||||||
|
var filter_groups : Array
|
||||||
|
for idx in range(self._Filter_Menu.get_popup().get_item_count()):
|
||||||
|
if self._Filter_Menu.get_popup().is_item_checked(idx):
|
||||||
|
var group = self._Filter_Menu.get_popup().get_item_text(idx)
|
||||||
|
filter_groups.push_back(group)
|
||||||
|
|
||||||
|
var children = self._Dialog_Record_Root.get_children()
|
||||||
|
|
||||||
|
var search_option = self._Search_Option_BTN.selected
|
||||||
|
|
||||||
|
match search_option:
|
||||||
|
0: #Human Readable Search
|
||||||
|
for child in children:
|
||||||
|
var did = child.get_did()
|
||||||
|
var human_readable_description = self.get_dialog_property(did, "human_readable_description")
|
||||||
|
if human_readable_description.find(new_text) == -1 and not new_text.empty():
|
||||||
|
child.visible = false
|
||||||
|
else:
|
||||||
|
child.visible = false
|
||||||
|
if self._Filter_Menu.get_popup().get_item_count() == 0:
|
||||||
|
child.visible = true
|
||||||
|
var dialog_groups = self.dialog_get_groups(did)
|
||||||
|
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
|
||||||
|
child.visible = true
|
||||||
|
for group in dialog_groups:
|
||||||
|
if filter_groups.has(group):
|
||||||
|
child.visible = true
|
||||||
|
1: #DID Search
|
||||||
|
for child in children:
|
||||||
|
var did = child.get_did()
|
||||||
|
if not new_text == str(did) and not new_text.empty():
|
||||||
|
child.visible = false
|
||||||
|
else:
|
||||||
|
child.visible = false
|
||||||
|
if self._Filter_Menu.get_popup().get_item_count() == 0:
|
||||||
|
child.visible = true
|
||||||
|
var dialog_groups = self.dialog_get_groups(did)
|
||||||
|
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
|
||||||
|
child.visible = true
|
||||||
|
for group in dialog_groups:
|
||||||
|
if filter_groups.has(group):
|
||||||
|
child.visible = true
|
||||||
|
2: #Record Name Search
|
||||||
|
for child in children:
|
||||||
|
var did = child.get_did()
|
||||||
|
var record_name = child.get_record_name()
|
||||||
|
if record_name.find(new_text) == -1 and not new_text.empty():
|
||||||
|
child.visible = false
|
||||||
|
else:
|
||||||
|
child.visible = false
|
||||||
|
if self._Filter_Menu.get_popup().get_item_count() == 0:
|
||||||
|
child.visible = true
|
||||||
|
var dialog_groups = self.dialog_get_groups(did)
|
||||||
|
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
|
||||||
|
child.visible = true
|
||||||
|
for group in dialog_groups:
|
||||||
|
if filter_groups.has(group):
|
||||||
|
child.visible = true
|
7
addons/EXP-System-Dialog/plugin.cfg
Normal file
7
addons/EXP-System-Dialog/plugin.cfg
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[plugin]
|
||||||
|
|
||||||
|
name="EXP_Dialog"
|
||||||
|
description="EXPWorld's dialog technology."
|
||||||
|
author="David Lipps @ EXPWorlds"
|
||||||
|
version="1.1.0"
|
||||||
|
script="plugin.gd"
|
87
addons/EXP-System-Dialog/plugin.gd
Normal file
87
addons/EXP-System-Dialog/plugin.gd
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
tool
|
||||||
|
extends EditorPlugin
|
||||||
|
|
||||||
|
var _Story_Editor = preload("res://addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn")
|
||||||
|
var _Story_Editor_Instance
|
||||||
|
var _Story_Editor_BTN : ToolButton
|
||||||
|
var _Dialog_Editor = preload("res://addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn")
|
||||||
|
var _Dialog_Editor_Instance
|
||||||
|
var _Dialog_Editor_BTN : ToolButton
|
||||||
|
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
|
||||||
|
self._Story_Editor_Instance = self._Story_Editor.instance()
|
||||||
|
self._Story_Editor_Instance.connect("close_pressed", self, "_on_StoryFile_Editor_close_pressed")
|
||||||
|
self._Story_Editor_BTN = self.add_control_to_bottom_panel(self._Story_Editor_Instance, "EXP StoryFile Editor")
|
||||||
|
self._Story_Editor_Instance.visible = false
|
||||||
|
self._Story_Editor_BTN.visible = false
|
||||||
|
self.add_tool_menu_item("EXP StoryFile Editor", self, "_on_StoryFile_Editor_opened")
|
||||||
|
|
||||||
|
self._Dialog_Editor_Instance = self._Dialog_Editor.instance()
|
||||||
|
self._Dialog_Editor_BTN = self.add_control_to_bottom_panel(self._Dialog_Editor_Instance, "EXP Dialog Editor")
|
||||||
|
self._Dialog_Editor_BTN.visible = false
|
||||||
|
|
||||||
|
self._Story_Editor_Instance.connect("dialog_edit_pressed",
|
||||||
|
self, "_on_Story_Editor_dialog_edit_pressed")
|
||||||
|
self._Story_Editor_Instance.connect("dialog_edit_pressed",
|
||||||
|
self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
|
||||||
|
self._Dialog_Editor_Instance.connect("close_BTN_pressed", self,
|
||||||
|
"_on_Dialog_Editor_close_BTN_pressed")
|
||||||
|
self._Dialog_Editor_Instance.connect("back_BTN_pressed", self,
|
||||||
|
"_on_Dialog_Editor_back_BTN_pressed")
|
||||||
|
self._Story_Editor_Instance.connect("changed_story", self,
|
||||||
|
"_on_Story_Editor_changed_story")
|
||||||
|
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
|
||||||
|
self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
|
||||||
|
self, "_on_Story_Editor_dialog_edit_pressed")
|
||||||
|
self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
|
||||||
|
self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
|
||||||
|
self._Dialog_Editor_Instance.disconnect("close_BTN_pressed", self,
|
||||||
|
"_on_Dialog_Editor_close_BTN_pressed")
|
||||||
|
self._Dialog_Editor_Instance.disconnect("back_BTN_pressed", self,
|
||||||
|
"_on_Dialog_Editor_back_BTN_pressed")
|
||||||
|
self._Story_Editor_Instance.disconnect("changed_story", self,
|
||||||
|
"_on_Story_Editor_changed_story")
|
||||||
|
|
||||||
|
self.remove_control_from_bottom_panel(self._Story_Editor_Instance)
|
||||||
|
self._Story_Editor_Instance.queue_free()
|
||||||
|
self.remove_control_from_bottom_panel(self._Dialog_Editor_Instance)
|
||||||
|
self._Dialog_Editor_Instance.queue_free()
|
||||||
|
self.remove_tool_menu_item("EXP StoryFile Editor")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Story_Editor_dialog_edit_pressed(story, did):
|
||||||
|
self._Dialog_Editor_BTN.visible = true
|
||||||
|
self._Story_Editor_BTN.pressed = false
|
||||||
|
self._Dialog_Editor_BTN.pressed = true
|
||||||
|
self._Dialog_Editor_BTN.emit_signal("pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_Editor_close_BTN_pressed():
|
||||||
|
self._Dialog_Editor_BTN.pressed = false
|
||||||
|
self._Dialog_Editor_BTN.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Story_Editor_changed_story():
|
||||||
|
self._Dialog_Editor_BTN.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Dialog_Editor_back_BTN_pressed():
|
||||||
|
self._Story_Editor_BTN.pressed = true
|
||||||
|
self._Dialog_Editor_BTN.pressed = false
|
||||||
|
self._Story_Editor_BTN.emit_signal("pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_StoryFile_Editor_opened(trash_parameter):
|
||||||
|
self._Story_Editor_BTN.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_StoryFile_Editor_close_pressed():
|
||||||
|
self._Story_Editor_Instance.visible = false
|
||||||
|
self._Story_Editor_BTN.visible = false
|
||||||
|
self._Dialog_Editor_Instance.visible = false
|
||||||
|
self._Dialog_Editor_BTN.visible = false
|
Loading…
Reference in a new issue