Skip to content

Commit

Permalink
Make left_text and right_text arguments part of info-dict (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Aug 29, 2023
1 parent 63830bc commit dce37b8
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 96 deletions.
13 changes: 7 additions & 6 deletions addons/dialogic/Modules/Audio/event_music.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('file_path', ValueType.FILE, 'Play', '',
{'file_filter' : "*.mp3, *.ogg, *.wav; Supported Audio Files",
add_header_edit('file_path', ValueType.FILE, {
'left_text' : 'Play',
'file_filter' : "*.mp3, *.ogg, *.wav; Supported Audio Files",
'placeholder' : "No music",
'editor_icon' : ["AudioStreamPlayer", "EditorIcons"]})
add_body_edit('fade_length', ValueType.FLOAT, 'Fade Time:')
add_body_edit('volume', ValueType.DECIBEL, 'Volume:', '', {}, '!file_path.is_empty()')
add_body_edit('audio_bus', ValueType.SINGLELINE_TEXT, 'Audio Bus:', '', {}, '!file_path.is_empty()')
add_body_edit('loop', ValueType.BOOL, 'Loop:', '', {}, '!file_path.is_empty()')
add_body_edit('fade_length', ValueType.FLOAT, {'left_text':'Fade Time:'})
add_body_edit('volume', ValueType.DECIBEL, {'left_text':'Volume:'}, '!file_path.is_empty()')
add_body_edit('audio_bus', ValueType.SINGLELINE_TEXT, {'left_text':'Audio Bus:'}, '!file_path.is_empty()')
add_body_edit('loop', ValueType.BOOL, {'left_text':'Loop:'}, '!file_path.is_empty()')


func get_bus_suggestions() -> Dictionary:
Expand Down
9 changes: 5 additions & 4 deletions addons/dialogic/Modules/Audio/event_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('file_path', ValueType.FILE, 'Play', '',
{'file_filter' : '*.mp3, *.ogg, *.wav; Supported Audio Files',
add_header_edit('file_path', ValueType.FILE,
{'left_text' : 'Play',
'file_filter' : '*.mp3, *.ogg, *.wav; Supported Audio Files',
'placeholder' : "Select file",
'editor_icon' : ["AudioStreamPlayer", "EditorIcons"]})
add_body_edit('volume', ValueType.DECIBEL, 'Volume:', '', {}, '!file_path.is_empty()')
add_body_edit('audio_bus', ValueType.SINGLELINE_TEXT, 'Audio Bus:', '', {}, '!file_path.is_empty()')
add_body_edit('volume', ValueType.DECIBEL, {'left_text':'Volume:'}, '!file_path.is_empty()')
add_body_edit('audio_bus', ValueType.SINGLELINE_TEXT, {'left_text':'Audio Bus:'}, '!file_path.is_empty()')

func get_bus_suggestions() -> Dictionary:
var bus_name_list := {}
Expand Down
14 changes: 8 additions & 6 deletions addons/dialogic/Modules/Background/event_background.gd
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('argument', ValueType.FILE, 'Show', '',
{'file_filter':'*.jpg, *.jpeg, *.png, *.webp, *.tga, *svg, *.bmp, *.dds, *.exr, *.hdr; Supported Image Files',
add_header_edit('argument', ValueType.FILE,
{'left_text' : 'Show',
'file_filter':'*.jpg, *.jpeg, *.png, *.webp, *.tga, *svg, *.bmp, *.dds, *.exr, *.hdr; Supported Image Files',
'placeholder': "No background",
'editor_icon':["Image", "EditorIcons"]},
'scene == ""')
add_header_edit('argument', ValueType.SINGLELINE_TEXT, 'Argument:', '', {}, 'scene != ""')
add_body_edit("fade", ValueType.FLOAT, "Fade Time: ")
add_body_edit("scene", ValueType.FILE, 'Scene:', '',
{'file_filter':'*.tscn, *.scn; Scene Files',
add_header_edit('argument', ValueType.SINGLELINE_TEXT, {'left_text':'Argument:'}, 'scene != ""')
add_body_edit("fade", ValueType.FLOAT, {'left_text':'Fade Time:'})
add_body_edit("scene", ValueType.FILE,
{'left_text' :'Scene:',
'file_filter':'*.tscn, *.scn; Scene Files',
'placeholder': "Default scene",
'editor_icon':["PackedScene", "EditorIcons"]})
14 changes: 7 additions & 7 deletions addons/dialogic/Modules/CallNode/event_call_node.gd
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('method', ValueType.SINGLELINE_TEXT, 'Call method')
add_header_edit('path', ValueType.SINGLELINE_TEXT, 'in object')
add_body_edit('inline', ValueType.BOOL, 'Inline Command:', '', {'tooltip':"If enabled, the method won't be called instantly. Only when a signal is emmited inside the following text event will it be called."})
add_body_edit('inline_signal_argument', ValueType.SINGLELINE_TEXT, 'Inline Signal Argument', '', {'tooltip':"For example if set to 'Hello' the method can be called with [signal=Hello] in the next text event."}, 'inline == true')
add_body_edit('inline_single_use', ValueType.BOOL, 'Single Use:', '', {'tooltip':"By default calling via in-text signal only works once. Uncheck this to make the event keep listening. \nThis only stays valid during this dialog."}, 'inline == true')
add_body_edit('wait', ValueType.BOOL, 'Wait:', '', {'tooltip':'Will wait for the method to finish. Only relevant for methods with `await` in them.'}, 'inline == false')
add_header_edit('method', ValueType.SINGLELINE_TEXT, {'left_text':'Call method'})
add_header_edit('path', ValueType.SINGLELINE_TEXT, {'left_text':'in object'})
add_body_edit('inline', ValueType.BOOL, {'left_text':'Inline Command:', 'tooltip':"If enabled, the method won't be called instantly. Only when a signal is emmited inside the following text event will it be called."})
add_body_edit('inline_signal_argument', ValueType.SINGLELINE_TEXT, {'left_text':'Inline Signal Argument', 'tooltip':"For example if set to 'Hello' the method can be called with [signal=Hello] in the next text event."}, 'inline == true')
add_body_edit('inline_single_use', ValueType.BOOL, {'left_text':'Single Use:','tooltip':"By default calling via in-text signal only works once. Uncheck this to make the event keep listening. \nThis only stays valid during this dialog."}, 'inline == true')
add_body_edit('wait', ValueType.BOOL, {'left_text':'Wait:', 'tooltip':'Will wait for the method to finish. Only relevant for methods with `await` in them.'}, 'inline == false')
add_body_line_break()
add_body_edit('arguments', ValueType.STRING_ARRAY, 'Arguments:')
add_body_edit('arguments', ValueType.STRING_ARRAY, {'left_text':'Arguments:'})
33 changes: 17 additions & 16 deletions addons/dialogic/Modules/Character/event_character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func is_valid_event(string:String) -> bool:
################################################################################

func build_event_editor() -> void:
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, '', '', {
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, {
'selector_options': [
{
'label': 'Join',
Expand All @@ -350,51 +350,52 @@ func build_event_editor() -> void:
}
]
})
add_header_edit('_character_from_directory', ValueType.COMPLEX_PICKER, '', '',
add_header_edit('_character_from_directory', ValueType.COMPLEX_PICKER,
{'placeholder' : 'Character',
'file_extension' : '.dch',
'suggestions_func' : get_character_suggestions,
'icon' : load("res://addons/dialogic/Editor/Images/Resources/character.svg"),
'autofocus' : true})
# add_header_button('', _on_character_edit_pressed, 'Edit character', ["ExternalLink", "EditorIcons"], 'character != null and _character_from_directory != "--All--"')

add_header_edit('set_portrait', ValueType.BOOL, '', '',
add_header_edit('set_portrait', ValueType.BOOL,
{'icon':load("res://addons/dialogic/Modules/Character/update_portrait.svg"),
'tooltip':'Change Portrait'}, "action == Actions.UPDATE")
add_header_edit('portrait', ValueType.COMPLEX_PICKER, '', '',
add_header_edit('portrait', ValueType.COMPLEX_PICKER,
{'placeholder' : 'Default',
'collapse_when_empty':true,
'suggestions_func' : get_portrait_suggestions,
'icon' : load("res://addons/dialogic/Editor/Images/Resources/portrait.svg")},
'should_show_portrait_selector()')
add_header_edit('set_position', ValueType.BOOL, '', '',
add_header_edit('set_position', ValueType.BOOL,
{'icon': load("res://addons/dialogic/Modules/Character/update_position.svg"), 'tooltip':'Change Position'}, "action == Actions.UPDATE")
add_header_label('at position', 'character != null and !has_no_portraits() and action == Actions.JOIN')
add_header_label('to position', 'character != null and !has_no_portraits() and action == Actions.UPDATE and set_position')
add_header_edit('position', ValueType.INTEGER, '', '', {},
add_header_edit('position', ValueType.INTEGER, {},
'character != null and !has_no_portraits() and action != %s and (action != Actions.UPDATE or set_position)' %Actions.LEAVE)

# Body
add_body_edit('animation_name', ValueType.COMPLEX_PICKER, 'Animation:', '',
{'suggestions_func' : get_animation_suggestions,
add_body_edit('animation_name', ValueType.COMPLEX_PICKER,
{'left_text' : 'Animation:',
'suggestions_func' : get_animation_suggestions,
'editor_icon' : ["Animation", "EditorIcons"],
'placeholder' : 'Default',
'enable_pretty_name' : true},
'should_show_animation_options()')
add_body_edit('animation_length', ValueType.FLOAT, 'Length:', '', {},
add_body_edit('animation_length', ValueType.FLOAT, {'left_text':'Length:'},
'should_show_animation_options() and !animation_name.is_empty()')
add_body_edit('animation_wait', ValueType.BOOL, 'Await end:', '', {},
add_body_edit('animation_wait', ValueType.BOOL, {'left_text':'Await end:'},
'should_show_animation_options() and !animation_name.is_empty()')
add_body_edit('animation_repeats', ValueType.INTEGER, 'Repeat:', '', {},
add_body_edit('animation_repeats', ValueType.INTEGER, {'left_text':'Repeat:'},
'should_show_animation_options() and !animation_name.is_empty() and action == %s)' %Actions.UPDATE)
add_body_line_break()
add_body_edit('position_move_time', ValueType.FLOAT, 'Movement duration:', '', {},
add_body_edit('position_move_time', ValueType.FLOAT, {'left_text':'Movement duration:'},
'action == %s and set_position' %Actions.UPDATE)
add_body_edit('set_z_index', ValueType.BOOL, '', '', {'icon':load("res://addons/dialogic/Modules/Character/update_z_index.svg"), 'tooltip':'Change Z-Index'}, "action == Actions.UPDATE")
add_body_edit('z_index', ValueType.INTEGER, 'Z-index:', "",{},
add_body_edit('set_z_index', ValueType.BOOL, {'icon':load("res://addons/dialogic/Modules/Character/update_z_index.svg"), 'tooltip':'Change Z-Index'}, "action == Actions.UPDATE")
add_body_edit('z_index', ValueType.INTEGER, {'left_text':'Z-index:'},
'action != %s and (action != Actions.UPDATE or set_z_index)' %Actions.LEAVE)
add_body_edit('set_mirrored', ValueType.BOOL, '', '', {'icon':load("res://addons/dialogic/Modules/Character/update_mirror.svg"), 'tooltip':'Change Mirroring'}, "action == Actions.UPDATE")
add_body_edit('mirrored', ValueType.BOOL, 'Mirrored:', "",{},
add_body_edit('set_mirrored', ValueType.BOOL, {'icon':load("res://addons/dialogic/Modules/Character/update_mirror.svg"), 'tooltip':'Change Mirroring'}, "action == Actions.UPDATE")
add_body_edit('mirrored', ValueType.BOOL, {'left_text':'Mirrored:'},
'action != %s and (action != Actions.UPDATE or set_mirrored)' %Actions.LEAVE)


Expand Down
8 changes: 4 additions & 4 deletions addons/dialogic/Modules/Character/event_position.gd
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, '', '', {
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, {
'selector_options': [
{
'label': 'Change',
Expand All @@ -97,10 +97,10 @@ func build_event_editor():
}
]
})
add_header_edit("position", ValueType.INTEGER, "position", '', {},
add_header_edit("position", ValueType.INTEGER, {'left_text':"position"},
'action != Actions.RESET_ALL')
add_header_label('to (absolute)', 'action == Actions.SET_ABSOLUTE')
add_header_label('by (relative)', 'action == Actions.SET_RELATIVE')
add_header_edit("vector", ValueType.VECTOR2, "", '', {},
add_header_edit("vector", ValueType.VECTOR2, {},
'action != Actions.RESET and action != Actions.RESET_ALL')
add_body_edit("movement_time", ValueType.FLOAT, "AnimationTime:", "(0 for instant)")
add_body_edit("movement_time", ValueType.FLOAT, {'left_text':"AnimationTime:", "right_text":"(0 for instant)"})
11 changes: 6 additions & 5 deletions addons/dialogic/Modules/Choice/event_choice.gd
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ func _get_property_original_translation(property:String) -> String:
################################################################################

func build_event_editor() -> void:
add_header_edit("text", ValueType.SINGLELINE_TEXT, '','', {'autofocus':true})
add_body_edit("condition", ValueType.CONDITION, 'if ')
add_body_edit("else_action", ValueType.FIXED_OPTION_SELECTOR, 'else ', '', {
add_header_edit("text", ValueType.SINGLELINE_TEXT, {'autofocus':true})
add_body_edit("condition", ValueType.CONDITION, {'left_text':'if '})
add_body_edit("else_action", ValueType.FIXED_OPTION_SELECTOR, {'left_text':'else ',
'selector_options': [
{
'label': 'Default',
Expand All @@ -152,8 +152,9 @@ func build_event_editor() -> void:
'value': ElseActions.DISABLE,
}
]}, '!condition.is_empty()')
add_body_edit("disabled_text", ValueType.SINGLELINE_TEXT, 'Disabled text:', '',
{'placeholder':'(Empty for same)'}, 'allow_alt_text()')
add_body_edit("disabled_text", ValueType.SINGLELINE_TEXT, {
'left_text':'Disabled text:',
'placeholder':'(Empty for same)'}, 'allow_alt_text()')


func allow_alt_text() -> bool:
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Comment/event_comment.gd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func is_valid_event(string:String) -> bool:
################################################################################

func build_event_editor():
add_header_edit('text', ValueType.SINGLELINE_TEXT, '#','',{'autofocus':true})
add_header_edit('text', ValueType.SINGLELINE_TEXT, {'left_text':'#', 'autofocus':true})


#################### SYNTAX HIGHLIGHTING #######################################
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Condition/event_condition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func is_valid_event(string:String) -> bool:
################################################################################

func build_event_editor():
add_header_edit('condition_type', ValueType.FIXED_OPTION_SELECTOR, '', '', {
add_header_edit('condition_type', ValueType.FIXED_OPTION_SELECTOR, {
'selector_options': [
{
'label': 'IF',
Expand All @@ -120,7 +120,7 @@ func build_event_editor():
'value': ConditionTypes.ELSE,
}
], 'disabled':true})
add_header_edit('condition', ValueType.CONDITION, '', '', {}, 'condition_type != %s'%ConditionTypes.ELSE)
add_header_edit('condition', ValueType.CONDITION, {}, 'condition_type != %s'%ConditionTypes.ELSE)


####################### CODE COMPLETION ########################################
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/History/event_history.gd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, '', '', {
add_header_edit('action', ValueType.FIXED_OPTION_SELECTOR, {
'selector_options': [
{
'label': 'Pause History',
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Jump/event_jump.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('_timeline_file', ValueType.COMPLEX_PICKER, 'Jump to', '', {
add_header_edit('_timeline_file', ValueType.COMPLEX_PICKER, {'left_text':'Jump to',
'file_extension': '.dtl',
'suggestions_func': get_timeline_suggestions,
'editor_icon': ["TripleBar", "EditorIcons"],
'empty_text': '(this timeline)',
'autofocus':true
})
add_header_edit("label_name", ValueType.COMPLEX_PICKER, "at", '', {
add_header_edit("label_name", ValueType.COMPLEX_PICKER, {'left_text':"at",
'empty_text':'the beginning',
'suggestions_func':get_label_suggestions,
'editor_icon':["ArrowRight", "EditorIcons"]})
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Jump/event_label.gd
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('name', ValueType.SINGLELINE_TEXT, '', '', {'autofocus':true})
add_header_edit('name', ValueType.SINGLELINE_TEXT, {'left_text':'Label', 'autofocus':true})


####################### CODE COMPLETION ########################################
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Save/event_save.gd
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('slot_name', ValueType.SINGLELINE_TEXT, 'Save to slot')
add_header_edit('slot_name', ValueType.SINGLELINE_TEXT, {'left_text':'Save to slot'})
12 changes: 6 additions & 6 deletions addons/dialogic/Modules/Settings/event_setting.gd
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func is_valid_event(string:String) -> bool:
################################################################################

func build_event_editor():
add_header_edit('mode', ValueType.FIXED_OPTION_SELECTOR, '', '', {
add_header_edit('mode', ValueType.FIXED_OPTION_SELECTOR, {
'selector_options': [{
'label': 'Set',
'value': Modes.SET,
Expand All @@ -138,8 +138,8 @@ func build_event_editor():
},
]})

add_header_edit('name', ValueType.COMPLEX_PICKER, '', '', {'placeholder':'Type setting', 'suggestions_func':get_settings_suggestions}, 'mode != 2')
add_header_edit('_value_type', ValueType.FIXED_OPTION_SELECTOR, 'to', '', {
add_header_edit('name', ValueType.COMPLEX_PICKER, {'placeholder':'Type setting', 'suggestions_func':get_settings_suggestions}, 'mode != 2')
add_header_edit('_value_type', ValueType.FIXED_OPTION_SELECTOR, {'left_text':'to',
'selector_options': [
{
'label': 'String',
Expand All @@ -160,9 +160,9 @@ func build_event_editor():
}],
'symbol_only':true},
'!name.is_empty() and mode == 0')
add_header_edit('value', ValueType.SINGLELINE_TEXT, '', '', {}, '!name.is_empty() and (_value_type == 0 or _value_type == 3) and mode == 0')
add_header_edit('value', ValueType.FLOAT, '', '', {}, '!name.is_empty() and _value_type == 1 and mode == 0')
add_header_edit('value', ValueType.COMPLEX_PICKER, '', '',
add_header_edit('value', ValueType.SINGLELINE_TEXT, {}, '!name.is_empty() and (_value_type == 0 or _value_type == 3) and mode == 0')
add_header_edit('value', ValueType.FLOAT, {}, '!name.is_empty() and _value_type == 1 and mode == 0')
add_header_edit('value', ValueType.COMPLEX_PICKER,
{'suggestions_func' : get_value_suggestions, 'placeholder':'Select Variable'},
'!name.is_empty() and _value_type == 2 and mode == 0')

Expand Down
3 changes: 1 addition & 2 deletions addons/dialogic/Modules/Signal/event_signal.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('argument', ValueType.SINGLELINE_TEXT,
'Emit with argument', '', {'autofocus':true})
add_header_edit('argument', ValueType.SINGLELINE_TEXT, {'left_text':'Emit with argument', 'autofocus':true})
5 changes: 3 additions & 2 deletions addons/dialogic/Modules/Style/event_style.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func get_shortcode_parameters() -> Dictionary:
################################################################################

func build_event_editor():
add_header_edit('style_name', ValueType.COMPLEX_PICKER, 'Use style', '',
{'placeholder' : 'Default',
add_header_edit('style_name', ValueType.COMPLEX_PICKER, {
'left_text' :'Use style',
'placeholder' : 'Default',
'suggestions_func' : get_style_suggestions,
'editor_icon' : ["PopupMenu", "EditorIcons"],
'autofocus' : true})
Expand Down
6 changes: 3 additions & 3 deletions addons/dialogic/Modules/Text/event_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ func _get_property_original_translation(property:String) -> String:
################################################################################

func build_event_editor():
add_header_edit('_character_from_directory', ValueType.COMPLEX_PICKER, '', '',
add_header_edit('_character_from_directory', ValueType.COMPLEX_PICKER,
{'file_extension' : '.dch',
'suggestions_func' : get_character_suggestions,
'empty_text' : '(No one)',
'icon' : load("res://addons/dialogic/Editor/Images/Resources/character.svg")}, 'do_any_characters_exist()')
add_header_edit('portrait', ValueType.COMPLEX_PICKER, '', '',
add_header_edit('portrait', ValueType.COMPLEX_PICKER,
{'suggestions_func' : get_portrait_suggestions,
'placeholder' : "(Don't change)",
'icon' : load("res://addons/dialogic/Editor/Images/Resources/portrait.svg"),
'collapse_when_empty':true,},
'character != null and !has_no_portraits()')
add_body_edit('text', ValueType.MULTILINE_TEXT, "", "", {'autofocus':true})
add_body_edit('text', ValueType.MULTILINE_TEXT, {'autofocus':true})

func do_any_characters_exist() -> bool:
return !DialogicUtil.list_resources_of_type(".dch").is_empty()
Expand Down
Loading

0 comments on commit dce37b8

Please sign in to comment.