ConfigField ​
Inherits: HBoxContainer
Inherited by: ColorField, DatabaseIdField, FilePathField, NamePickerField, NumberField, OptionField, PathListField, ResourceField, SoundSourceField, TextField, ToggleField, Vector3Field, VfxNameField
The base of the field components of the config editors: a label and a control for ONE property of the resource that is open. Place a field scene (number_field.tscn, toggle_field.tscn, option_field.tscn, color_field.tscn, vector3_field.tscn) in an editor scene, set its Property (the name of the export, sun_rise_hour) and its Label text in the inspector, and the editor shows and changes that property: the editor calls bind(resource) when a resource is opened, and every change the person makes is written to the resource and sent as value_changed. The layout is yours: fields go in the containers of the scene.
Description ​
A field that does not match a property of the resource stays as it is (and says so in the output), so a renamed export shows up at once.
Properties ​
StringName | property | &"" |
String | label_text | "": |
String | help | "": |
float | label_width | 180.0: |
Variables ​
Resource | resource |
Methods ​
bool | belongs_to( owner: Node, field: Node ) static |
void | bind( p_resource: Resource ) |
void | refresh() |
void | set_applies( applies: bool ) |
Variant | get_value() |
Signals ​
value_changed( property: StringName, value: Variant ) ​
The person changed the value (the resource already has it)
Property descriptions ​
StringName property = &"" ​
The name of the property of the resource this field shows and changes
String label_text = "": ​
The text of the label
String help = "": ​
What the field is for: the tooltip of the label and of the control
float label_width = 180.0: ​
The width of the label, so the controls of a column line up
Variable descriptions ​
Resource resource ​
The resource that is open (null before bind)
Method descriptions ​
bool belongs_to( owner: Node, field: Node ) ​
Is this field one of the fields of owner itself, not of a form inside a list in it (a form binds its own fields to its own item)?
void bind( p_resource: Resource ) ​
Opens a resource in the field: it shows the value of its property
void refresh() ​
Shows the value of the property again
void set_applies( applies: bool ) ​
The control of the field is shown or hidden with the field (a field that does not apply is hidden)
Variant get_value() ​
The value that is in the resource now (null when there is none)