Add addons

This commit is contained in:
Joey Yakimowich-Payne 2023-01-03 16:53:53 -07:00
commit 3367bad24f
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
527 changed files with 36197 additions and 0 deletions

View file

@ -0,0 +1,93 @@
@tool
extends DialogicCharacterEditorMainTab
## Character editor tab that allows editing typing sound moods.
################################################################################
## COMMUNICATION WITH EDITOR
################################################################################
func _load_character(character:DialogicCharacter):
for mood in %Moods.get_children():
mood.queue_free()
%PortraitMood.set_value('')
%DefaultMood.set_value(character.custom_info.get('sound_moods_default', ''))
for mood in character.custom_info.get('sound_moods', {}):
create_mood_item(character.custom_info.sound_moods[mood])
func _save_changes(character:DialogicCharacter) -> DialogicCharacter:
var moods := {}
for node in %Moods.get_children():
moods[node.get_data().name] = node.get_data()
character.custom_info['sound_mood_default'] = %DefaultMood.current_value
character.custom_info['sound_moods'] = moods
return character
func get_portrait_data() -> Dictionary:
if character_editor.selected_item and is_instance_valid(character_editor.selected_item):
return character_editor.selected_item.get_metadata(0)
return {}
func set_portrait_data(data:Dictionary) -> void:
if character_editor.selected_item and is_instance_valid(character_editor.selected_item):
character_editor.selected_item.set_metadata(0, data)
func _ready():
character_editor.portrait_selected.connect(_on_portrait_selected)
%PortraitMood.get_suggestions_func = mood_suggestions
%DefaultMood.get_suggestions_func = mood_suggestions
func _on_portrait_selected(portrait_name:String, data:Dictionary) -> void:
%PortraitMood.set_value(data.get('sound_mood', ''))
%PortraitMoodLabel.text = 'Mood for "%s":'%portrait_name
################################################################################
## OWN STUFF
################################################################################
func _on_AddMood_pressed() -> void:
create_mood_item({})
changed.emit()
func create_mood_item(data:Dictionary) -> void:
var new_mood = load(get_script().resource_path.get_base_dir().path_join('ui_mood_item.tscn')).instantiate()
%Moods.add_child(new_mood)
new_mood.load_data(data)
new_mood.duplicate.connect(duplicate_mood_item.bind(new_mood))
new_mood.changed.connect(emit_signal.bind('changed'))
func duplicate_mood_item(item:Control) -> void:
changed.emit()
create_mood_item(item.get_data())
func mood_suggestions(filter:String) -> Dictionary:
var suggestions := {}
for child in %Moods.get_children():
suggestions[child.get_data().name] = {'value':child.get_data().name}
return suggestions
func _on_PortraitMood_value_changed(property_name:String, value:Variant):
var data: Dictionary = get_portrait_data()
data['sound_mood'] = value
set_portrait_data(data)
changed.emit()
func _on_default_mood_value_changed(property_name:String, value:Variant):
var data: Dictionary = get_portrait_data()
data['sound_mood_default'] = value
set_portrait_data(data)
changed.emit()

View file

