Skip to content

Commit

Permalink
Avoid updating timeline and character directories at runtime (dialogi…
Browse files Browse the repository at this point in the history
…c-godot#2363)

This removes a big amount of work on bigger projects and weaker systems (like android) by using the cache and not calling DialogicResourceUtil.update() on every project run. The files of the project should rarely change at runtime, so the cache does not really need updating there.
  • Loading branch information
LBranco27 authored Aug 14, 2024
1 parent 8621814 commit 64f81a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions addons/dialogic/Core/DialogicGameHandler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ var Voice := preload("res://addons/dialogic/Modules/Voice/subsystem_voice.gd").n

## Autoloads are added first, so this happens REALLY early on game startup.
func _ready() -> void:
DialogicResourceUtil.update()

_collect_subsystems()

clear()
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Text/subsystem_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func collect_character_names() -> void:

character_colors = {}

for dch_path in DialogicResourceUtil.list_resources_of_type('.dch'):
for dch_path in DialogicResourceUtil.get_character_directory().values():
var character := (load(dch_path) as DialogicCharacter)

if character.display_name:
Expand Down
5 changes: 5 additions & 0 deletions addons/dialogic/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,9 @@ func add_dialogic_default_action() -> void:
ProjectSettings.set_setting('input/dialogic_default_action', {'deadzone':0.5, 'events':[input_enter, input_left_click, input_space, input_x, input_controller]})
ProjectSettings.save()

# Create cache when project is compiled
func _build() -> bool:
DialogicResourceUtil.update()
return true

#endregion

0 comments on commit 64f81a8

Please sign in to comment.