From 28f1cc11a17011595ce491c68d143fa791856f88 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 25 Jun 2023 15:59:26 +0200 Subject: [PATCH 1/5] Make sure text_input signal connection is one_shot --- addons/dialogic/Modules/TextInput/event_text_input.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dialogic/Modules/TextInput/event_text_input.gd b/addons/dialogic/Modules/TextInput/event_text_input.gd index a44576a4f..597e88834 100644 --- a/addons/dialogic/Modules/TextInput/event_text_input.gd +++ b/addons/dialogic/Modules/TextInput/event_text_input.gd @@ -26,7 +26,7 @@ var allow_empty : bool = false func _execute() -> void: dialogic.current_state = Dialogic.states.WAITING dialogic.TextInput.show_text_input(text, default, placeholder, allow_empty) - dialogic.TextInput.input_confirmed.connect(_on_DialogicTextInput_input_confirmed) + dialogic.TextInput.input_confirmed.connect(_on_DialogicTextInput_input_confirmed, CONNECT_ONE_SHOT) func _on_DialogicTextInput_input_confirmed(input:String) -> void: From ba98ad4c288fd10bbf0045b32d0f8e3b4a2b2b71 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 25 Jun 2023 16:00:14 +0200 Subject: [PATCH 2/5] Make character main settings not trigger save during load --- .../Editor/CharacterEditor/char_edit_section_portraits.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd b/addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd index 7c038e50d..0905ed911 100644 --- a/addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd +++ b/addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd @@ -2,7 +2,7 @@ extends DialogicCharacterEditorMainSection ## The general portrait settings section - +var loading := false func _ready() -> void: # Connecting all necessary signals @@ -19,6 +19,8 @@ func _ready() -> void: # Make sure preview get's updated when portrait settings change func main_portrait_settings_update(_something=null, _value=null) -> void: + if loading: + return character_editor.current_resource.scale = %MainScale.value/100.0 character_editor.current_resource.offset = %MainOffset.current_value character_editor.current_resource.mirror = %MainMirror.button_pressed @@ -32,12 +34,13 @@ func default_portrait_changed(property:String, value:String) -> void: func _load_character(resource:DialogicCharacter) -> void: + loading = true %DefaultPortraitPicker.set_value(resource.default_portrait) %MainScale.value = 100*resource.scale %MainOffset.set_value(resource.offset) %MainMirror.button_pressed = resource.mirror - + loading = false func _save_changes(resource:DialogicCharacter) -> DialogicCharacter: # Portrait settings From f11b49337ed3c7a1e5375493839abed05ed6db7c Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 25 Jun 2023 17:10:59 +0200 Subject: [PATCH 3/5] Make sure text is properly cleared before layout is re-shown Should fix #1610 --- .../Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn | 5 ----- addons/dialogic/Modules/Text/node_dialog_text.gd | 5 ++++- addons/dialogic/Modules/Text/subsystem_text.gd | 4 ++++ addons/dialogic/Other/DialogicGameHandler.gd | 5 +++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn b/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn index fc0818da7..682c760a7 100644 --- a/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn +++ b/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn @@ -215,7 +215,6 @@ expand_margin_bottom = 5.0 [node name="DefaultDialogNode" type="CanvasLayer"] script = ExtResource("1") name_label_box_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) -name_label_box_offset = null [node name="DialogicNode_BackgroundHolder" type="CanvasLayer" parent="."] layer = -1 @@ -365,10 +364,6 @@ anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -offset_left = 576.0 -offset_top = 648.0 -offset_right = 576.0 -offset_bottom = 648.0 grow_horizontal = 2 grow_vertical = 0 diff --git a/addons/dialogic/Modules/Text/node_dialog_text.gd b/addons/dialogic/Modules/Text/node_dialog_text.gd index 74e163fd6..81600cf81 100644 --- a/addons/dialogic/Modules/Text/node_dialog_text.gd +++ b/addons/dialogic/Modules/Text/node_dialog_text.gd @@ -13,6 +13,7 @@ enum ALIGNMENT {LEFT, CENTER, RIGHT} @export var textbox_root : Node = self @export var hide_when_empty := false +@export var start_hidden := true var revealing := false var speed:float = 0.01 @@ -24,7 +25,7 @@ func _set(property, what): if property == 'text' and typeof(what) == TYPE_STRING: text = what if hide_when_empty: - visible = !what.is_empty() + textbox_root.visible = !what.is_empty() return true @@ -33,6 +34,8 @@ func _ready() -> void: add_to_group('dialogic_dialog_text') bbcode_enabled = true + if start_hidden: + textbox_root.hide() text = "" diff --git a/addons/dialogic/Modules/Text/subsystem_text.gd b/addons/dialogic/Modules/Text/subsystem_text.gd index bb248004e..c20c2c4aa 100644 --- a/addons/dialogic/Modules/Text/subsystem_text.gd +++ b/addons/dialogic/Modules/Text/subsystem_text.gd @@ -37,6 +37,10 @@ func clear_game_state(clear_flag:=Dialogic.ClearFlags.FullClear) -> void: set_skippable(ProjectSettings.get_setting('dialogic/text/skippable', true)) set_autoadvance(ProjectSettings.get_setting('dialogic/text/autoadvance', false), ProjectSettings.get_setting('dialogic/text/autoadvance_delay', 1)) + for text_node in get_tree().get_nodes_in_group('dialogic_dialog_text'): + if text_node.start_hidden: + text_node.textbox_root.hide() + set_manualadvance(true) diff --git a/addons/dialogic/Other/DialogicGameHandler.gd b/addons/dialogic/Other/DialogicGameHandler.gd index e537aecda..6451c4c37 100644 --- a/addons/dialogic/Other/DialogicGameHandler.gd +++ b/addons/dialogic/Other/DialogicGameHandler.gd @@ -469,6 +469,7 @@ func process_timeline(timeline: DialogicTimeline) -> DialogicTimeline: # -> returns the layout node func start(timeline:Variant, label:Variant="") -> Node: var scene := add_layout_node() + Dialogic.clear(ClearFlags.KeepVariables) Dialogic.start_timeline(timeline, label) return scene @@ -478,7 +479,7 @@ func start(timeline:Variant, label:Variant="") -> Node: # If you need a layout inside your game, instance it manually and use start_timeline() instead of start(). func add_layout_node(scene_path := "", export_overrides := {}) -> Node: var scene :Node = null - if is_instance_valid(get_tree().get_meta('dialogic_layout_node', null)): + if get_tree().has_meta('dialogic_layout_node') and is_instance_valid(get_tree().get_meta('dialogic_layout_node', null)): scene = get_tree().get_meta('dialogic_layout_node', null) # create a new one if none exists or a different one was requested @@ -527,6 +528,6 @@ func _on_timeline_ended(): func has_active_layout_node() -> bool: - if !is_instance_valid(get_tree().get_meta('dialogic_layout_node', null)) or !get_tree().get_meta('dialogic_layout_node').visible: + if !get_tree().has_meta('dialogic_layout_node') or !is_instance_valid(get_tree().get_meta('dialogic_layout_node', null)) or !get_tree().get_meta('dialogic_layout_node').visible: return false return true From e440622d79a73c1ec9ba8a0820b8462824c34309 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 25 Jun 2023 17:16:56 +0200 Subject: [PATCH 4/5] Fix default layout position0 --- .../Default/DialogicDefaultLayout.tscn | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn b/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn index 682c760a7..704fbb331 100644 --- a/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn +++ b/addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn @@ -235,15 +235,11 @@ mouse_filter = 2 [node name="DialogicNode_PortraitContainer1" type="Control" parent="Portraits/Portraits"] layout_mode = 1 -anchor_left = 0.0572917 -anchor_top = 0.725309 -anchor_right = 0.177951 -anchor_bottom = 1.00309 -grow_horizontal = 2 +anchor_right = 0.231771 +anchor_bottom = 1.0 grow_vertical = 2 mouse_filter = 2 script = ExtResource("3_dbhei") -size_mode = 1 metadata/_edit_use_anchors_ = true [node name="DialogicNode_PortraitContainer2" type="Control" parent="Portraits/Portraits"] @@ -314,10 +310,17 @@ script = ExtResource("16_07l6b") [node name="Choices" type="VBoxContainer" parent="DefaultStyle"] layout_mode = 1 -offset_left = 19.0 -offset_top = 15.0 -offset_right = 192.0 -offset_bottom = 221.0 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -86.5 +offset_top = -103.0 +offset_right = 86.5 +offset_bottom = 103.0 +grow_horizontal = 2 +grow_vertical = 2 alignment = 1 metadata/_edit_layout_mode = 1 From 97af2d26f37f69b978fbdcc6400c353dadb8a0b7 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Sun, 25 Jun 2023 18:32:16 +0200 Subject: [PATCH 5/5] Fix capitalization and NO LAYOUT mode --- addons/dialogic/Modules/Voice/event_voice.gd | 4 ++-- addons/dialogic/Other/DialogicGameHandler.gd | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/dialogic/Modules/Voice/event_voice.gd b/addons/dialogic/Modules/Voice/event_voice.gd index ccc17ce08..4a2454a85 100644 --- a/addons/dialogic/Modules/Voice/event_voice.gd +++ b/addons/dialogic/Modules/Voice/event_voice.gd @@ -65,5 +65,5 @@ func build_event_editor(): {'file_filter' : "*.mp3, *.ogg, *.wav", 'placeholder' : "Select file", 'editor_icon' : ["AudioStreamPlayer", "EditorIcons"]}) - add_body_edit('volume', ValueType.Decibel, 'volume:', '', {}, '!file_path.is_empty()') - add_body_edit('audio_bus', ValueType.SinglelineText, 'audio_bus:', '', {}, '!file_path.is_empty()') + add_body_edit('volume', ValueType.Decibel, 'Volume:', '', {}, '!file_path.is_empty()') + add_body_edit('audio_bus', ValueType.SinglelineText, 'Audio Bus:', '', {}, '!file_path.is_empty()') diff --git a/addons/dialogic/Other/DialogicGameHandler.gd b/addons/dialogic/Other/DialogicGameHandler.gd index 6451c4c37..437e83eef 100644 --- a/addons/dialogic/Other/DialogicGameHandler.gd +++ b/addons/dialogic/Other/DialogicGameHandler.gd @@ -478,6 +478,10 @@ func start(timeline:Variant, label:Variant="") -> Node: # The layout scene will always be added to the tree root. # If you need a layout inside your game, instance it manually and use start_timeline() instead of start(). func add_layout_node(scene_path := "", export_overrides := {}) -> Node: + + if ProjectSettings.get_setting('dialogic/layout/mode', 0) == 2: + return null + var scene :Node = null if get_tree().has_meta('dialogic_layout_node') and is_instance_valid(get_tree().get_meta('dialogic_layout_node', null)): scene = get_tree().get_meta('dialogic_layout_node', null)