@ -0,0 +1,86 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="Script" path="res://addons/dialogic/Events/Text/character_settings/character_settings_text.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://dpwhshre1n4t6" path="res://addons/dialogic/Editor/Events/Fields/ComplexPicker.tscn" id="2"]
[node name="TypingSounds" type="VBoxContainer"]
custom_minimum_size = Vector2(0, 130)
offset_right = 443.0
offset_bottom = 100.0
size_flags_vertical = 3
script = ExtResource("1")
[node name="DefaultMood" type="HBoxContainer" parent="."]
offset_right = 315.0
offset_bottom = 33.0
size_flags_horizontal = 0
[node name="DefaultMoodLabel" type="Label" parent="DefaultMood"]
offset_top = 3.0
offset_right = 111.0
offset_bottom = 29.0
size_flags_horizontal = 3
text = "Default mood:"
[node name="DefaultMood" parent="DefaultMood" instance=ExtResource("2")]
unique_name_in_owner = true
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 115.0
offset_right = 315.0
offset_bottom = 33.0
placeholder_text = "Select Mood"
[node name="PortraitMood" type="HBoxContainer" parent="."]
offset_top = 37.0
offset_right = 325.0
offset_bottom = 70.0
size_flags_horizontal = 0
[node name="PortraitMoodLabel" type="Label" parent="PortraitMood"]
unique_name_in_owner = true
offset_top = 3.0
offset_right = 121.0
offset_bottom = 29.0
size_flags_horizontal = 3
text = "Mood for \"sad\":"
[node name="PortraitMood" parent="PortraitMood" instance=ExtResource("2")]
unique_name_in_owner = true
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 125.0
offset_right = 325.0
offset_bottom = 33.0
placeholder_text = "Select Mood"
[node name="HBoxContainer" type="HBoxContainer" parent="."]
offset_top = 74.0
offset_right = 443.0
offset_bottom = 105.0
alignment = 2
[node name="AddMood" type="Button" parent="HBoxContainer"]
unique_name_in_owner = true
offset_left = 355.0
offset_right = 443.0
offset_bottom = 31.0
text = "Add mood"
[node name="ScrollContainer" type="ScrollContainer" parent="."]
offset_top = 109.0
offset_right = 443.0
offset_bottom = 130.0
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="Moods" type="VBoxContainer" parent="ScrollContainer"]
unique_name_in_owner = true
offset_right = 443.0
offset_bottom = 21.0
size_flags_horizontal = 3
size_flags_vertical = 3
[connection signal="value_changed" from="DefaultMood/DefaultMood" to="." method="_on_default_mood_value_changed"]
[connection signal="value_changed" from="PortraitMood/PortraitMood" to="." method="_on_PortraitMood_value_changed"]
[connection signal="pressed" from="HBoxContainer/AddMood" to="." method="_on_AddMood_pressed"]

View file

@ -0,0 +1,81 @@
@tool
extends PanelContainer
signal duplicate
signal changed
func _ready():
add_theme_stylebox_override('panel', get_theme_stylebox("sub_inspector_bg12", "Editor"))
%Name.tooltip_text = "Mood name"
%Duplicate.icon = get_theme_icon("Duplicate", "EditorIcons")
%Duplicate.tooltip_text = "Duplicate"
%Duplicate.button_up.connect(emit_signal.bind("duplicate"))
%Delete.icon = get_theme_icon("Remove", "EditorIcons")
%Delete.tooltip_text = "Delete"
%ChangeSoundFolderButton.icon = get_theme_icon("Folder", "EditorIcons")
%ChangeSoundFolderButton.tooltip_text = "Change sounds folder"
%Fold.icon = get_theme_icon("GuiVisibilityVisible", "EditorIcons")
%Fold.tooltip_text = "Fold/Unfold"
%Play.icon = get_theme_icon("Play", "EditorIcons")
%Play.tooltip_text = "Preview"
_on_Fold_toggled(true)
%Name.text_changed.connect(something_changed)
%PitchBase.value_changed.connect(something_changed)
%PitchVariance.value_changed.connect(something_changed)
%VolumeBase.value_changed.connect(something_changed)
%VolumeVariance.value_changed.connect(something_changed)
func load_data(dict:Dictionary):
%Name.text = dict.get('name', '')
%SoundFolder.text = dict.get('sound_folder', '').get_file()
%SoundFolder.tooltip_text = dict.get('sound_folder', '')
%PitchBase.value = dict.get('pitch_base', 1)
%PitchVariance.value = dict.get('pitch_variance', 0)
%VolumeBase.value = dict.get('volume_base', 0)
%VolumeVariance.value = dict.get('volume_variance', 0)
func get_data():
var dict = {}
dict['name'] = %Name.text
dict['sound_folder'] = %SoundFolder.tooltip_text
dict['pitch_base'] = %PitchBase.value
dict['pitch_variance'] = %PitchVariance.value
dict['volume_base'] = %VolumeBase.value
dict['volume_variance'] = %VolumeVariance.value
return dict
func something_changed(fake_arg= ''): emit_signal("changed")
func _on_Fold_toggled(button_pressed):
%Fold.button_pressed = button_pressed
if button_pressed:
%Fold.icon = get_theme_icon("GuiVisibilityHidden", "EditorIcons")
else:
%Fold.icon = get_theme_icon("GuiVisibilityVisible", "EditorIcons")
%Content.visible = !button_pressed
func _on_Delete_pressed():
emit_signal("changed")
queue_free()
func open_file_folder_dialog():
find_parent('EditorView').godot_file_dialog(file_folder_selected, '', EditorFileDialog.FILE_MODE_OPEN_DIR, 'Select folder with sounds')
func file_folder_selected(path):
%SoundFolder.tooltip_text = path
%SoundFolder.text = path.get_file()
emit_signal("changed")
func preview():
if %SoundFolder.tooltip_text.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):
$DialogicNode_TypeSounds._on_continued_revealing_text("a")
await preview_timer.timeout
preview_timer.queue_free()

