29 lines
646 B
GDScript
29 lines
646 B
GDScript
class_name Vec2Param extends ParamField
|
|
|
|
@onready var label: Label = $Label
|
|
|
|
@onready var spin_box_x: SpinBox = $HBoxContainer/SpinBox_X
|
|
@onready var spin_box_y: SpinBox = $HBoxContainer/SpinBox_Y
|
|
|
|
var decimal_places: int
|
|
|
|
func setup(
|
|
dict: Dictionary,
|
|
key: String) -> void:
|
|
name = key
|
|
_d = dict
|
|
_k = key
|
|
label.text = key.capitalize()
|
|
decimal_places = decimal_places
|
|
|
|
var value: Vector2 = dict[key]
|
|
spin_box_x.set_value_no_signal(value.x)
|
|
spin_box_y.set_value_no_signal(value.y)
|
|
|
|
|
|
func _on_spin_box_x_value_changed(value: float) -> void:
|
|
_d[_k].x = value
|
|
|
|
func _on_spin_box_y_value_changed(value: float) -> void:
|
|
_d[_k].y = value
|