material-maker/addons/material_maker/nodes/export.gd
RodZill4 1c56fc60d8 Cleanup and renaming
Moved Material Spray to another repository.
Renamed the addon directory to material_maker
2018-09-03 21:35:44 +02:00

33 lines
716 B
GDScript

tool
extends "res://addons/material_maker/node_base.gd"
var resolution = 1
var suffix = "suffix"
func _ready():
initialize_properties([ $resolution ])
func _get_shader_code(uv):
var rv = { defs="", code="", f="0.0" }
var src = get_source()
if src != null:
rv = src.get_shader_code(uv)
return rv
func export_textures(prefix, size = null):
var suffix = $Suffix.text
if suffix != "":
if size == null:
size = int(pow(2, 8+resolution))
get_parent().export_texture(get_source(), "%s_%s.png" % [ prefix, suffix ], size)
func serialize():
var data = .serialize()
data.suffix = $Suffix.text
return data
func deserialize(data):
if data.has("suffix"):
$Suffix.text = data.suffix
.deserialize(data)