View file

@ -0,0 +1,157 @@
[gd_scene load_steps=6 format=3 uid="uid://x8alx74fnm10"]
[ext_resource type="Script" path="res://addons/dialogic/Events/Text/character_settings/ui_mood_item.gd" id="2"]
[ext_resource type="Script" path="res://addons/dialogic/Events/Text/node_type_sound.gd" id="3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rsmy0"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 0.365, 0.365, 1)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_detail = 1
[sub_resource type="Image" id="Image_uegt4"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_osvex"]
image = SubResource("Image_uegt4")
[node name="MoodItem" type="PanelContainer"]
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_rsmy0")
script = ExtResource("2")
[node name="VBox" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="General" type="HBoxContainer" parent="VBox"]
layout_mode = 2
[node name="Name" type="LineEdit" parent="VBox/General"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "Mood name"
caret_blink = true
[node name="Play" type="Button" parent="VBox/General"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Preview"
icon = SubResource("ImageTexture_osvex")
[node name="Duplicate" type="Button" parent="VBox/General"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Duplicate"
icon = SubResource("ImageTexture_osvex")
[node name="Delete" type="Button" parent="VBox/General"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Delete"
icon = SubResource("ImageTexture_osvex")
[node name="Fold" type="Button" parent="VBox/General"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Fold/Unfold"
toggle_mode = true
button_pressed = true
icon = SubResource("ImageTexture_osvex")
[node name="Content" type="HBoxContainer" parent="VBox"]
unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="Control" type="Control" parent="VBox/Content"]
layout_mode = 2
[node name="Content" type="VBoxContainer" parent="VBox/Content"]
layout_mode = 2
size_flags_horizontal = 3
[node name="SoundFolderSect" type="HBoxContainer" parent="VBox/Content/Content"]
layout_mode = 2
[node name="Label" type="Label" parent="VBox/Content/Content/SoundFolderSect"]
layout_mode = 2
size_flags_horizontal = 3
text = "Sounds folder"
[node name="SoundFolder" type="Label" parent="VBox/Content/Content/SoundFolderSect"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 2
[node name="ChangeSoundFolderButton" type="Button" parent="VBox/Content/Content/SoundFolderSect"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Change sounds folder"
icon = SubResource("ImageTexture_osvex")
[node name="Pitch" type="HBoxContainer" parent="VBox/Content/Content"]
layout_mode = 2
[node name="Label2" type="Label" parent="VBox/Content/Content/Pitch"]
layout_mode = 2
size_flags_horizontal = 3
text = "Pitch"
[node name="PitchBase" type="SpinBox" parent="VBox/Content/Content/Pitch"]
unique_name_in_owner = true
layout_mode = 2
step = 0.001
value = 1.0
[node name="PitchVariance" type="SpinBox" parent="VBox/Content/Content/Pitch"]
unique_name_in_owner = true
layout_mode = 2
step = 0.001
prefix = "+/-"
[node name="Volume" type="HBoxContainer" parent="VBox/Content/Content"]
layout_mode = 2
[node name="Label3" type="Label" parent="VBox/Content/Content/Volume"]
layout_mode = 2
size_flags_horizontal = 3
text = "Volume"
[node name="VolumeBase" type="SpinBox" parent="VBox/Content/Content/Volume"]
unique_name_in_owner = true
layout_mode = 2
min_value = -80.0
step = 0.001
suffix = "db"
[node name="VolumeVariance" type="SpinBox" parent="VBox/Content/Content/Volume"]
unique_name_in_owner = true
layout_mode = 2
step = 0.001
prefix = "+/-"
[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="."]
script = ExtResource("3")
sounds = []
play_every_character = 0
[connection signal="pressed" from="VBox/General/Play" to="." method="preview"]
[connection signal="pressed" from="VBox/General/Duplicate" to="." method="_on_Duplicate_pressed"]
[connection signal="pressed" from="VBox/General/Delete" to="." method="_on_Delete_pressed"]
[connection signal="toggled" from="VBox/General/Fold" to="." method="_on_Fold_toggled"]
[connection signal="pressed" from="VBox/Content/Content/SoundFolderSect/ChangeSoundFolderButton" to="." method="open_file_folder_dialog"]