EditorSproutyDialogsVariableItem
Inherits: Container
Description
Component that represents a single variable item in the variable editor panel. It allows the user to set the variable name, type and value. Supports drag-and-drop for reordering and moving between groups.
Properties
| Type | Name | Default |
|---|---|---|
| Node | parent_group | null |
| bool | new_item | true |
| EditorUndoRedoManager | undo_redo | null |
Methods
| Return Type | Method |
|---|---|
| Dictionary | get_variable_data() |
| String | get_item_path() |
| String | get_item_name() |
| int | get_type() |
| Variant | get_value() |
| void | set_item_name(new_name: String) |
| void | set_type(type: int, metadata: Dictionary) |
| void | set_value(value: Variant) |
| void | update_path_tooltip() |
| void | mark_as_modified(was_modified: bool) |
| void | clear_modified_state() |
| void | show_drop_highlight(above: bool) |
| void | hide_drop_highlight() |
Signals
signal modified(modified: bool)
Emitted when the variable is modified.
signal variable_changed(var_data: Dictionary)
Emitted when the variable is changed.
signal variable_renamed(old_name: String, new_name: String)
Emitted when the variable is renamed.
signal remove_pressed
Emitted when the remove button is pressed.
signal open_text_editor(text_box: LineEdit)
Emitted when an expand button is pressed to open the text editor.
signal update_text_editor(text_box: LineEdit)
Emitted when change the focus to another text box to update the text editor.
Property Descriptions
var parent_group : Node = null
Parent group of the item. Can be an EditorSproutyDialogsVariableGroup or the main container.
var new_item : bool = true
Flag to indicate that the item has just been created.
var undo_redo : EditorUndoRedoManager
UndoRedo manager for handling undo/redo operations.
Method Descriptions
func get_variable_data() -> Dictionary
Returns the variable data as a dictionary with the following structure:
{
"name": String,
"type": int,
"value": Variant,
"metadata": Dictionary
}
func get_item_path() -> String
Return the item path in the variables tree. For items in groups, returns the full path (e.g., "GroupName/VariableName").
func get_item_name() -> String
Returns the variable name.
func get_type() -> int
Returns the variable type.
func get_value() -> Variant
Returns the variable value.
func set_item_name(new_name: String) -> void
Rename the variable item and update the path tooltip.
func set_type(type: int, metadata: Dictionary) -> void
Set the variable type and metadata. Updates the value field to match the new type.
func set_value(value: Variant) -> void
Set the variable value. The value type must match the current variable type.
func update_path_tooltip() -> void
Update the tooltip with the current item path.
func mark_as_modified(was_modified: bool) -> void
Mark the variable item as modified. Shows a visual indicator when modified.
func clear_modified_state() -> void
Clear the modified state of the variable item.
func show_drop_highlight(above: bool = true) -> void
Show the drop highlight for drag-and-drop operations. Displays above or below the item based on the parameter.
func hide_drop_highlight() -> void
Hide the drop highlight.