Add basic commponents to node editor plugin
This commit is contained in:
parent
166a7e15f9
commit
b7cd887c5e
2 changed files with 209 additions and 40 deletions
|
@ -3,10 +3,9 @@
|
|||
[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
|
||||
margin_bottom = 181.0
|
||||
rect_min_size = Vector2( 324, 137 )
|
||||
title = "Line"
|
||||
offset = Vector2( 40, 40 )
|
||||
|
@ -29,72 +28,195 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 39.0
|
||||
margin_right = 380.0
|
||||
margin_bottom = 131.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 285.0
|
||||
custom_constants/margin_right = 10
|
||||
custom_constants/margin_top = 10
|
||||
custom_constants/margin_left = 10
|
||||
custom_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = 282.0
|
||||
margin_bottom = 236.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="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer2"]
|
||||
margin_right = 328.0
|
||||
margin_bottom = 64.0
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Speaker"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="TextEdit2" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 94.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 0, 20 )
|
||||
size_flags_horizontal = 3
|
||||
text = "emotion"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 50.0
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 54.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 96.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Scene"
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer"]
|
||||
margin_left = 91.0
|
||||
margin_right = 181.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 100.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 104.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 108.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 190.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 82.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Dialog"
|
||||
|
||||
[node name="MessageTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 82.0
|
||||
rect_min_size = Vector2( 256, 64 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Message"
|
||||
smooth_scrolling = true
|
||||
|
||||
[node name="Editor_BTN" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 332.0
|
||||
margin_right = 364.0
|
||||
margin_bottom = 64.0
|
||||
[node name="Editor_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
visible = false
|
||||
margin_left = 260.0
|
||||
margin_right = 292.0
|
||||
margin_bottom = 82.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
|
||||
[node name="HSeparator3" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 194.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 198.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 202.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 226.0
|
||||
alignment = 1
|
||||
|
||||
[node name="Save_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="Save_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
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
|
||||
[node name="Load_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_left = 64.0
|
||||
margin_right = 170.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
|
||||
[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_left = 119.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Link_LBL" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 247.0
|
||||
[node name="Link_LBL" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 77.0
|
||||
margin_top = 5.0
|
||||
margin_right = 286.0
|
||||
margin_right = 116.0
|
||||
margin_bottom = 19.0
|
||||
text = "Slots: "
|
||||
|
||||
[node name="Link_SpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 290.0
|
||||
margin_right = 364.0
|
||||
[node name="Link_SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 120.0
|
||||
margin_right = 194.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Change the number of output slots on this node."
|
||||
min_value = 1.0
|
||||
|
@ -104,8 +226,8 @@ 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"]
|
||||
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit" to="." method="_on_TextEdit_text_changed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Editor_BTN" to="." method="_on_Editor_BTN_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Save_BTN" to="." method="_on_Save_BTN_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Load_BTN" to="." method="_on_Load_BTN_pressed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer/Link_SpinBox" to="." method="_on_Link_SpinBox_value_changed"]
|
||||
|
|
|
@ -10,12 +10,54 @@ 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")
|
||||
onready var _Link_SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer/Link_SpinBox")
|
||||
onready var _Text_Editor = self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/TextEdit")
|
||||
|
||||
var _nid : int = 0
|
||||
var _slot_amount : int = 1
|
||||
|
||||
|
||||
var json_structure = {
|
||||
"speaker": {
|
||||
"id": 0,
|
||||
"emotion": "happy"
|
||||
},
|
||||
"scene": {
|
||||
"id": 0
|
||||
},
|
||||
"dialog": {
|
||||
"message": "",
|
||||
"choices_free": {
|
||||
"placeholder": "",
|
||||
"global_var_name": "",
|
||||
},
|
||||
"choices_multiple": [
|
||||
{
|
||||
"title": "",
|
||||
"arc": 0,
|
||||
"infobox": {
|
||||
"title": "",
|
||||
"text": "",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "education",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "open_mindeness",
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Virtual Methods
|
||||
|
||||
func _ready():
|
||||
|
@ -55,7 +97,8 @@ func _on_Save_BTN_pressed():
|
|||
|
||||
|
||||
func _on_TextEdit_text_changed():
|
||||
self.emit_signal("text_changed", self._nid, self._Text_Editor.text)
|
||||
json_structure.dialog.message = self._Text_Editor.text
|
||||
emit_text()
|
||||
|
||||
#Public Methods
|
||||
|
||||
|
@ -88,6 +131,10 @@ func set_text(new_text : String):
|
|||
|
||||
#Private Methods
|
||||
|
||||
func emit_text():
|
||||
self.emit_signal("text_changed", self._nid, JSON.print(json_structure))
|
||||
|
||||
|
||||
func _clear_link_labels():
|
||||
var children = self.get_children()
|
||||
for child in children:
|
||||
|
|
Loading…
Reference in a new issue