2018-10-28 16:26:37 +01:00
|
|
|
extends HBoxContainer
|
|
|
|
|
2019-12-29 18:12:35 +01:00
|
|
|
const CONTROLS = [ "None", "P1.x", "P1.y", "P1.a", "P1.r", "P2.x", "P2.y", "P2.a", "P2.r", "Rect1.x", "Rect1.y", "Radius1.r", "Radius1.a", "Radius11.r", "Radius11.a", "Scale1.x", "Scale1.y", "Angle1.a", "Angle2.a" ]
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
$Control.clear()
|
|
|
|
for c in CONTROLS:
|
|
|
|
$Control.add_item(c)
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func get_model_data() -> Dictionary:
|
|
|
|
var data = {
|
|
|
|
min = $Min.value,
|
|
|
|
max = $Max.value,
|
|
|
|
step = $Step.value,
|
|
|
|
default = $Default.value,
|
2019-12-27 22:30:49 +01:00
|
|
|
control = $Control.get_item_text($Control.selected)
|
2019-10-20 16:22:06 +02:00
|
|
|
}
|
2018-10-28 16:26:37 +01:00
|
|
|
return data
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func set_model_data(data) -> void:
|
2018-10-28 16:26:37 +01:00
|
|
|
if data.has("min"):
|
|
|
|
$Min.value = data.min
|
2019-11-06 08:31:38 +01:00
|
|
|
$Default.min_value = data.min
|
2018-10-28 16:26:37 +01:00
|
|
|
if data.has("max"):
|
|
|
|
$Max.value = data.max
|
2019-11-06 08:31:38 +01:00
|
|
|
$Default.max_value = data.max
|
2018-10-28 16:26:37 +01:00
|
|
|
if data.has("step"):
|
|
|
|
$Step.value = data.step
|
2019-11-06 08:31:38 +01:00
|
|
|
$Default.step = data.step
|
2018-10-28 17:06:42 +01:00
|
|
|
if data.has("default"):
|
|
|
|
$Default.value = data.default
|
2019-12-27 22:30:49 +01:00
|
|
|
if data.has("control"):
|
|
|
|
$Control.selected = 0
|
|
|
|
for i in range($Control.get_item_count()):
|
|
|
|
if data.control == $Control.get_item_text(i):
|
|
|
|
$Control.selected = i
|
|
|
|
break
|
2019-11-06 08:31:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Min_value_changed(v : float) -> void:
|
|
|
|
$Default.min_value = v
|
|
|
|
|
|
|
|
func _on_Max_value_changed(v : float) -> void:
|
|
|
|
$Default.max_value = v
|
|
|
|
|
|
|
|
func _on_Step_value_changed(v : float) -> void:
|
|
|
|
$Default.step = v
|