Skip to content

Commit

Permalink
Merge branch 'main' into add-voice-length-text
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner authored Jan 23, 2024
2 parents 7e5c54b + 8b5886a commit 17b0bb0
Show file tree
Hide file tree
Showing 49 changed files with 379 additions and 1,506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
shell: bash
run: |
chmod +x ./addons/gdUnit4/runtest.sh
xvfb-run --auto-servernum ./addons/gdUnit4/runtest.sh --add "res://addons/dialogic/Tests/" --audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0 --continue
xvfb-run --auto-servernum ./addons/gdUnit4/runtest.sh --add "res://Tests/" --audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0 --continue
- name: "Upload Unit Test Reports"
if: ${{ always() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ extends GdUnitTestSuite

## Ensure Auto-Advance is enabled properly using the user input flag.
func test_enable_auto_advance() -> void:
Dialogic.Input.auto_advance.enabled_until_user_input = true
var is_enabled: bool = Dialogic.Input.auto_advance.is_enabled()
Dialogic.Inputs.auto_advance.enabled_until_user_input = true
var is_enabled: bool = Dialogic.Inputs.auto_advance.is_enabled()

assert(is_enabled == true, "Auto-Advance is not enabled.")

Expand All @@ -12,8 +12,8 @@ func test_enable_auto_advance() -> void:
## When the user enabled the Auto-Advance until user input,
## the Auto-Advance would still run after the user input.
func test_disable_auto_advance() -> void:
Dialogic.Input.auto_advance.enabled_until_user_input = true
Dialogic.Input.handle_input()
Dialogic.Inputs.auto_advance.enabled_until_user_input = true
Dialogic.Inputs.handle_input()

var is_enabled: bool = Dialogic.Input.auto_advance.is_enabled()
var is_enabled: bool = Dialogic.Inputs.auto_advance.is_enabled()
assert(is_enabled == false, "Auto-Advance is still running after input")
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class_name GdUnitExampleTest
extends GdUnitTestSuite

func test_example() -> void:
const EXAMPLE_STRING := "Dialogic Test!"
const EXAMPLE_STRING := "Dialogic!"

assert_str(EXAMPLE_STRING)\
.has_length(EXAMPLE_STRING.length())\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ func _on_scene_picker_value_changed(prop_name:String, value:String) -> void:
func _on_open_scene_button_pressed():
if !%ScenePicker.current_value.is_empty() and FileAccess.file_exists(%ScenePicker.current_value):
DialogicUtil.get_dialogic_plugin().get_editor_interface().open_scene_from_path(%ScenePicker.current_value)
EditorInterface.set_main_screen_editor("2D")
52 changes: 33 additions & 19 deletions addons/dialogic/Editor/CharacterEditor/character_editor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func _open(extra_info:Variant="") -> void:
$NoCharacterScreen.show()
return

update_preview()
update_preview(true)
%PortraitChangeInfo.hide()


Expand Down Expand Up @@ -138,6 +138,8 @@ func _ready() -> void:
if get_parent() is SubViewport:
return

DialogicUtil.get_dialogic_plugin().resource_saved.connect(_on_some_resource_saved)

$NoCharacterScreen.color = get_theme_color("dark_color_2", "Editor")
$NoCharacterScreen.show()
setup_portrait_list_tab()
Expand Down Expand Up @@ -531,18 +533,14 @@ func report_name_change(item:TreeItem) -> void:
########### PREVIEW ############################################################

#region Preview
func update_preview() -> void:
func update_preview(force:=false) -> void:
%ScenePreviewWarning.hide()
if selected_item and is_instance_valid(selected_item) and selected_item.get_metadata(0) != null and !selected_item.get_metadata(0).has('group'):
%PreviewLabel.text = 'Preview of "'+%PortraitTree.get_full_item_name(selected_item)+'"'

var current_portrait_data: Dictionary = selected_item.get_metadata(0)
var mirror:bool = current_portrait_data.get('mirror', false) != current_resource.mirror
var scale:float = current_portrait_data.get('scale', 1) * current_resource.scale
if current_portrait_data.get('ignore_char_scale', false):
scale = current_portrait_data.get('scale', 1)
var offset:Vector2 =current_portrait_data.get('offset', Vector2()) + current_resource.offset
if current_previewed_scene != null \

if not force and current_previewed_scene != null \
and current_previewed_scene.get_meta('path', '') == current_portrait_data.get('scene') \
and current_previewed_scene.has_method('_should_do_portrait_update') \
and is_instance_valid(current_previewed_scene.get_script()) \
Expand All @@ -551,23 +549,31 @@ func update_preview() -> void:
else:
for node in %RealPreviewPivot.get_children():
node.queue_free()

current_previewed_scene = null
if current_portrait_data.get('scene', '').is_empty():
if FileAccess.file_exists(def_portrait_path):
current_previewed_scene = load(def_portrait_path).instantiate()
current_previewed_scene.set_meta('path', '')
else:
if FileAccess.file_exists(current_portrait_data.get('scene')):
current_previewed_scene = load(current_portrait_data.get('scene')).instantiate()
current_previewed_scene.set_meta('path', current_portrait_data.get('scene'))

var scene_path := def_portrait_path
if not current_portrait_data.get('scene', '').is_empty():
scene_path = current_portrait_data.get('scene')

if FileAccess.file_exists(scene_path):
current_previewed_scene = load(scene_path).instantiate()

if current_previewed_scene:
%RealPreviewPivot.add_child(current_previewed_scene)

if current_previewed_scene != null:
var scene = current_previewed_scene
var scene: Node = current_previewed_scene

scene.show_behind_parent = true
DialogicUtil.apply_scene_export_overrides(scene, current_portrait_data.get('export_overrides', {}))

var mirror: bool = current_portrait_data.get('mirror', false) != current_resource.mirror
var scale: float = current_portrait_data.get('scale', 1) * current_resource.scale
if current_portrait_data.get('ignore_char_scale', false):
scale = current_portrait_data.get('scale', 1)
var offset: Vector2 = current_portrait_data.get('offset', Vector2()) + current_resource.offset

if is_instance_valid(scene.get_script()) and scene.script.is_tool():
if scene.has_method('_update_portrait'):
## Create a fake duplicate resource that has all the portrait changes applied already
Expand All @@ -576,13 +582,14 @@ func update_preview() -> void:
scene._update_portrait(preview_character, %PortraitTree.get_full_item_name(selected_item))
if scene.has_method('_set_mirror'):
scene._set_mirror(mirror)

if !%FitPreview_Toggle.button_pressed:
scene.position = Vector2() + offset
scene.scale = Vector2(1,1)*scale
else:
if is_instance_valid(scene.get_script()) and scene.script.is_tool() and scene.has_method('_get_covered_rect'):
var rect :Rect2= scene._get_covered_rect()
var available_rect:Rect2 = %FullPreviewAvailableRect.get_rect()
var rect: Rect2= scene._get_covered_rect()
var available_rect: Rect2 = %FullPreviewAvailableRect.get_rect()
scene.scale = Vector2(1,1) * min(available_rect.size.x/rect.size.x, available_rect.size.y/rect.size.y)
%RealPreviewPivot.position = (rect.position)*-1*scene.scale
%RealPreviewPivot.position.x = %FullPreviewAvailableRect.size.x/2
Expand All @@ -601,6 +608,13 @@ func update_preview() -> void:
current_previewed_scene = null


func _on_some_resource_saved(file:Resource) -> void:
# TODO, this only works for scripts right, so check again, there might be a
# good way to listen to Scene Saves in the future.
if file.resource_path == current_previewed_scene.get_meta("path", "") or file == current_previewed_scene.script:
update_preview(true)


func _on_full_preview_available_rect_resized():
if %FitPreview_Toggle.button_pressed:
update_preview()
Expand Down
4 changes: 4 additions & 0 deletions addons/dialogic/Editor/Settings/settings_general.gd
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,7 @@ func load_game_state(load_flag:=LoadFlags.FULL_LOAD) -> void:
find_parent('EditorView').plugin_reference.get_editor_interface().get_resource_filesystem().scan_sources()
force_event_button_list_reload()



func _on_reload_pressed() -> void:
DialogicUtil.update_autoload_subsystem_access()
28 changes: 17 additions & 11 deletions addons/dialogic/Editor/Settings/settings_general.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://dbpkta2tjsqim" path="res://addons/dialogic/Editor/Common/hint_tooltip_icon.tscn" id="2_kqhx5"]
[ext_resource type="PackedScene" uid="uid://7mvxuaulctcq" path="res://addons/dialogic/Editor/Events/Fields/field_file.tscn" id="3_i7rug"]

[sub_resource type="Image" id="Image_e2a0f"]
[sub_resource type="Image" id="Image_e1gle"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
Expand All @@ -13,8 +13,8 @@ data = {
"width": 16
}

[sub_resource type="ImageTexture" id="ImageTexture_wyypx"]
image = SubResource("Image_e2a0f")
[sub_resource type="ImageTexture" id="ImageTexture_4wgbv"]
image = SubResource("Image_e1gle")

[node name="General" type="VBoxContainer"]
anchors_preset = 15
Expand All @@ -35,15 +35,15 @@ text = "Color Palette"
[node name="HintTooltip" parent="PaletteTitle" instance=ExtResource("2_kqhx5")]
layout_mode = 2
tooltip_text = "These colors are used for the events."
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "These colors are used for the events."

[node name="ResetColorsButton" type="Button" parent="PaletteTitle"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
tooltip_text = "Reset Colors to default"
icon = SubResource("ImageTexture_wyypx")
icon = SubResource("ImageTexture_4wgbv")
flat = true

[node name="ScrollContainer" type="ScrollContainer" parent="."]
Expand Down Expand Up @@ -72,7 +72,7 @@ tooltip_text = "The layout scene configured in the Layout editor is automaticall
instanced when calling Dialogic.start(). Depending on your game,
you might want it to be deleted after the dialogue, be hidden
(as reinstancing often is wasting resources) or kept visible. "
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "The layout scene configured in the Layout editor is automatically
instanced when calling Dialogic.start(). Depending on your game,
you might want it to be deleted after the dialogue, be hidden
Expand Down Expand Up @@ -121,11 +121,16 @@ layout_mode = 2
tooltip_text = "Configure where dialogic looks for custom modules.
You will have to restart the project to see the change take action."
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "Configure where dialogic looks for custom modules.
You will have to restart the project to see the change take action."

[node name="Reload" type="Button" parent="HBoxContainer6/HBoxContainer4/HBoxContainer5"]
layout_mode = 2
text = "Reload"
flat = true

[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer6/HBoxContainer4"]
layout_mode = 2

Expand All @@ -139,7 +144,7 @@ layout_mode = 2
size_flags_horizontal = 3
placeholder = "res://addons/dialogic_additions/Events"
file_mode = 2
resource_icon = SubResource("ImageTexture_wyypx")
resource_icon = SubResource("ImageTexture_4wgbv")

[node name="VSeparator" type="VSeparator" parent="HBoxContainer6"]
layout_mode = 2
Expand All @@ -164,7 +169,7 @@ text = "Extension Creator "
[node name="HintTooltip" parent="HBoxContainer6/ExtensionsPanel/VBox/HBoxContainer6" instance=ExtResource("2_kqhx5")]
layout_mode = 2
tooltip_text = "Use the Exension Creator to quickly setup custom modules!"
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "Use the Exension Creator to quickly setup custom modules!"

[node name="CreateExtensionButton" type="Button" parent="HBoxContainer6/ExtensionsPanel/VBox"]
Expand Down Expand Up @@ -228,7 +233,7 @@ text = "Timer processing"
[node name="HintTooltip" parent="HBoxContainer7" instance=ExtResource("2_kqhx5")]
layout_mode = 2
tooltip_text = "Change whether dialogics timers process in physics_process (frame-rate independent) or process."
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "Change whether dialogics timers process in physics_process (frame-rate independent) or process."

[node name="HBoxContainer4" type="HBoxContainer" parent="."]
Expand Down Expand Up @@ -256,7 +261,7 @@ text = "Section Order"
[node name="HintTooltip" parent="HBoxContainer" instance=ExtResource("2_kqhx5")]
layout_mode = 2
tooltip_text = "You can change the order of the event sections here. "
texture = SubResource("ImageTexture_wyypx")
texture = SubResource("ImageTexture_4wgbv")
hint_text = "You can change the order of the event sections here. "

[node name="SectionList" type="Tree" parent="."]
Expand All @@ -272,6 +277,7 @@ hide_root = true
drop_mode_flags = 1

[connection signal="item_selected" from="HBoxContainer3/LayoutNodeEndBehaviour" to="." method="_on_layout_node_end_behaviour_item_selected"]
[connection signal="pressed" from="HBoxContainer6/HBoxContainer4/HBoxContainer5/Reload" to="." method="_on_reload_pressed"]
[connection signal="pressed" from="HBoxContainer6/ExtensionsPanel/VBox/CreateExtensionButton" to="." method="_on_create_extension_button_pressed"]
[connection signal="pressed" from="HBoxContainer6/ExtensionsPanel/VBox/ExtensionCreator/SubmitExtensionButton" to="." method="_on_submit_extension_button_pressed"]
[connection signal="button_clicked" from="SectionList" to="." method="_on_section_list_button_clicked"]
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func _input(event:InputEvent) -> void:
if (event is InputEventMouseButton
and event.is_pressed()
and event.button_index == MOUSE_BUTTON_MIDDLE):
var auto_skip: DialogicAutoSkip = DialogicUtil.autoload().Input.auto_skip
var auto_skip: DialogicAutoSkip = DialogicUtil.autoload().Inputs.auto_skip
var is_auto_skip_enabled := auto_skip.enabled

auto_skip.disable_on_unread_text = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func _update_portrait(passed_character:DialogicCharacter, passed_portrait:String


func _ready() -> void:
self.modulate = unhighlighted_color
if not Engine.is_editor_hint():
self.modulate = unhighlighted_color


func _highlight():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ func tween_shader_progress(progress_parameter:="progress") -> PropertyTweener:

bg_holder.material.set_shader_parameter("progress", 0.0)
var tween := create_tween()
var tweener := tween.tween_property(bg_holder, "material:shader_parameter/progress", 1.0, time)
var tweener := tween.tween_property(bg_holder, "material:shader_parameter/progress", 1.0, time).from(0.0)
tween.tween_callback(emit_signal.bind('transition_finished'))
return tweener
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Background/event_background.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ var _scene_type := SceneTypes.DEFAULT :
func _execute() -> void:
var final_fade_duration := fade

if dialogic.Input.auto_skip.enabled:
var time_per_event: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
final_fade_duration = min(fade, time_per_event)

dialogic.Backgrounds.update_background(scene, argument, final_fade_duration, transition)
Expand Down
Loading

0 comments on commit 17b0bb0

Please sign in to comment.