Skip to content

Commit 5719808

Browse files
committed
2 parents e4e1e79 + ea39c1b commit 5719808

File tree

7 files changed

+42
-28
lines changed

7 files changed

+42
-28
lines changed

addons/dialogic/Editor/CharacterEditor/character_editor_tab_general.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func _load_character(resource:DialogicCharacter) -> void:
4343
func _save_changes(resource:DialogicCharacter) -> DialogicCharacter:
4444
resource.display_name = %DisplayNameLineEdit.text
4545
resource.color = %ColorPickerButton.color
46-
var nicknames = []
46+
var nicknames := []
4747
for n_name in %NicknameLineEdit.text.split(','):
4848
nicknames.append(n_name.strip_edges())
4949
resource.nicknames = nicknames

addons/dialogic/Editor/Common/sidebar.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ func update_resource_list() -> void:
6767
var current_file := ""
6868
if editors_manager.current_editor and editors_manager.current_editor.current_resource:
6969
current_file = editors_manager.current_editor.current_resource.resource_path
70+
7071
var character_directory: Dictionary = editors_manager.resource_helper.character_directory
7172
var timeline_directory: Dictionary = editors_manager.resource_helper.timeline_directory
7273
var latest_resources: Array = DialogicUtil.get_project_setting('dialogic/editor/last_resources', [])
74+
for res in latest_resources:
75+
if !FileAccess.file_exists(res):
76+
latest_resources.erase(res)
77+
ProjectSettings.set_setting('dialogic/editor/last_resources', latest_resources)
78+
7379
%ResourcesList.clear()
7480
var idx := 0
7581
for character in character_directory.values():

addons/dialogic/Editor/TimelineEditor/TextEditor/syntax_highlighter.gd

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,29 @@ var shortcode_param_color : Color
3434
var shortcode_value_color : Color
3535

3636
func _init():
37-
# Load colors from editor settings
38-
var editor_settings = DialogicUtil.get_dialogic_plugin().editor_interface.get_editor_settings()
39-
normal_color = editor_settings.get('text_editor/theme/highlighting/text_color')
40-
comment_color = editor_settings.get('text_editor/theme/highlighting/comment_color')
41-
text_effect_color = normal_color.darkened(0.5)
42-
choice_color = editor_settings.get('text_editor/theme/highlighting/function_color')
43-
44-
code_flow_color = editor_settings.get("text_editor/theme/highlighting/control_flow_keyword_color")
45-
boolean_operator_color = code_flow_color.lightened(0.5)
46-
variable_color = editor_settings.get('text_editor/theme/highlighting/engine_type_color')
47-
string_color = editor_settings.get('text_editor/theme/highlighting/string_color')
48-
49-
50-
shortcode_color = editor_settings.get('text_editor/theme/highlighting/gdscript/annotation_color')
51-
shortcode_param_color = editor_settings.get('text_editor/theme/highlighting/gdscript/node_path_color')
52-
shortcode_value_color = editor_settings.get('text_editor/theme/highlighting/gdscript/node_reference_color')
53-
54-
keyword_VAR_color = editor_settings.get('text_editor/theme/highlighting/keyword_color')
55-
56-
character_event_color = editor_settings.get('text_editor/theme/highlighting/symbol_color')
57-
character_name_color = editor_settings.get('text_editor/theme/highlighting/executing_line_color')
58-
character_portrait_color = character_name_color.lightened(0.6)
37+
# Load colors from editor settings
38+
if DialogicUtil.get_dialogic_plugin():
39+
var editor_settings = DialogicUtil.get_dialogic_plugin().editor_interface.get_editor_settings()
40+
normal_color = editor_settings.get('text_editor/theme/highlighting/text_color')
41+
comment_color = editor_settings.get('text_editor/theme/highlighting/comment_color')
42+
text_effect_color = normal_color.darkened(0.5)
43+
choice_color = editor_settings.get('text_editor/theme/highlighting/function_color')
44+
45+
code_flow_color = editor_settings.get("text_editor/theme/highlighting/control_flow_keyword_color")
46+
boolean_operator_color = code_flow_color.lightened(0.5)
47+
variable_color = editor_settings.get('text_editor/theme/highlighting/engine_type_color')
48+
string_color = editor_settings.get('text_editor/theme/highlighting/string_color')
49+
50+
51+
shortcode_color = editor_settings.get('text_editor/theme/highlighting/gdscript/annotation_color')
52+
shortcode_param_color = editor_settings.get('text_editor/theme/highlighting/gdscript/node_path_color')
53+
shortcode_value_color = editor_settings.get('text_editor/theme/highlighting/gdscript/node_reference_color')
54+
55+
keyword_VAR_color = editor_settings.get('text_editor/theme/highlighting/keyword_color')
56+
57+
character_event_color = editor_settings.get('text_editor/theme/highlighting/symbol_color')
58+
character_name_color = editor_settings.get('text_editor/theme/highlighting/executing_line_color')
59+
character_portrait_color = character_name_color.lightened(0.6)
5960

