Skip to content

Commit 0dd7da2

Browse files
Alpha19 (#2716)
## Small fix to speaker portraits Speaker portraits only show when the character talks. If however the character has joined before, the user might have specified their portrait before on a join event. This tries to get the speaker portrait if they are joined and no portrait is specified on the text event. ## Adjust text event portrait field visibility in visual editor This better allows temporary characters in the visual editor (it now shows the portrait field if the character doesn't exist). This allows entering a portrait if the character is specified by a variable or a color if the character is likely temporary. ## Update plugin version to Alpha 19 (Godot 4.4+)
1 parent 0a076d7 commit 0dd7da2

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

addons/dialogic/Core/DialogicUtil.gd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static func get_character_suggestions(_search_text:String, current_value:Dialogi
638638
return suggestions
639639

640640

641-
static func get_portrait_suggestions(search_text:String, character:DialogicCharacter, allow_empty := false, empty_text := "Don't Change") -> Dictionary:
641+
static func get_portrait_suggestions(search_text:String, character:DialogicCharacter, allow_empty := false, empty_text := "Don't Change", allow_anything:=false) -> Dictionary:
642642
var icon := load("res://addons/dialogic/Editor/Images/Resources/portrait.svg")
643643
var suggestions := {}
644644

@@ -648,6 +648,9 @@ static func get_portrait_suggestions(search_text:String, character:DialogicChara
648648
if "{" in search_text:
649649
suggestions[search_text] = {'value':search_text, 'editor_icon':["Variant", "EditorIcons"]}
650650

651+
elif allow_anything and search_text:
652+
suggestions[search_text] = {'value':search_text, 'editor_icon':["Variant", "EditorIcons"]}
653+
651654
if character != null:
652655
for portrait in character.portraits:
653656
suggestions[portrait] = {'value':portrait, 'icon':icon}

addons/dialogic/Modules/Character/subsystem_portraits.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,9 @@ func change_speaker(speaker: DialogicCharacter = null, portrait := "") -> void:
661661

662662
elif portrait.is_empty():
663663
continue
664-
664+
if portrait.is_empty():
665+
if is_character_joined(speaker):
666+
portrait = dialogic.current_state_info.portraits[speaker.get_identifier()].get("portrait", "")
665667
if portrait.is_empty():
666668
portrait = speaker.default_portrait
667669

addons/dialogic/Modules/Text/event_text.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var character_identifier: String:
3333
set(value):
3434
character_identifier = value
3535
character = DialogicResourceUtil.get_character_resource(value)
36-
if Engine.is_editor_hint() and ((not character) or (character and not character.portraits.has(portrait))):
36+
if Engine.is_editor_hint() and ((not character) or (character and not portrait in character.portraits)) and not (not character and (character_identifier or character_identifier.begins_with("{"))):
3737
portrait = ""
3838
ui_update_needed.emit()
3939

@@ -434,7 +434,8 @@ func build_event_editor() -> void:
434434

435435

436436
func should_show_portrait_selector() -> bool:
437-
return character and not character.portraits.is_empty() and not character.portraits.size() == 1
437+
return (character and not character.portraits.is_empty() and not character.portraits.size() == 1) or \
438+
(not character and (character_identifier.begins_with("{") or not character_identifier.is_empty()))
438439

439440

440441
func do_any_characters_exist() -> bool:
@@ -450,8 +451,9 @@ func get_character_suggestions(search_text:String) -> Dictionary:
450451
"editor_icon":["GuiEllipsis", "EditorIcons"]}
451452
return suggestions
452453

454+
453455
func get_portrait_suggestions(search_text:String) -> Dictionary:
454-
return DialogicUtil.get_portrait_suggestions(search_text, character, true, "Don't change")
456+
return DialogicUtil.get_portrait_suggestions(search_text, character, true, "Don't change", true)
455457

456458
#endregion
457459

addons/dialogic/plugin.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
name="Dialogic"
44
description="Create dialogs, characters and scenes to display conversations in your Godot games.
55
https://github.com/dialogic-godot/dialogic"
6-
author="Jowan Spooner, Emi, Cake and more!"
7-
version="2.0-Alpha-19 WIP (Godot 4.3+)"
6+
author="Jowan, Emi, Cake and more!"
7+
version="2.0-Alpha-19 (Godot 4.4+)"
88
script="plugin.gd"

0 commit comments

Comments
 (0)