diff --git a/addons/dialogic/Editor/Settings/Settings_General.gd b/addons/dialogic/Editor/Settings/Settings_General.gd index 30a708349..44ac84281 100644 --- a/addons/dialogic/Editor/Settings/Settings_General.gd +++ b/addons/dialogic/Editor/Settings/Settings_General.gd @@ -24,6 +24,7 @@ func refresh(): %CustomEventsFolderButton.icon = get_theme_icon("Folder", "EditorIcons") %TestingSceneButton.icon = get_theme_icon("Folder", "EditorIcons") %TestingSceneLabel.text = DialogicUtil.get_project_setting('dialogic/editor/test_dialog_scene', 'res://addons/dialogic/Other/DefaultDialogNode.tscn') + %PhysicsTimerButton.button_pressed = DialogicUtil.is_physics_timer() # Color Palett color_palette = DialogicUtil.get_color_palette() @@ -65,3 +66,7 @@ func custom_testing_scene_selected(path:String): %TestingSceneLabel.text = path ProjectSettings.set_setting('dialogic/editor/test_dialog_scene', path) ProjectSettings.save() + +func _on_physics_timer_button_toggled(button_pressed:bool) -> void: + ProjectSettings.set_setting('dialogic/timer/process_in_physics', button_pressed) + ProjectSettings.save() diff --git a/addons/dialogic/Editor/Settings/Settings_General.tscn b/addons/dialogic/Editor/Settings/Settings_General.tscn index 63a77b994..e729b283f 100644 --- a/addons/dialogic/Editor/Settings/Settings_General.tscn +++ b/addons/dialogic/Editor/Settings/Settings_General.tscn @@ -1,10 +1,17 @@ -[gd_scene load_steps=6 format=3 uid="uid://dm4kxvcn7d7ug"] +[gd_scene load_steps=8 format=3 uid="uid://dm4kxvcn7d7ug"] [ext_resource type="Script" path="res://addons/dialogic/Editor/Settings/Settings_General.gd" id="2"] -[ext_resource type="LabelSettings" uid="uid://nkh7ypguw3il" path="res://addons/dialogic/Editor/Common/HintLabelSettings.tres" id="2_hs15a"] +[ext_resource type="LabelSettings" uid="uid://bqlmi2bwcj0s6" path="res://addons/dialogic/Editor/Common/HintLabelSettings.tres" id="2_hs15a"] [ext_resource type="StyleBox" uid="uid://dmsjhgv22dns8" path="res://addons/dialogic/Editor/Common/TitleBgStylebox.tres" id="2_u584y"] -[sub_resource type="Image" id="Image_3nstt"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6mpk2"] +content_margin_left = 5.0 +content_margin_top = 5.0 +content_margin_right = 5.0 +content_margin_bottom = 5.0 +bg_color = Color(0.545098, 0.545098, 0.545098, 0.211765) + +[sub_resource type="Image" id="Image_iyfpw"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "LumAlpha8", @@ -14,39 +21,54 @@ data = { } [sub_resource type="ImageTexture" id="7"] -image = SubResource("Image_3nstt") +image = SubResource("Image_iyfpw") + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3mwvq"] +content_margin_left = 5.0 +content_margin_top = 5.0 +content_margin_right = 5.0 +content_margin_bottom = 5.0 +bg_color = Color(0.545098, 0.545098, 0.545098, 0.211765) [node name="General" type="HBoxContainer"] +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 script = ExtResource("2") [node name="General" type="VBoxContainer" parent="."] -offset_right = 830.0 -offset_bottom = 600.0 +layout_mode = 2 +offset_right = 958.0 +offset_bottom = 648.0 size_flags_horizontal = 3 [node name="TitleLabel" type="Label" parent="General"] -offset_right = 830.0 +layout_mode = 2 +offset_right = 958.0 offset_bottom = 36.0 -theme_override_styles/normal = ExtResource("2_u584y") +theme_override_styles/normal = SubResource("StyleBoxFlat_6mpk2") text = "Extensions" [node name="HBoxContainer" type="HBoxContainer" parent="General"] +layout_mode = 2 offset_top = 40.0 -offset_right = 830.0 +offset_right = 958.0 offset_bottom = 66.0 [node name="Label" type="Label" parent="General/HBoxContainer"] -offset_right = 498.0 +layout_mode = 2 +offset_right = 626.0 offset_bottom = 26.0 size_flags_horizontal = 3 text = "Custom events folder" [node name="CustomEventsFolderLabel" type="Label" parent="General/HBoxContainer"] unique_name_in_owner = true -offset_left = 502.0 -offset_right = 802.0 +layout_mode = 2 +offset_left = 630.0 +offset_right = 930.0 offset_bottom = 26.0 size_flags_horizontal = 8 text = "res://addons/dialogic_additions/Events" @@ -55,45 +77,52 @@ visible_characters_behavior = 4 [node name="CustomEventsFolderButton" type="Button" parent="General/HBoxContainer"] unique_name_in_owner = true -offset_left = 806.0 -offset_right = 830.0 +layout_mode = 2 +offset_left = 934.0 +offset_right = 958.0 offset_bottom = 26.0 icon = SubResource("7") [node name="Label" type="Label" parent="General"] +layout_mode = 2 offset_top = 70.0 -offset_right = 830.0 +offset_right = 958.0 offset_bottom = 96.0 text = "You should restart godot after changing this path!" label_settings = ExtResource("2_hs15a") [node name="HSeparator" type="HSeparator" parent="General"] +layout_mode = 2 offset_top = 100.0 -offset_right = 830.0 +offset_right = 958.0 offset_bottom = 104.0 [node name="TitleLabel2" type="Label" parent="General"] +layout_mode = 2 offset_top = 108.0 -offset_right = 830.0 +offset_right = 958.0 offset_bottom = 144.0 -theme_override_styles/normal = ExtResource("2_u584y") +theme_override_styles/normal = SubResource("StyleBoxFlat_6mpk2") text = "Testing" [node name="HBoxContainer2" type="HBoxContainer" parent="General"] +layout_mode = 2 offset_top = 148.0 -offset_right = 830.0 +offset_right = 958.0 offset_bottom = 174.0 [node name="Label" type="Label" parent="General/HBoxContainer2"] -offset_right = 494.0 +layout_mode = 2 +offset_right = 622.0 offset_bottom = 26.0 size_flags_horizontal = 3 text = "Testing scene" [node name="TestingSceneLabel" type="Label" parent="General/HBoxContainer2"] unique_name_in_owner = true -offset_left = 498.0 -offset_right = 802.0 +layout_mode = 2 +offset_left = 626.0 +offset_right = 930.0 offset_bottom = 26.0 size_flags_horizontal = 8 text = "res://addons/dialogic_additions/Events " @@ -102,22 +131,60 @@ visible_characters_behavior = 4 [node name="TestingSceneButton" type="Button" parent="General/HBoxContainer2"] unique_name_in_owner = true -offset_left = 806.0 -offset_right = 830.0 +layout_mode = 2 +offset_left = 934.0 +offset_right = 958.0 offset_bottom = 26.0 icon = SubResource("7") +[node name="HSeparator2" type="HSeparator" parent="General"] +layout_mode = 2 +offset_top = 178.0 +offset_right = 958.0 +offset_bottom = 182.0 + +[node name="TitleLabel3" type="Label" parent="General"] +layout_mode = 2 +offset_top = 186.0 +offset_right = 958.0 +offset_bottom = 222.0 +theme_override_styles/normal = SubResource("StyleBoxFlat_3mwvq") +text = "Timer" + +[node name="HBoxContainer3" type="HBoxContainer" parent="General"] +layout_mode = 2 +offset_top = 226.0 +offset_right = 958.0 +offset_bottom = 252.0 + +[node name="Label" type="Label" parent="General/HBoxContainer3"] +layout_mode = 2 +offset_right = 930.0 +offset_bottom = 26.0 +size_flags_horizontal = 3 +text = "Process in physics" + +[node name="PhysicsTimerButton" type="CheckBox" parent="General/HBoxContainer3"] +unique_name_in_owner = true +layout_mode = 2 +offset_left = 934.0 +offset_right = 958.0 +offset_bottom = 26.0 + [node name="VSeparator" type="VSeparator" parent="."] -offset_left = 834.0 -offset_right = 838.0 -offset_bottom = 600.0 +layout_mode = 2 +offset_left = 962.0 +offset_right = 966.0 +offset_bottom = 648.0 [node name="Theming" type="VBoxContainer" parent="."] -offset_left = 842.0 -offset_right = 1024.0 -offset_bottom = 600.0 +layout_mode = 2 +offset_left = 970.0 +offset_right = 1152.0 +offset_bottom = 648.0 [node name="Label" type="Label" parent="Theming"] +layout_mode = 2 offset_right = 182.0 offset_bottom = 36.0 theme_override_styles/normal = ExtResource("2_u584y") @@ -125,40 +192,47 @@ text = "Color palette" [node name="Colors" type="HBoxContainer" parent="Theming"] unique_name_in_owner = true +layout_mode = 2 offset_top = 40.0 offset_right = 182.0 offset_bottom = 48.0 [node name="Color1" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_right = 8.0 offset_bottom = 8.0 color = Color(0.231373, 0.545098, 0.94902, 1) [node name="Color2" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_left = 12.0 offset_right = 20.0 offset_bottom = 8.0 color = Color(0, 0.694118, 0.372549, 1) [node name="Color3" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_left = 24.0 offset_right = 32.0 offset_bottom = 8.0 color = Color(0.580392, 0.407843, 0.909804, 1) [node name="Color4" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_left = 36.0 offset_right = 44.0 offset_bottom = 8.0 color = Color(0.870588, 0.360784, 0.360784, 1) [node name="Color5" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_left = 48.0 offset_right = 56.0 offset_bottom = 8.0 color = Color(0.980392, 0.584314, 0.164706, 1) [node name="Color6" type="ColorPickerButton" parent="Theming/Colors"] +layout_mode = 2 offset_left = 60.0 offset_right = 68.0 offset_bottom = 8.0 @@ -166,6 +240,7 @@ color = Color(0.486275, 0.486275, 0.486275, 1) [node name="ResetColorsButton" type="Button" parent="Theming"] unique_name_in_owner = true +layout_mode = 2 offset_top = 52.0 offset_right = 182.0 offset_bottom = 83.0 @@ -174,3 +249,4 @@ text = "Reset colors to default" [connection signal="pressed" from="General/HBoxContainer/CustomEventsFolderButton" to="." method="_on_CustomEventsFolderButton_pressed"] [connection signal="pressed" from="General/HBoxContainer2/TestingSceneButton" to="." method="_on_TestingSceneButton_pressed"] +[connection signal="toggled" from="General/HBoxContainer3/PhysicsTimerButton" to="." method="_on_physics_timer_button_toggled"] diff --git a/addons/dialogic/Events/Choice/Subsystem_Choices.gd b/addons/dialogic/Events/Choice/Subsystem_Choices.gd index c4a1ac8b8..a6be9d794 100644 --- a/addons/dialogic/Events/Choice/Subsystem_Choices.gd +++ b/addons/dialogic/Events/Choice/Subsystem_Choices.gd @@ -4,6 +4,7 @@ var choice_blocker = Timer.new() func _ready(): choice_blocker.one_shot = true + DialogicUtil.update_timer_process_callback(choice_blocker) add_child(choice_blocker) #################################################################################################### diff --git a/addons/dialogic/Events/Save/Subsystem_Save.gd b/addons/dialogic/Events/Save/Subsystem_Save.gd index ce72266dd..278878836 100644 --- a/addons/dialogic/Events/Save/Subsystem_Save.gd +++ b/addons/dialogic/Events/Save/Subsystem_Save.gd @@ -190,6 +190,7 @@ var autosave_timer = Timer.new() func _ready(): autosave_timer.one_shot = true + DialogicUtil.update_timer_process_callback(autosave_timer) autosave_timer.name = "AutosaveTimer" autosave_timer.timeout.connect(_on_autosave_timer_timeout) add_child(autosave_timer) diff --git a/addons/dialogic/Events/Text/CharacterEdit_TypingSounds_MoodItem.gd b/addons/dialogic/Events/Text/CharacterEdit_TypingSounds_MoodItem.gd index 788187db5..491431c64 100644 --- a/addons/dialogic/Events/Text/CharacterEdit_TypingSounds_MoodItem.gd +++ b/addons/dialogic/Events/Text/CharacterEdit_TypingSounds_MoodItem.gd @@ -72,6 +72,7 @@ func preview(): if %SoundFolder.hint_tooltip.is_empty(): return $DialogicNode_TypeSounds.load_overwrite(get_data()) var preview_timer = Timer.new() + DialogicUtil.update_timer_process_callback(preview_timer) add_child(preview_timer) preview_timer.start(DialogicUtil.get_project_setting('text/speed', 0.01)) for i in range(20): diff --git a/addons/dialogic/Events/Text/Display_DialogText.gd b/addons/dialogic/Events/Text/Display_DialogText.gd index bff43615e..930de5628 100644 --- a/addons/dialogic/Events/Text/Display_DialogText.gd +++ b/addons/dialogic/Events/Text/Display_DialogText.gd @@ -32,6 +32,7 @@ func _ready() -> void: add_child(timer) timer.wait_time = 0.01 timer.one_shot = true + DialogicUtil.update_timer_process_callback(timer) timer.timeout.connect(continue_reveal) # compile effects regex diff --git a/addons/dialogic/Events/Text/event.gd b/addons/dialogic/Events/Text/event.gd index 729d0c322..ef6637425 100644 --- a/addons/dialogic/Events/Text/event.gd +++ b/addons/dialogic/Events/Text/event.gd @@ -77,7 +77,7 @@ func _execute() -> void: if dialogic.has_subsystem('Voice') and dialogic.Voice.is_voiced(dialogic.current_event_idx): #autocontinue settings is set as minimal. change or keep this? - Kvagram wait = max(wait, dialogic.Voice.get_remaining_time()) - await dialogic.get_tree().create_timer(wait).timeout + await dialogic.get_tree().create_timer(wait, true, DialogicUtil.is_physics_timer()).timeout dialogic.handle_next_event() else: dialogic.Text.show_next_indicators() diff --git a/addons/dialogic/Events/Voice/Subsystem_Voice.gd b/addons/dialogic/Events/Voice/Subsystem_Voice.gd index 0342d5ff9..4c76d7289 100644 --- a/addons/dialogic/Events/Voice/Subsystem_Voice.gd +++ b/addons/dialogic/Events/Voice/Subsystem_Voice.gd @@ -72,6 +72,7 @@ func stop_audio(): func set_timer(time:float): if !voicetimer: voicetimer = Timer.new() + DialogicUtil.update_timer_process_callback(voicetimer) voicetimer.one_shot = true add_child(voicetimer) voicetimer.timeout.connect(stop_audio) diff --git a/addons/dialogic/Events/Wait/event.gd b/addons/dialogic/Events/Wait/event.gd index c0c317cd3..d5c4176d1 100644 --- a/addons/dialogic/Events/Wait/event.gd +++ b/addons/dialogic/Events/Wait/event.gd @@ -10,7 +10,7 @@ func _execute() -> void: if (HideText): dialogic.Text.hide_text_boxes() dialogic.current_state = dialogic.states.WAITING - await dialogic.get_tree().create_timer(SecondsTime).timeout + await dialogic.get_tree().create_timer(SecondsTime, true, DialogicUtil.is_physics_timer()).timeout dialogic.current_state = dialogic.states.IDLE if (HideText): dialogic.Text.show_text_boxes() diff --git a/addons/dialogic/Other/DialogicUtil.gd b/addons/dialogic/Other/DialogicUtil.gd index 32e60737c..3fb549576 100644 --- a/addons/dialogic/Other/DialogicUtil.gd +++ b/addons/dialogic/Other/DialogicUtil.gd @@ -164,3 +164,11 @@ static func get_color_palette(default:bool = false) -> Dictionary: static func get_color(value:String) -> Color: var colors = get_color_palette() return colors[value] + + +static func is_physics_timer()->bool: + return get_project_setting('dialogic/timer/process_in_physics', false) + + +static func update_timer_process_callback(timer:Timer) -> void: + timer.process_callback = Timer.TIMER_PROCESS_PHYSICS if is_physics_timer() else Timer.TIMER_PROCESS_IDLE