Skip to content

Commit

Permalink
1.4.2 - Fix for #904 (#979)
Browse files Browse the repository at this point in the history
We track the human readable timeline_name and return it during emitted signals
  • Loading branch information
zaknafean authored Jul 6, 2022
1 parent 6348856 commit 6b3cbd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions addons/dialogic/Nodes/DialogNode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extends Control
## -----------------------------------------------------------------------------
## The timeline to load when starting the scene
var timeline: String
var timeline_name: String

### MODE
var preview: bool = false
Expand Down Expand Up @@ -398,6 +399,7 @@ func play_audio(name):
## -----------------------------------------------------------------------------
# load a timeline file and start parsing
func set_current_dialog(dialog_path: String):
print(dialog_path)
current_timeline = dialog_path
dialog_script = DialogicResources.get_timeline_json(dialog_path)
return load_dialog()
Expand Down Expand Up @@ -545,8 +547,8 @@ func on_timeline_start():
# save to the default slot
Dialogic.save('', true)
# TODO remove event_start in 2.0
emit_signal("event_start", "timeline", current_timeline)
emit_signal("timeline_start", current_timeline)
emit_signal("event_start", "timeline", timeline_name)
emit_signal("timeline_start", timeline_name)

# emits timeline_end and handles autosaving
func on_timeline_end():
Expand All @@ -556,7 +558,7 @@ func on_timeline_end():
Dialogic.save('', true)
# TODO remove event_end in 2.0
emit_signal("event_end", "timeline")
emit_signal("timeline_end", current_timeline)
emit_signal("timeline_end", timeline_name)

# does checks and calls the above functions
func _emit_timeline_signals():
Expand Down
2 changes: 2 additions & 0 deletions addons/dialogic/Other/DialogicClass.gd
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static func start(timeline: String = '', default_timeline: String ='', dialog_sc
for t in DialogicUtil.get_timeline_list():
if t['file'] == timeline:
dialog_node.timeline = t['file']
dialog_node.timeline_name = timeline
return returned_dialog_node
# No file found. Show error
dialog_node.dialog_script = {
Expand All @@ -88,6 +89,7 @@ static func start(timeline: String = '', default_timeline: String ='', dialog_sc
var timeline_file = _get_timeline_file_from_name(timeline)
if timeline_file:
dialog_node.timeline = timeline_file
dialog_node.timeline_name = timeline
return returned_dialog_node

# Just in case everything else fails.
Expand Down

0 comments on commit 6b3cbd4

Please sign in to comment.