Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bug fixes #1622

Merged
merged 5 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extends DialogicCharacterEditorMainSection

## The general portrait settings section

var loading := false

func _ready() -> void:
# Connecting all necessary signals
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -236,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"]
Expand Down Expand Up @@ -315,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

Expand Down Expand Up @@ -365,10 +367,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

Expand Down
5 changes: 4 additions & 1 deletion addons/dialogic/Modules/Text/node_dialog_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand All @@ -33,6 +34,8 @@ func _ready() -> void:
add_to_group('dialogic_dialog_text')

bbcode_enabled = true
if start_hidden:
textbox_root.hide()
text = ""


Expand Down
4 changes: 4 additions & 0 deletions addons/dialogic/Modules/Text/subsystem_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/TextInput/event_text_input.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Voice/event_voice.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()')
9 changes: 7 additions & 2 deletions addons/dialogic/Other/DialogicGameHandler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -477,8 +478,12 @@ 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 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
Expand Down Expand Up @@ -527,6 +532,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