godot-engine.file-editor/addons/file-editor/scripts/IconLoader.gd

20 lines
439 B
GDScript3
Raw Normal View History

2019-10-03 16:06:46 +02:00
tool
extends Node
2019-10-11 21:53:20 +02:00
var imgBuffer
2019-10-08 00:25:16 +02:00
func _ready():
pass
2019-10-03 16:06:46 +02:00
func load_icon_from_name(icon_name : String) -> ImageTexture:
var file = File.new()
var image = Image.new()
var texture = ImageTexture.new()
file.open("res://addons/file-editor/icons.pngs/"+icon_name+".png.buttonicon", File.READ)
var buffer = file.get_buffer(file.get_len())
file.close()
image.load_png_from_buffer(buffer)
texture.create_from_image(image)
return texture