6061
shortcode_regex.compile("\\W*\\[(?<id>\\w*)(?<args>[^\\]]*)?")
6162
shortcode_param_regex.compile('((?<parameter>[^\\s=]*)\\s*=\\s*"(?<value>([^=]|\\\\=)*)(?<!\\\\)")')

addons/dialogic/Editor/editors_manager.gd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ func _on_editors_tab_changed(tab:int) -> void:
7878

7979

8080
func edit_resource(resource:Resource, save_previous:bool = true) -> void:
81+
if current_editor and save_previous:
82+
current_editor._save_resource()
83+
8184
## Update the latest resource lis
8285
var used_resources:Array = DialogicUtil.get_project_setting('dialogic/editor/last_resources', [])
86+
8387
if resource.resource_path in used_resources:
8488
used_resources.erase(resource.resource_path)
89+
8590
used_resources.push_front(resource.resource_path)
91+
8692
ProjectSettings.set_setting('dialogic/editor/last_resources', used_resources)
8793
ProjectSettings.save()
8894

@@ -91,7 +97,7 @@ func edit_resource(resource:Resource, save_previous:bool = true) -> void:
9197
for editor in editors.values():
9298
if editor.get('extension', '') == extension:
9399
editor['node']._open_resource(resource)
94-
open_editor(editor['node'], save_previous)
100+
open_editor(editor['node'], false)
95101

96102
resource_opened.emit(resource)
97103

@@ -107,7 +113,6 @@ func toggle_editor(editor) -> void:
107113
## Shows the given editor
108114
func open_editor(editor:DialogicEditor, save_previous: bool = true, extra_info:Variant = null) -> void:
109115

110-
111116
if current_editor and save_previous:
112117
current_editor._save_resource()
113118

addons/dialogic/Events/Audio/subsystem_audio.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func play_sound(path:String, volume:float = 0.0, audio_bus:String = "Master", lo
8383
new_sound_node.bus = audio_bus
8484
add_child(new_sound_node)
8585
new_sound_node.play()
86-
new_sound_node.finished.connect(queue_free)
86+
new_sound_node.finished.connect(new_sound_node.queue_free)
8787

8888
func stop_all_sounds() -> void:
8989
var sound_nodes: Array = get_tree().get_nodes_in_group('dialogic_sound_player')

addons/dialogic/Events/Text/subsystem_text.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ func update_character_names() -> void:
140140
if nickname.strip_edges():
141141
character_colors[nickname.strip_edges()] = dch.color
142142

143-
color_regex.compile('(?<=\\W)(?<name>'+str(character_colors.keys()).trim_prefix('["').trim_suffix('"]').replace('", "', '|')+')(?=\\W|$)')
143+
color_regex.compile('(?<=\\W|^)(?<name>'+str(character_colors.keys()).trim_prefix('["').trim_suffix('"]').replace('", "', '|')+')(?=\\W|$)')

addons/dialogic/Other/DialogicUtil.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ static func listdir(path: String, files_only: bool = true, throw_error:bool = tr
3131

3232
static func get_dialogic_plugin() -> Node:
3333
var tree: SceneTree = Engine.get_main_loop()
34-
return tree.get_root().get_child(0).get_node('DialogicPlugin')
34+
if tree.get_root().get_child(0).has_node('DialogicPlugin'):
35+
return tree.get_root().get_child(0).get_node('DialogicPlugin')
36+
return null
3537

3638

3739
static func list_resources_of_type(extension:String) -> Array:

0 commit comments

Comments
 (0)