HammeriteEditorToolSimpleToolPopup
Editor. Inherits PanelContainer
A small options panel for a tool: a title and a column of typed fields and buttons. Hand it to HammeriteEditorTool.add_popup().
Properties
| Type | Name | Default |
|---|---|---|
VBoxContainer | content_container | |
Dictionary[StringName, Control] | field_inputs | |
Label | title_label |
Methods
| Returns | Method |
|---|---|
Button | add_button(name: StringName, label: String) |
void | add_field(name: StringName, default_value, label: String, disabled: bool = false) |
Label | add_note(text: String) |
void | add_separator() |
bool | has_field(name: StringName) |
void | set_field_editable(name: StringName, editable: bool) |
void | set_title(title: String) |
void | set_value(name: StringName, value) |
Signals
button_pressed
signal button_pressed(name: StringName)
The button added as name by add_button() was pressed.
value_changed
signal value_changed(name: StringName, new_value)
The author changed field name to new_value: an int, float, String or bool, matching the field's default.
Property descriptions
content_container
var content_container: VBoxContainer
The column everything is added to, title first.
field_inputs
var field_inputs: Dictionary[StringName, Control]
Each field's control by name: a SpinBox, LineEdit or CheckBox. The popup's own dictionary.
title_label
var title_label: Label
Shows the text given to set_title().
Method descriptions
add_button()
func add_button(name: StringName, label: String) -> Button
A tool parameter that is an action rather than a value, e.g. rotating what is being drawn. Emits button_pressed with name.
add_field()
func add_field(name: StringName, default_value, label: String, disabled: bool = false) -> void
Adds a labelled field named name, its control chosen by default_value's type: a SpinBox for int or float (range ±65536), a LineEdit for String, a CheckBox for bool. Any other type is an error. Changes emit value_changed.
add_note()
func add_note(text: String) -> Label
A line of explanation, for when what a tool does depends on state that is not in the popup.
add_separator()
func add_separator() -> void
Adds a horizontal rule below what is there so far.
has_field()
func has_field(name: StringName) -> bool
Whether a field named name has been added.
set_field_editable()
func set_field_editable(name: StringName, editable: bool) -> void
Lets field name be changed by the author, or only show its value. Does nothing for a name with no field.
set_title()
func set_title(title: String) -> void
Sets the text at the top of the popup.
set_value()
func set_value(name: StringName, value) -> void
Shows value in field name without emitting value_changed. Does nothing for a name with no field.