Skip to content

Commit d76cf79

Browse files
Huge layout/style update (#1685)
* Huge layout/style update This new update allows configuring multiple styles: - each style is a combination of a layout scene (can be a preset) and export overrides. - styles can inherit settings and layout from other styles - styles can be used with Dialogic.Style.add_layout_style() or the character style or the change style event Also big changes to the layout editor have happened. Also renamed the DefaultStyles folder to DefaultLayouts as I finally decided on one naming system: - Layout = the scene that contains the nodes (whether preset or custom) - Style = the named combination of a layout with specific settings * Fixes and improvements * Improve UI and functionality * Remove error & add Clear All settings button * Fix style switching * Fix speaker mode error for characters without portraits
1 parent af9730b commit d76cf79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1327
-1367
lines changed

addons/dialogic/Editor/Events/Fields/ComplexPicker.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var get_suggestions_func : Callable = get_default_suggestions
1616
var empty_text : String = ""
1717
@export var enable_pretty_name : bool = false
1818
@export var fit_text_length : bool = true
19+
var force_string := false
1920

2021
var resource_icon : Texture = null:
2122
get:
@@ -57,7 +58,7 @@ func set_value(value:Variant, text : String = '') -> void:
5758

5859

5960
func changed_to_empty() -> void:
60-
if file_extension != "" && file_extension != ".dch":
61+
if file_extension != "" and file_extension != ".dch" and !force_string:
6162
emit_signal("value_changed", property_name, null)
6263
else:
6364
emit_signal("value_changed", property_name, "")

addons/dialogic/Editor/TimelineEditor/test_timeline_scene.gd

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ func _ready() -> void:
55
if !ProjectSettings.get_setting('internationalization/locale/test', "").is_empty():
66
print("Testing locale is: ", ProjectSettings.get_setting('internationalization/locale/test'))
77
$PauseIndictator.hide()
8-
var dialog_scene_path: String = ProjectSettings.get_setting(
9-
'dialogic/layout/layout_scene',
10-
DialogicUtil.get_default_layout()
11-
)
12-
var scene: Node = load(dialog_scene_path).instantiate()
13-
DialogicUtil.apply_scene_export_overrides(scene, ProjectSettings.get_setting('dialogic/layout/export_overrides', {}))
14-
add_child(scene)
8+
9+
var scene: Node = Dialogic.Styles.add_layout_style(DialogicUtil.get_editor_setting('current_test_style', ''))
1510
if not scene is CanvasLayer:
1611
if scene is Control:
1712
scene.position = get_viewport_rect().size/2.0
@@ -20,7 +15,7 @@ func _ready() -> void:
2015

2116
randomize()
2217
var current_timeline: String = DialogicUtil.get_editor_setting('current_timeline_path')
23-
Dialogic.start_timeline(current_timeline)
18+
Dialogic.start(current_timeline)
2419
Dialogic.timeline_ended.connect(get_tree().quit)
2520
Dialogic.signal_event.connect(recieve_event_signal)
2621
Dialogic.text_signal.connect(recieve_text_signal)

addons/dialogic/Editor/editor_main.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ func update_theme_additions():
4848
theme.set_type_variation('DialogicTitle', 'Label')
4949
theme.set_font('font', 'DialogicTitle', get_theme_font("title", "EditorFonts"))
5050
theme.set_color('font_color', 'DialogicTitle', get_theme_color('warning_color', 'Editor'))
51+
theme.set_color('font_uneditable_color', 'DialogicTitle', get_theme_color('warning_color', 'Editor'))
52+
theme.set_color('font_selected_color', 'DialogicTitle', get_theme_color('warning_color', 'Editor'))
5153
theme.set_font_size('font_size', 'DialogicTitle', get_theme_font_size("doc_size", "EditorFonts"))
5254

5355
theme.set_type_variation('DialogicSubTitle', 'Label')
@@ -70,6 +72,9 @@ func update_theme_additions():
7072
dark_panel.bg_color = get_theme_color("dark_color_3", "Editor")
7173
theme.set_stylebox('panel', 'DialogicPanelDarkA', dark_panel)
7274

75+
var cornerless_panel := panel_style.duplicate()
76+
cornerless_panel.corner_radius_top_left = 0
77+
theme.set_stylebox('panel', 'DialogicPanelA_cornerless', cornerless_panel)
7378

7479

7580
# panel used for example for portrait previews in character editor

addons/dialogic/Modules/Character/subsystem_portraits.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,23 +508,24 @@ func change_speaker(speaker:DialogicCharacter= null, portrait:= ""):
508508
if character_node.get_meta('character') != speaker:
509509
_remove_portrait(character_node)
510510

511-
if speaker == null:
511+
if speaker == null or speaker.portraits.is_empty():
512512
continue
513513

514514
if con.get_children().is_empty():
515515
_create_character_node(speaker, con)
516516
elif portrait.is_empty():
517-
return
517+
continue
518518

519519
if portrait.is_empty(): portrait = speaker.default_portrait
520+
520521
if con.portrait_prefix+portrait in speaker.portraits:
521522
_change_portrait(con.get_child(0), con.portrait_prefix+portrait)
522523
else:
523524
_change_portrait(con.get_child(0), portrait)
524525

525526
# if the character has no portraits _change_portrait won't actually add a child node
526527
if con.get_child(0).get_child_count() == 0:
527-
return
528+
continue
528529

529530
_change_portrait_mirror(con.get_child(0))
530531

addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.tscn renamed to addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.tscn

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
[gd_scene load_steps=31 format=3 uid="uid://uan2wdyuprb6"]
1+
[gd_scene load_steps=30 format=3 uid="uid://uan2wdyuprb6"]
22

3-
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultStyles/Default/DialogicDefaultLayout.gd" id="1"]
3+
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd" id="1"]
44
[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_dialog_text.gd" id="2"]
55
[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_name_label.gd" id="3"]
66
[ext_resource type="Script" path="res://addons/dialogic/Modules/Character/node_portrait_container.gd" id="3_dbhei"]
77
[ext_resource type="Script" path="res://addons/dialogic/Modules/Choice/node_choice_button.gd" id="4"]
88
[ext_resource type="Script" path="res://addons/dialogic/Modules/Background/node_background_holder.gd" id="5_uvb2c"]
99
[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_type_sound.gd" id="10"]
1010
[ext_resource type="AudioStream" uid="uid://c2viukvbub6v6" path="res://addons/dialogic/Example Assets/sound-effects/typing4.wav" id="11"]
11-
[ext_resource type="Script" path="res://addons/dialogic/Modules/Style/node_style.gd" id="12"]
1211
[ext_resource type="AudioStream" uid="uid://dwcre3fjf3cj8" path="res://addons/dialogic/Example Assets/sound-effects/typing5.wav" id="13"]
1312
[ext_resource type="AudioStream" uid="uid://b6c1p14bc20p1" path="res://addons/dialogic/Example Assets/sound-effects/typing1.wav" id="14"]
14-
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultStyles/Default/autoadvance_indicator.gd" id="15_ptoy3"]
15-
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultStyles/Default/animations.gd" id="16_07l6b"]
13+
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/Default/autoadvance_indicator.gd" id="15_ptoy3"]
14+
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/Default/animations.gd" id="16_07l6b"]
1615
[ext_resource type="Script" path="res://addons/dialogic/Modules/Choice/node_button_sound.gd" id="18"]
1716
[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_next_indicator.gd" id="20_ljcq2"]
18-
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultStyles/Default/ExampleGlossaryPopup.gd" id="20_vmnp2"]
19-
[ext_resource type="PackedScene" path="res://addons/dialogic/Modules/DefaultStyles/ExampleHistoryScene.tscn" id="22_854kg"]
17+
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/Default/ExampleGlossaryPopup.gd" id="20_vmnp2"]
18+
[ext_resource type="PackedScene" path="res://addons/dialogic/Modules/DefaultLayouts/ExampleHistoryScene.tscn" id="22_854kg"]
2019
[ext_resource type="Script" path="res://addons/dialogic/Modules/TextInput/node_text_input.gd" id="22_ltkcf"]
21-
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultStyles/HideWithChild.gd" id="23"]
20+
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/HideWithChild.gd" id="23"]
2221
[ext_resource type="FontFile" uid="uid://vrrmdx83skor" path="res://addons/dialogic/Example Assets/Fonts/Roboto-Regular.ttf" id="23_gyqve"]
2322
[ext_resource type="FontFile" uid="uid://cc4xli25271fd" path="res://addons/dialogic/Example Assets/Fonts/Roboto-Bold.ttf" id="24_aa4pl"]
2423
[ext_resource type="FontFile" uid="uid://b5c0p00x6g6u5" path="res://addons/dialogic/Example Assets/Fonts/Roboto-Italic.ttf" id="25_wt3bc"]
@@ -301,7 +300,6 @@ anchor_bottom = 1.0
301300
grow_horizontal = 2
302301
grow_vertical = 2
303302
mouse_filter = 2
304-
script = ExtResource("12")
305303

306304
[node name="Animations" type="AnimationPlayer" parent="DefaultStyle"]
307305
autoplay = "RESET"

addons/dialogic/Modules/DefaultStyles/Default/animations.gd renamed to addons/dialogic/Modules/DefaultLayouts/Default/animations.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func _on_textbox_hide():
2626

2727
func _on_textbox_new_text():
2828
Dialogic.Animation.start_animating()
29+
%DialogicNode_DialogText.text = ""
2930
play("new_text")
3031
if not animation_finished.is_connected(Dialogic.Animation.animation_finished):
3132
animation_finished.connect(Dialogic.Animation.animation_finished, CONNECT_ONE_SHOT)

0 commit comments

Comments
 (0)