Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #41 from Levrault/fix/signal-node-parent
Browse files Browse the repository at this point in the history
Fix/signal node parent
  • Loading branch information
Levrault authored Aug 20, 2021
2 parents ecdbe3a + 9397317 commit fc99582
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 23 deletions.
1 change: 1 addition & 0 deletions assets/examples/complete_conditional_example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"f52b144c-6ba9-4d3b-8255-a92e343123c5":{"name":"Actor1","portrait":"res://assets/examples/godot.png","text":{"en":"The empty condition should be the default\npath of your dialogue system","fr":""},"parent":"b5c55fcc-5eb6-4088-ba49-a9b6b7b7a187"},"f240e052-cea1-4e61-aa80-c927f5015fff":{"name":"Actor1","portrait":"res://assets/examples/godot.png","text":{"en":"Hey, I know you!","fr":""},"parent":"5fdfd233-bb75-4a80-890e-383dd9ab478c","signals":{"parent":"f240e052-cea1-4e61-aa80-c927f5015fff","string":{"String":"valueOfString"},"number":{"Number":"12"},"wmpr":{}," empty":{},"empty":{}}},"root":{"conditions":[{"parent":"root","next":"f52b144c-6ba9-4d3b-8255-a92e343123c5"},{"has_meet":{"value":true,"operator":"equal","type":"boolean"},"parent":"root","next":"f240e052-cea1-4e61-aa80-c927f5015fff"}]},"__editor":{"root":{"uuid":"root","offset":[40,80]},"dialogues":[{"uuid":"f52b144c-6ba9-4d3b-8255-a92e343123c5","offset":[680,300]},{"uuid":"f240e052-cea1-4e61-aa80-c927f5015fff","offset":[700,-160]}],"conditions":[{"uuid":"b5c55fcc-5eb6-4088-ba49-a9b6b7b7a187","offset":[280,180],"folded":true,"parent":"root"},{"uuid":"5fdfd233-bb75-4a80-890e-383dd9ab478c","offset":[280,0],"collapsed":true,"parent":"root"}],"signals":[{"uuid":"213bfe5f-8005-4d23-b33e-1cf528c44dd8","offset":[1140,-200],"parent":"f240e052-cea1-4e61-aa80-c927f5015fff"}],"choices":[]}}
58 changes: 58 additions & 0 deletions assets/examples/complete_example.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[path]

resource="/Users/lflangis/Devs/LE-dialogue-editor"
OSX="/Users/lflangis/Devs/LE-dialogue-editor"
Windows=""
UWP=""
X11=""

[configuration]

has_portrait=true
has_name=true
dialogue_character_limit=250
choice_character_limit=100

[locale]

current="en"
selected=[ "en", "fr" ]
custom=[ ]

[variables]

characters=[ {
"name": "Actor1",
"portraits": [ {
"default": true,
"name": "Idle",
"path": "res://assets/examples/godot.png",
"uuid": "4a8db634-fc49-4a03-84dd-25f2380c99fd"
} ]
}, {
"name": "Actor2",
"portraits": [ {
"default": true,
"name": "Idle",
"path": "res://assets/examples/levrault.png",
"uuid": "854aa4f7-85f3-4bf3-ab6e-98d7f63b125b"
} ]
} ]
files=[ {
"name": "complete_example_demo",
"path": "res://assets/examples/complete_example_demo"
}, {
"name": "complete_conditional_example",
"path": "res://assets/examples/complete_conditional_example"
} ]

[cache]

last_opened_file={
"name": "complete_conditional_example",
"path": "res://assets/examples/complete_conditional_example"
}

[info]

