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

Commit

Permalink
Can now edit character name without reset his value
Browse files Browse the repository at this point in the history
  • Loading branch information
Levrault committed Apr 3, 2022
1 parent 9310bc2 commit 06e851d
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 25 deletions.
5 changes: 3 additions & 2 deletions assets/examples/basic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ custom=[ ]

characters=[ {
"name": "Godot",
"portraits": [ ]
"portraits": [ ],
"uuid": "86a9c926-55c6-4c77-b654-d4a8f45f7c0a"
} ]
files=[ {
"name": "basic.json",
Expand All @@ -39,4 +40,4 @@ last_opened_file={

[info]

version="v1.0.3"
version="v1.1.3"
2 changes: 1 addition & 1 deletion assets/examples/complete_conditional_example
Original file line number Diff line number Diff line change
@@ -1 +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":[]}}
{"f52b144c-6ba9-4d3b-8255-a92e343123c5":{"name":"Actor2_uuid","portrait":"res://assets/examples/levrault.png","text":{"en":"The empty condition should be the default\npath of your dialogue system","fr":""},"parent":"b5c55fcc-5eb6-4088-ba49-a9b6b7b7a187","character_uuid":"b62a4f50-4ddd-4663-bb58-1ef6b9fe883d"},"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"}},"character_uuid":"c4212435-07bc-4da0-a8d9-34cd242dfc60"},"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":[]}}
10 changes: 6 additions & 4 deletions assets/examples/complete_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ characters=[ {
"name": "Idle",
"path": "res://assets/examples/godot.png",
"uuid": "4a8db634-fc49-4a03-84dd-25f2380c99fd"
} ]
} ],
"uuid": "c4212435-07bc-4da0-a8d9-34cd242dfc60"
}, {
"name": "Actor2",
"name": "Actor2_uuid",
"portraits": [ {
"default": true,
"name": "Idle",
"path": "res://assets/examples/levrault.png",
"uuid": "854aa4f7-85f3-4bf3-ab6e-98d7f63b125b"
} ]
} ],
"uuid": "b62a4f50-4ddd-4663-bb58-1ef6b9fe883d"
} ]
files=[ {
"name": "complete_example_demo",
Expand All @@ -55,4 +57,4 @@ last_opened_file={

[info]

version="v1.1.2"
version="v1.1.3"
16 changes: 7 additions & 9 deletions assets/examples/simple.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@ custom=[ ]

characters=[ {
"name": "Godot",
"portraits": [ ]
"portraits": [ ],
"uuid": "9e112044-ac53-437d-b1c1-7ad9cf5f5fff"
} ]
files=[ {
"name": "Tutoshop.json",
"path": "/Users/lflangis/Downloads/Tutoshop.json"
"name": "simple.json",
"path": "/Users/Luc-Frédéric/Devs/LE-dialogue-editor/assets/examples/simple.json"
} ]

[cache]

last_opened_file={
"name": "Tutoshop.json",
"path": "/Users/lflangis/Downloads/Tutoshop.json"
"name": "simple.json",
"path": "/Users/Luc-Frédéric/Devs/LE-dialogue-editor/assets/examples/simple.json"
}

[info]

version="v1.0.3-beta"
window_height=1920
window_width=1080
full_screen=false
version="v1.1.3"
1 change: 1 addition & 0 deletions assets/examples/simple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":{"next":"e5b7a6cd-0e5b-48eb-919e-3249e16e83ce"},"__editor":{"root":{"uuid":"root","offset":[40,100]},"dialogues":[{"uuid":"e5b7a6cd-0e5b-48eb-919e-3249e16e83ce","offset":[340,80],"parent":"root"}],"conditions":[],"signals":[],"choices":[]},"e5b7a6cd-0e5b-48eb-919e-3249e16e83ce":{"character_uuid":"","text":{"en":"hello","fr":""},"parent":"root"}}
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ _global_script_class_icons={

[Info]

version="v1.1.2"
version="v1.1.3"
wiki="https://github.com/Levrault/levrault-dialogue-editor/wiki"
github="https://github.com/Levrault/levrault-dialogue-editor"
twitter="https://twitter.com/LFLangis"
Expand Down
3 changes: 3 additions & 0 deletions src/Autoload/Config.gd
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ func update_workspace_file_if_needed(loaded_settings: Dictionary, path: String)
has_been_updated = true
print_debug("%s workspace file has been update to 1.1.0" % path)

if loaded_settings.info.version == "v1.1.0":
UpdateTool.migrate_workspace_v1_1_0_to_v1_1_3(loaded_settings, DEFAULT_VALUES)

if loaded_settings.info.version != ProjectSettings.get_setting("Info/version"):
UpdateTool.migrate_to_last_version_only(loaded_settings)

Expand Down
3 changes: 0 additions & 3 deletions src/Autoload/Editor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,13 @@ func absolute_path(path: String) -> String:


func resource_path(path: String) -> String:
print(workspace.resource)
print(path.replace(workspace.resource, Constant.RESOURCE))
return path.replace(workspace.resource, Constant.RESOURCE)


func import_image(path: String, size: Vector2) -> ImageTexture:
var texture := ImageTexture.new()
var image := Image.new()

print(absolute_path(path))
var err = image.load(absolute_path(path))
assert(err == OK)

Expand Down
5 changes: 4 additions & 1 deletion src/Nodes/Dialogue/CharacterNameOptions.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ func _on_Characters_list_changed() -> void:

show()
empty_msg.hide()
var index := 0
for character in Config.values.variables.characters:
add_item(character.name)
if character.name == owner.values.data.name:
set_item_metadata(get_item_count() - 1, { uuid = character.uuid })
if character.uuid == owner.values.data.get("character_uuid") or character.name == owner.values.data.name:
selected = get_item_count() - 1

owner.values.data.name = get_item_text(selected)
owner.values.data["character_uuid"] = get_item_metadata(selected).uuid


func _on_Character_selected(index: int) -> void:
Expand Down
6 changes: 5 additions & 1 deletion src/Nodes/Dialogue/DialogueNode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
# Generated json
# Case linear
# "e26a5ccf-66fe-4319-a130-47652e1a63b4": {
# "uuid": "e26a5ccf-66fe-4319-a130-47652e177777",
# "name": "Hero",
# "portrait": "res://assets/examples/hero.png",
# "text": { "en": "This is the default response", "fr": "" },
# "next": "79b93840-045d-4df1-b03a-52e984e0b2c2"
# },
# Case Conditional linear
# "e26a5ccf-66fe-4319-a130-47652e1a63b4": {
# "uuid": "e26a5ccf-66fe-4319-a130-47652e177777",
# "name": "Hero",
# "portrait": "res://assets/examples/hero.png",
# "text": { "en": "This is the default response", "fr": "" },
Expand All @@ -36,6 +38,7 @@
#
# Case Choices
# "e26a5ccf-66fe-4319-a130-47652e1a63b4": {
# "uuid": "e26a5ccf-66fe-4319-a130-47652e177777",
# "name": "Hero",
# "portrait": "res://assets/examples/hero.png",
# "text": { "en": "This is the default response", "fr": "" },
Expand All @@ -53,6 +56,7 @@
#
# Case Conditional choices. Node needs to have conditions AND choices params
# "e26a5ccf-66fe-4319-a130-47652e1a63b4": {
# "uuid": "e26a5ccf-66fe-4319-a130-47652e177777",
# "name": "Hero",
# "portrait": "res://assets/examples/hero.png",
# "text": { "en": "This is the default response", "fr": "" },
Expand Down Expand Up @@ -101,7 +105,7 @@ func _ready() -> void:

values = {
"__editor": {"uuid": uuid, "offset": [offset.x, offset.y]},
"data": {"name": "", "portrait": "", "text": {"en": "", "fr": ""}}
"data": {"name": "", "character_uuid": "", "portrait": "", "text": {"en": "", "fr": ""}}
}


Expand Down
6 changes: 3 additions & 3 deletions src/Nodes/Dialogue/DialogueNode.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ margin_bottom = 271.28
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource( 6 )
custom_colors/title_color = Color( 1, 1, 1, 1 )
custom_styles/frame = ExtResource( 2 )
custom_styles/selectedframe = SubResource( 1 )
custom_colors/title_color = Color( 1, 1, 1, 1 )
title = "Dialogue"
show_close = true
slot/0/left_enabled = true
Expand All @@ -56,7 +56,7 @@ __meta__ = {
margin_left = 16.0
margin_top = 36.0
margin_right = 329.0
margin_bottom = 305.0
margin_bottom = 328.0
rect_min_size = Vector2( 0, 269 )
size_flags_horizontal = 3
size_flags_vertical = 3
Expand Down Expand Up @@ -143,5 +143,5 @@ script = ExtResource( 3 )
[node name="Text" parent="Container" instance=ExtResource( 4 )]
margin_top = 103.0
margin_right = 313.0
margin_bottom = 269.0
margin_bottom = 292.0
rect_min_size = Vector2( 313, 166 )
9 changes: 9 additions & 0 deletions src/Utils/UpdateTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ static func migrate_workspace_v1_x_x_to_v1_1_0(legacy: Dictionary, default_value
legacy.info.erase("full_screen")


static func migrate_workspace_v1_1_0_to_v1_1_3(legacy: Dictionary, default_values: Dictionary) -> void:
for i in range(legacy.variables.characters.size()):
if legacy.variables.characters[i].has("uuid"):
continue
legacy.variables.characters[i]["uuid"] = Uuid.v4()

legacy["info"]["version"] = "v1.1.3"


# EDITOR
# Save editor version inside the config file
# Add version editor
Expand Down

0 comments on commit 06e851d

Please sign in to comment.