Skip to content

Commit d4729da

Browse files
committed
latest before video
1 parent a7a030d commit d4729da

File tree

5 files changed

+46
-35
lines changed

5 files changed

+46
-35
lines changed

addons/dialogic/Editor/EditorView.tscn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ __meta__ = {
488488
"_edit_use_anchors_": false
489489
}
490490

491-
[node name="AudioPreview" type="AudioStreamPlayer2D" parent="."]
491+
[node name="AudioPreview" type="AudioStreamPlayer" parent="."]
492492
[connection signal="pressed" from="HBoxContainer/EventButton" to="." method="_on_EventButton_pressed"]
493493
[connection signal="pressed" from="HBoxContainer/CharactersButton" to="." method="_on_CharactersButton_pressed"]
494494
[connection signal="pressed" from="HBoxContainer/ButtonSave" to="." method="_on_ButtonSave_pressed"]
@@ -510,3 +510,4 @@ __meta__ = {
510510
[connection signal="pressed" from="Editor/CharacterEditor/HBoxContainer/Container/Actions/DeleteButton" to="." method="_on_DeleteButton_pressed"]
511511
[connection signal="confirmed" from="RemoveConfirmation" to="." method="_on_RemoveConfirmation_confirmed"]
512512
[connection signal="confirmed" from="RenameDialog" to="." method="_on_RenameDialog_confirmed"]
513+
[connection signal="finished" from="AudioPreview" to="." method="_on_AudioPreview_finished"]

addons/dialogic/Editor/Pieces/AudioBlock.gd

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ extends PanelContainer
44
var editor_reference
55
var editorPopup
66

7-
var play_button_state = 'stopped'
7+
var play_icon = load("res://addons/dialogic/Images/play.svg")
8+
var stop_icon = load("res://addons/dialogic/Images/stop.svg")
89

910
# This is the information of this event and it will get parsed and saved to the JSON file.
1011
var event_data = {
1112
'audio': 'play',
1213
'file': ''
1314
}
1415

15-
func _ready():
16+
func _ready():
1617
$VBoxContainer/Header/VisibleToggle.disabled()
1718

1819

@@ -22,31 +23,30 @@ func _on_ButtonAudio_pressed():
2223
editor_reference.godot_dialog_connect(self, "_on_file_selected")
2324

2425
func _on_file_selected(path, target):
25-
print('load_audio', path, target)
26+
print('[Dialogic] Loading audio block ', path, target)
2627
target.load_audio(path)
2728

2829
func load_audio(path):
29-
$VBoxContainer/Header/Title.text = path
30+
$VBoxContainer/Header/Name.text = path
3031
$VBoxContainer/Header/ButtonPreviewPlay.disabled = false
3132
event_data['file'] = path
32-
print(path)
3333

3434

3535
func load_data(data):
3636
event_data = data
3737
if data['file'] != '':
3838
load_audio(data['file'])
39-
40-
func _on_ButtonPreviewPlay_pressed():
41-
print(editor_reference.get_node("AudioPreview"))
4239

43-
# It seems like you can't play audio on the editor.
44-
if play_button_state == 'playing':
45-
editor_reference.get_node("AudioPreview").stop()
46-
play_button_state == 'stopped'
40+
func _on_ButtonPreviewPlay_pressed():
41+
print('[Dialogic] Playing audio ' + event_data['file'])
42+
if $AudioPreview.is_playing():
43+
$AudioPreview.stop()
4744
else:
48-
var audio_preview = editor_reference.get_node("AudioPreview")
49-
var audio_file = load(event_data['file'])
50-
audio_preview.stream = audio_file
51-
editor_reference.get_node("AudioPreview").play()
52-
play_button_state == 'playing'
45+
$AudioPreview.stream = load(event_data['file'])
46+
$AudioPreview.play()
47+
$VBoxContainer/Header/ButtonPreviewPlay.icon = stop_icon
48+
49+
50+
51+
func _on_AudioPreview_finished():
52+
$VBoxContainer/Header/ButtonPreviewPlay.icon = play_icon

addons/dialogic/Editor/Pieces/AudioBlock.tscn

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,21 @@ margin_right = 117.0
5656
margin_bottom = 22.0
5757
text = " Audio "
5858

59-
[node name="ButtonAudio" type="Button" parent="VBoxContainer/Header"]
59+
[node name="Name" type="Label" parent="VBoxContainer/Header"]
6060
margin_left = 121.0
61-
margin_right = 145.0
61+
margin_top = 8.0
62+
margin_right = 121.0
63+
margin_bottom = 22.0
64+
65+
[node name="ButtonAudio" type="Button" parent="VBoxContainer/Header"]
66+
margin_left = 125.0
67+
margin_right = 149.0
6268
margin_bottom = 30.0
6369
text = "..."
6470

6571
[node name="ButtonPreviewPlay" type="Button" parent="VBoxContainer/Header"]
66-
margin_left = 149.0
67-
margin_right = 183.0
72+
margin_left = 153.0
73+
margin_right = 187.0
6874
margin_bottom = 30.0
6975
disabled = true
7076
icon = ExtResource( 5 )
@@ -79,12 +85,15 @@ custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
7985
text = " ..."
8086

8187
[node name="Spacer" type="Control" parent="VBoxContainer/Header"]
82-
margin_left = 187.0
88+
margin_left = 191.0
8389
margin_right = 1745.0
8490
margin_bottom = 30.0
8591
size_flags_horizontal = 3
8692

8793
[node name="OptionButton" parent="VBoxContainer/Header" instance=ExtResource( 4 )]
8894
items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
95+
96+
[node name="AudioPreview" type="AudioStreamPlayer" parent="."]
8997
[connection signal="pressed" from="VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
9098
[connection signal="pressed" from="VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
99+
[connection signal="finished" from="AudioPreview" to="." method="_on_AudioPreview_finished"]

addons/dialogic/Editor/Pieces/SceneBlock.tscn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ stretch_mode = 6
5050
[node name="Title" type="Label" parent="VBoxContainer/Header"]
5151
margin_left = 60.0
5252
margin_top = 8.0
53-
margin_right = 145.0
53+
margin_right = 165.0
5454
margin_bottom = 22.0
55-
text = " Scene Block"
55+
text = " Scene settings "
5656

5757
[node name="Preview" type="Label" parent="VBoxContainer/Header"]
5858
visible = false
@@ -64,7 +64,7 @@ custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
6464
text = " ..."
6565

6666
[node name="Spacer" type="Control" parent="VBoxContainer/Header"]
67-
margin_left = 149.0
67+
margin_left = 169.0
6868
margin_right = 1745.0
6969
margin_bottom = 30.0
7070
mouse_filter = 1

addons/dialogic/Editor/editor_view.gd

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,16 @@ func load_nodes(path):
199199
func get_dialog_list():
200200
var dialogs = []
201201
for file in listdir(DIALOG_DIR):
202-
var color = Color("#ffffff")
203-
dialogs.append({'name':file.split('.')[0], 'color': color, 'file': file })
204-
#var data = load_json(DIALOG_DIR + '/' + file)
205-
#if data.has('color'):
206-
# color = Color('#' + data['color'])
207-
#if data.has('name'):
208-
# characters.append({'name':data['name'], 'color': color, 'file': file })
209-
#else:
210-
# characters.append({'name':data['id'], 'color': color, 'file': file })
202+
if '.json' in file:
203+
var color = Color("#ffffff")
204+
dialogs.append({'name':file.split('.')[0], 'color': color, 'file': file })
205+
#var data = load_json(DIALOG_DIR + '/' + file)
206+
#if data.has('color'):
207+
# color = Color('#' + data['color'])
208+
#if data.has('name'):
209+
# characters.append({'name':data['name'], 'color': color, 'file': file })
210+
#else:
211+
# characters.append({'name':data['id'], 'color': color, 'file': file })
211212
return dialogs
212213

213214
func refresh_dialog_list():

0 commit comments

Comments
 (0)