2019-10-01 23:15:36 +02:00
|
|
|
tool
|
2019-07-31 20:53:00 +02:00
|
|
|
extends EditorImportPlugin
|
|
|
|
|
|
|
|
var plugin = null
|
|
|
|
|
|
|
|
func _init(p):
|
|
|
|
plugin = p
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
func get_import_options(preset : int):
|
|
|
|
return []
|
|
|
|
|
|
|
|
func get_import_order():
|
|
|
|
return 1
|
|
|
|
|
|
|
|
func get_importer_name():
|
|
|
|
return "MaterialMakerImporter"
|
|
|
|
|
|
|
|
func get_option_visibility(option: String, options: Dictionary):
|
|
|
|
return false
|
|
|
|
|
|
|
|
func get_preset_count():
|
|
|
|
return 1
|
|
|
|
|
|
|
|
func get_preset_name(preset: int) -> String:
|
|
|
|
return "Default"
|
|
|
|
|
|
|
|
func get_priority():
|
|
|
|
return 1
|
|
|
|
|
|
|
|
func get_recognized_extensions():
|
|
|
|
return [ "ptex" ]
|
|
|
|
|
|
|
|
func get_resource_type():
|
|
|
|
return "Material"
|
|
|
|
|
|
|
|
func get_save_extension():
|
|
|
|
return "tres"
|
|
|
|
|
|
|
|
func get_visible_name():
|
|
|
|
return "Material Maker Importer"
|
|
|
|
|
|
|
|
func import(source_file: String, save_path: String, options: Dictionary, platform_variants: Array, gen_files: Array) -> int:
|
|
|
|
var filename = save_path + "." + get_save_extension()
|
2019-08-09 08:16:24 +02:00
|
|
|
var material = plugin.generate_material(source_file)
|
|
|
|
while material is GDScriptFunctionState:
|
|
|
|
material = yield(material, "completed")
|
2019-10-16 23:15:11 +02:00
|
|
|
if material != null:
|
|
|
|
ResourceSaver.save(filename, material)
|
2019-07-31 20:53:00 +02:00
|
|
|
return OK
|