2019-08-25 23:27:07 +02:00
|
|
|
tool
|
2019-10-21 23:58:14 +02:00
|
|
|
extends MMGraphNodeBase
|
2019-08-25 23:27:07 +02:00
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _ready() -> void:
|
2019-08-25 23:27:07 +02:00
|
|
|
set_slot(0, false, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
|
|
|
|
|
2019-10-27 15:22:14 +01:00
|
|
|
func set_generator(g) -> void:
|
|
|
|
.set_generator(g)
|
|
|
|
generator.connect("parameter_changed", self, "on_parameter_changed")
|
|
|
|
$TextureButton.texture_normal = generator.texture
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func set_texture(path) -> void:
|
2019-08-25 23:27:07 +02:00
|
|
|
if path == null:
|
|
|
|
return
|
|
|
|
if generator != null:
|
|
|
|
generator.set_parameter("image", path)
|
|
|
|
$TextureButton.texture_normal = generator.texture
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func get_textures() -> Dictionary:
|
2019-08-25 23:27:07 +02:00
|
|
|
var list = {}
|
|
|
|
list[name] = $TextureButton.texture_normal
|
|
|
|
return list
|
|
|
|
|
2019-10-27 15:22:14 +01:00
|
|
|
func on_parameter_changed(p, v) -> void:
|
|
|
|
$TextureButton.texture_normal = generator.texture
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _on_TextureButton_pressed() -> void:
|
2019-08-25 23:27:07 +02:00
|
|
|
var dialog = FileDialog.new()
|
|
|
|
add_child(dialog)
|
|
|
|
dialog.rect_min_size = Vector2(500, 500)
|
|
|
|
dialog.access = FileDialog.ACCESS_FILESYSTEM
|
|
|
|
dialog.mode = FileDialog.MODE_OPEN_FILE
|
2019-10-20 19:00:11 +02:00
|
|
|
dialog.add_filter("*.bmp;BMP Image")
|
|
|
|
dialog.add_filter("*.hdr;Radiance HDR Image")
|
|
|
|
dialog.add_filter("*.jpg,*.jpeg;JPEG Image")
|
|
|
|
dialog.add_filter("*.png;PNG Image")
|
2019-10-27 11:33:32 +01:00
|
|
|
dialog.add_filter("*.svg;SVG Image")
|
2019-10-20 19:00:11 +02:00
|
|
|
dialog.add_filter("*.tga;TGA Image")
|
|
|
|
dialog.add_filter("*.webp;WebP Image")
|
2019-08-25 23:27:07 +02:00
|
|
|
dialog.connect("file_selected", self, "set_texture")
|
|
|
|
dialog.popup_centered()
|