Skip to main content
Version: 1.3

EditorSproutyDialogsCharacterEditor

Inherits: HSplitContainer

Description​

This module is responsible for the character files creation and editing. It allows the user to edit character data, including the character's name, description, dialog box and portraits.

Properties​

TypeNameDefault
EditorUndoRedoManagerundo_redonull

Methods​

Return TypeMethod
Dictionaryget_editor_state()
voidload_editor_state(editor_state: Dictionary)
SproutyDialogsCharacterDataget_character_data()
voidload_character(data: SproutyDialogsCharacterData, name_data: Dictionary, editor_state: Dictionary = {})
voidupdate_key_name(key_name: String)
voidon_locales_changed()
voidon_translation_enabled_changed(enabled: bool)

Signals​

signal modified(modified: bool)

Triggered when something is modified in the character editor.


signal view_state_changed(editor_state: Dictionary)

Emitted when the character editor UI state changes.


Property Descriptions​

var undo_redo : EditorUndoRedoManager

UndoRedo manager for handling undo/redo operations in the character editor.


Method Descriptions​

func get_editor_state() -> Dictionary

Returns the current editor state as a dictionary. This includes the visibility of the dialog box settings, portrait settings, and portraits list sections, the portrait search text, the portrait tree state, and the currently selected portrait path.


func load_editor_state(editor_state: Dictionary) -> void

Restore the editor UI state from a dictionary. Handles section visibility, portrait search, portrait tree state, and the selected portrait path.


func get_character_data() -> SproutyDialogsCharacterData

Returns the character data from the editor. This includes the character's key name, display name (with translations), description, dialog box scene path, portrait settings, and portraits data.


func load_character(data: SproutyDialogsCharacterData, name_data: Dictionary, editor_state: Dictionary = {}) -> void

Load the character data into the editor. If name_data is provided, it will be used to load the name translations. Otherwise, the name translations will be loaded from the character data. If editor_state is provided, the editor UI state will be restored.


func update_key_name(key_name: String) -> void

Update the character key name and its CSV translation key to the given name. The CSV key is set to the key name uppercased with a _CHAR suffix.


func on_locales_changed() -> void

Update name translations text boxes when locales change in the project settings. This method handles locale changes and updates the translation boxes accordingly.


func on_translation_enabled_changed(enabled: bool) -> void

Handle the translation enabled change. When enabled is true, shows translation boxes. When false, hides translation boxes and default locale label.