Fixed image node so the image is displayed the node is duplicated

This commit is contained in:
RodZill4 2019-10-27 15:22:14 +01:00
parent 46d0e0f5cd
commit cd08666123
2 changed files with 8 additions and 1 deletions

View File

@ -1 +0,0 @@
{"connections":[],"nodes":[{"name":"Material","node_position":{"x":300,"y":0},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"}]}

View File

@ -4,6 +4,11 @@ extends MMGraphNodeBase
func _ready() -> void: func _ready() -> void:
set_slot(0, false, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1)) set_slot(0, false, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
func set_generator(g) -> void:
.set_generator(g)
generator.connect("parameter_changed", self, "on_parameter_changed")
$TextureButton.texture_normal = generator.texture
func set_texture(path) -> void: func set_texture(path) -> void:
if path == null: if path == null:
return return
@ -16,6 +21,9 @@ func get_textures() -> Dictionary:
list[name] = $TextureButton.texture_normal list[name] = $TextureButton.texture_normal
return list return list
func on_parameter_changed(p, v) -> void:
$TextureButton.texture_normal = generator.texture
func _on_TextureButton_pressed() -> void: func _on_TextureButton_pressed() -> void:
var dialog = FileDialog.new() var dialog = FileDialog.new()
add_child(dialog) add_child(dialog)