mirror of
https://github.com/Relintai/godot-engine.file-editor.git
synced 2024-11-12 22:27:22 +01:00
15 lines
402 B
GDScript
15 lines
402 B
GDScript
tool
|
|
extends Node
|
|
|
|
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 |