mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Merge branch 'master' of github.com:Relintai/broken_seals
This commit is contained in:
commit
1bc5139058
@ -29,10 +29,9 @@ func add_slot_label(input_type : int, output_type : int, getter : String, setter
|
||||
func add_slot_int(input_type : int, output_type : int, getter : String, setter : String, slot_name : String) -> void:
|
||||
var bc : VBoxContainer = VBoxContainer.new()
|
||||
|
||||
if slot_name != "":
|
||||
var l : Label = Label.new()
|
||||
l.text = slot_name
|
||||
bc.add_child(l)
|
||||
var l : Label = Label.new()
|
||||
l.text = slot_name
|
||||
bc.add_child(l)
|
||||
|
||||
var sb : SpinBox = SpinBox.new()
|
||||
sb.rounded = true
|
||||
@ -47,10 +46,9 @@ func add_slot_int(input_type : int, output_type : int, getter : String, setter :
|
||||
func add_slot_float(input_type : int, output_type : int, getter : String, setter : String, slot_name : String, step : float = 0.1) -> void:
|
||||
var bc : VBoxContainer = VBoxContainer.new()
|
||||
|
||||
if slot_name != "":
|
||||
var l : Label = Label.new()
|
||||
l.text = slot_name
|
||||
bc.add_child(l)
|
||||
var l : Label = Label.new()
|
||||
l.text = slot_name
|
||||
bc.add_child(l)
|
||||
|
||||
var sb : SpinBox = SpinBox.new()
|
||||
bc.add_child(sb)
|
||||
@ -61,6 +59,33 @@ func add_slot_float(input_type : int, output_type : int, getter : String, setter
|
||||
sb.value = _node.call(getter)
|
||||
|
||||
sb.connect("value_changed", self, "on_float_spinbox_value_changed", [ slot_idx ])
|
||||
|
||||
func add_slot_vector2(input_type : int, output_type : int, getter : String, setter : String, slot_name : String, step : float = 0.1) -> void:
|
||||
var bc : VBoxContainer = VBoxContainer.new()
|
||||
|
||||
var l : Label = Label.new()
|
||||
l.text = slot_name
|
||||
bc.add_child(l)
|
||||
|
||||
var sbx : SpinBox = SpinBox.new()
|
||||
bc.add_child(sbx)
|
||||
|
||||
var sby : SpinBox = SpinBox.new()
|
||||
bc.add_child(sby)
|
||||
|
||||
var slot_idx : int = add_slot(input_type, output_type, getter, setter, bc)
|
||||
sbx.rounded = false
|
||||
sby.rounded = false
|
||||
sbx.step = step
|
||||
sby.step = step
|
||||
|
||||
var val : Vector2 = _node.call(getter)
|
||||
|
||||
sbx.value = val.x
|
||||
sby.value = val.y
|
||||
|
||||
sbx.connect("value_changed", self, "on_vector2_spinbox_value_changed", [ slot_idx, sbx, sby ])
|
||||
sby.connect("value_changed", self, "on_vector2_spinbox_value_changed", [ slot_idx, sbx, sby ])
|
||||
|
||||
func add_slot(input_type : int, output_type : int, getter : String, setter : String, control : Control) -> int:
|
||||
add_child(control)
|
||||
@ -130,3 +155,9 @@ func on_int_spinbox_value_changed(val : float, slot_idx) -> void:
|
||||
|
||||
func on_float_spinbox_value_changed(val : float, slot_idx) -> void:
|
||||
_node.call(properties[slot_idx][4], val)
|
||||
|
||||
func on_vector2_spinbox_value_changed(val : float, slot_idx, spinbox_x, spinbox_y) -> void:
|
||||
var vv : Vector2 = Vector2(spinbox_x.value, spinbox_y.value)
|
||||
|
||||
_node.call(properties[slot_idx][4], vv)
|
||||
|
||||
|
@ -17,8 +17,7 @@ func register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_texture(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "")
|
||||
mm_graph_node.add_slot_int(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_iterations", "set_iterations", "iterations")
|
||||
mm_graph_node.add_slot_float(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_persistence", "set_persistence", "persistence")
|
||||
mm_graph_node.add_slot_float(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_scale_x", "set_scale_x", "scale")
|
||||
mm_graph_node.add_slot_float(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_scale_y", "set_scale_y", "")
|
||||
mm_graph_node.add_slot_vector2(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_scale", "set_scale", "scale")
|
||||
|
||||
func get_iterations() -> int:
|
||||
return iterations
|
||||
@ -36,18 +35,10 @@ func set_persistence(val : float) -> void:
|
||||
|
||||
emit_changed()
|
||||
|
||||
func get_scale_x() -> float:
|
||||
return scale.x
|
||||
func get_scale() -> Vector2:
|
||||
return scale
|
||||
|
||||
func set_scale_x(val : float) -> void:
|
||||
scale.x = val
|
||||
|
||||
emit_changed()
|
||||
|
||||
func get_scale_y() -> float:
|
||||
return scale.y
|
||||
|
||||
func set_scale_y(val : float) -> void:
|
||||
scale.y = val
|
||||
func set_scale(val : Vector2) -> void:
|
||||
scale = val
|
||||
|
||||
emit_changed()
|
||||
|
Loading…
Reference in New Issue
Block a user