mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Implemented int and float slots.
This commit is contained in:
parent
634d28b713
commit
ef784088b4
@ -25,6 +25,42 @@ func add_slot_label(input_type : int, output_type : int, getter : String, setter
|
|||||||
l.text = slot_name
|
l.text = slot_name
|
||||||
|
|
||||||
add_slot(input_type, output_type, getter, setter, l)
|
add_slot(input_type, output_type, getter, setter, l)
|
||||||
|
|
||||||
|
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 sb : SpinBox = SpinBox.new()
|
||||||
|
sb.rounded = true
|
||||||
|
bc.add_child(sb)
|
||||||
|
|
||||||
|
var slot_idx : int = add_slot(input_type, output_type, getter, setter, bc)
|
||||||
|
|
||||||
|
sb.value = _node.call(getter)
|
||||||
|
|
||||||
|
sb.connect("value_changed", self, "on_int_spinbox_value_changed", [ slot_idx ])
|
||||||
|
|
||||||
|
func add_slot_float(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 sb : SpinBox = SpinBox.new()
|
||||||
|
bc.add_child(sb)
|
||||||
|
|
||||||
|
var slot_idx : int = add_slot(input_type, output_type, getter, setter, bc)
|
||||||
|
sb.rounded = false
|
||||||
|
sb.step = 0
|
||||||
|
sb.value = _node.call(getter)
|
||||||
|
|
||||||
|
sb.connect("value_changed", self, "on_float_spinbox_value_changed", [ slot_idx ])
|
||||||
|
|
||||||
func add_slot(input_type : int, output_type : int, getter : String, setter : String, control : Control) -> int:
|
func add_slot(input_type : int, output_type : int, getter : String, setter : String, control : Control) -> int:
|
||||||
add_child(control)
|
add_child(control)
|
||||||
@ -88,3 +124,9 @@ func on_node_changed():
|
|||||||
#_node.recalculate_image(_material)
|
#_node.recalculate_image(_material)
|
||||||
|
|
||||||
propagate_node_change()
|
propagate_node_change()
|
||||||
|
|
||||||
|
func on_int_spinbox_value_changed(val : float, slot_idx) -> void:
|
||||||
|
_node.call(properties[slot_idx][4], int(val))
|
||||||
|
|
||||||
|
func on_float_spinbox_value_changed(val : float, slot_idx) -> void:
|
||||||
|
_node.call(properties[slot_idx][4], val)
|
||||||
|
@ -50,7 +50,7 @@ func gen() -> void:
|
|||||||
image.unlock()
|
image.unlock()
|
||||||
|
|
||||||
tex.create_from_image(image)
|
tex.create_from_image(image)
|
||||||
texture = tex
|
#texture = tex
|
||||||
|
|
||||||
var p_o7136_amplitude = 0.500000000;
|
var p_o7136_amplitude = 0.500000000;
|
||||||
var p_o7136_frequency = 2.000000000;
|
var p_o7136_frequency = 2.000000000;
|
||||||
|
@ -15,4 +15,39 @@ func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color:
|
|||||||
|
|
||||||
func register_methods(mm_graph_node) -> void:
|
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_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", "")
|
||||||
|
|
||||||
|
func get_iterations() -> int:
|
||||||
|
return iterations
|
||||||
|
|
||||||
|
func set_iterations(val : int) -> void:
|
||||||
|
iterations = val
|
||||||
|
|
||||||
|
emit_changed()
|
||||||
|
|
||||||
|
func get_persistence() -> float:
|
||||||
|
return persistence
|
||||||
|
|
||||||
|
func set_persistence(val : float) -> void:
|
||||||
|
persistence = val
|
||||||
|
|
||||||
|
emit_changed()
|
||||||
|
|
||||||
|
func get_scale_x() -> float:
|
||||||
|
return scale.x
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
emit_changed()
|
||||||
|
Loading…
Reference in New Issue
Block a user