version="v1.1.0"
1 change: 1 addition & 0 deletions assets/examples/complete_example_demo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"a89874ed-2fa8-4818-a49c-044a3464eb0c":{"name":"Actor1","portrait":"res://assets/examples/godot.png","text":{"en":"Do you want to build a complexe dialogue\nsystem?","fr":""},"parent":"root","choices":[{"text":{"en":"YES","fr":""},"next":"4744ae77-d778-4eb1-8a84-068cc1687cd5","parent":"a89874ed-2fa8-4818-a49c-044a3464eb0c"},{"text":{"en":"No I just want some cute and short\ndialogue with a little bit of complexity","fr":""},"next":"d0d5e299-28a6-4716-8712-4efa8d956e0d","parent":"a89874ed-2fa8-4818-a49c-044a3464eb0c"}]},"4744ae77-d778-4eb1-8a84-068cc1687cd5":{"name":"Actor1","portrait":"res://assets/examples/godot.png","text":{"en":"Well, Le dialogue editor is maybe not\nthe best choice","fr":""},"parent":"0d1f39a7-d021-4b65-bf25-b91eb2f9e78c","signals":{"hello":{},"parent":"4744ae77-d778-4eb1-8a84-068cc1687cd5"}},"d0d5e299-28a6-4716-8712-4efa8d956e0d":{"name":"Actor1","portrait":"res://assets/examples/godot.png","text":{"en":"Cool, Le dialogue editor could be a solution\nfor your needs!","fr":""},"parent":"5c01c8b1-b018-4dd7-9b1d-d51aba7b2fee"},"root":{"next":"a89874ed-2fa8-4818-a49c-044a3464eb0c"},"__editor":{"root":{"uuid":"root","offset":[40,100]},"dialogues":[{"uuid":"a89874ed-2fa8-4818-a49c-044a3464eb0c","offset":[240,0],"parent":"root"},{"uuid":"4744ae77-d778-4eb1-8a84-068cc1687cd5","offset":[1100,-240]},{"uuid":"d0d5e299-28a6-4716-8712-4efa8d956e0d","offset":[1080,260]}],"conditions":[],"signals":[{"uuid":"06932b6c-7daf-44b7-ac45-dc1c66ee321e","offset":[1525,-285],"parent":"4744ae77-d778-4eb1-8a84-068cc1687cd5","data":{"hello":{},"parent":"4744ae77-d778-4eb1-8a84-068cc1687cd5"}}],"choices":[{"uuid":"0d1f39a7-d021-4b65-bf25-b91eb2f9e78c","offset":[680,-80],"parent":"a89874ed-2fa8-4818-a49c-044a3464eb0c"},{"uuid":"5c01c8b1-b018-4dd7-9b1d-d51aba7b2fee","offset":[680,200],"parent":"a89874ed-2fa8-4818-a49c-044a3464eb0c"}]}}
12 changes: 6 additions & 6 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,17 @@ add_signal={
}
new_scene={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":78,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":true,"command":true,"pressed":false,"scancode":78,"unicode":0,"echo":false,"script":null)
]
}
save_file={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":true,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
}
save_as={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":true,"meta":false,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":true,"meta":true,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
}
export_file={
Expand All @@ -187,17 +187,17 @@ export_file={
}
open_file={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":79,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":true,"command":true,"pressed":false,"scancode":79,"unicode":0,"echo":false,"script":null)
]
}
preview={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":true,"command":true,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
]
}
workspace_explorer_drawer={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":66,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":true,"command":true,"pressed":false,"scancode":66,"unicode":0,"echo":false,"script":null)
]
}
left_click={
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Fields/SignalItem.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ onready var type := $Type


func _exit_tree() -> void:
emit_signal("field_deleted", value.text, self.rect_size)
emit_signal("field_deleted", signal_name.text, self.rect_size)


func delete() -> void:
Expand Down
19 changes: 8 additions & 11 deletions src/Nodes/Fields/SignalItem.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[ext_resource path="res://src/Nodes/Fields/SignalItem.gd" type="Script" id=2]
[ext_resource path="res://src/Nodes/Fields/DeleteButton.gd" type="Script" id=3]




[node name="Signal" type="HBoxContainer"]
margin_right = 201.0
margin_bottom = 32.0
Expand All @@ -28,33 +25,33 @@ uppercase = true
[node name="Name" type="Label" parent="."]
margin_left = 35.0
margin_top = 9.0
margin_right = 95.0
margin_right = 110.0
margin_bottom = 23.0
size_flags_horizontal = 3
text = "plaholder"
text = "placeholder"
align = 1

[node name="Type" type="Label" parent="."]
margin_left = 99.0
margin_left = 114.0
margin_top = 9.0
margin_right = 128.0
margin_right = 143.0
margin_bottom = 23.0
custom_colors/font_color = Color( 0.458824, 0.458824, 0.458824, 1 )
text = "Type"
uppercase = true

[node name="Value" type="Label" parent="."]
margin_left = 132.0
margin_left = 147.0
margin_top = 9.0
margin_right = 173.0
margin_right = 188.0
margin_bottom = 23.0
size_flags_horizontal = 3
text = "empty"
align = 1

[node name="Delete" type="ToolButton" parent="."]
margin_left = 177.0
margin_right = 213.0
margin_left = 192.0
margin_right = 228.0
margin_bottom = 32.0
mouse_default_cursor_shape = 2
icon = ExtResource( 1 )
Expand Down
26 changes: 22 additions & 4 deletions src/Nodes/Signal/SignalNode.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SignalNode
# Directly related to godot's signal pattern.
# Directly related to godot's signal pattern.
# When readed by the dialogue system, he should emit a signal with the params
# 4 types are managed for the moment
# Empty, String, Vector2, Number
Expand Down Expand Up @@ -152,9 +152,27 @@ func _on_Type_selected(index: int) -> void:


func _on_File_loaded() -> void:
for value in values.data:
for key in values.data:
var signal_values = values.data[key]

# invalid signal (like parent)
if key == "parent":
continue

var new_signal = signal_field.instance()
container.add_child(new_signal)
new_signal.value.text = value
new_signal.signal_name.text = key

if signal_values.has("Vector2"):
new_signal.value.text = "(%s,%s)" % [signal_values.Vector2.x, signal_values.Vector2.y]
new_signal.type.text = "Vector2"
elif signal_values.has("Number"):
new_signal.value.text = "%s" % signal_values.Number
new_signal.type.text = "Number"
elif signal_values.has("String"):
new_signal.value.text = signal_values.String
new_signal.type.text = "String"
else:
new_signal.type.text = "empty"
new_signal.value.text = "null"
new_signal.connect("field_deleted", self, "_on_Deleted")
is_loading = false
8 changes: 7 additions & 1 deletion src/Toolbox/Json.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
extends RichTextLabel

var values: Dictionary = {}


func _ready():
Events.connect("toolbox_json_displayed", self, "_on_Json_displayed")


func _on_Json_displayed(values: Dictionary) -> void:
func _process(delta):
text = JSON.print(values, "\t")


func _on_Json_displayed(node_values: Dictionary) -> void:
values = node_values
3 changes: 3 additions & 0 deletions src/Toolbox/ToolsboxDrawer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func _on_View_updated(view) -> void:
return
show()

json.set_process(false)
for child in view_container.get_children():
child.hide()

header.show()
var should_update_config := false
Config.globals.views.preview = false
Expand Down Expand Up @@ -68,6 +70,7 @@ func _show_preview() -> void:
func _show_json() -> void:
current_view = View.json
title.text = "Json"
json.set_process(true)
json.show()


Expand Down

0 comments on commit fc99582

Please sign in to comment.