You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5 KiB
GDScript

2 years ago
@tool
extends EditorImportPlugin
const VoxImporterCommon = preload("./vox-importer-common.gd");
func _init():
print('MagicaVoxel Mesh Importer: Ready')
2 years ago
func _get_importer_name():
return 'MagicaVoxel.With.Extensions.To.Mesh'
2 years ago
func _get_visible_name():
return 'MagicaVoxel Mesh'
2 years ago
func _get_recognized_extensions():
return [ 'vox' ]
2 years ago
func _get_resource_type():
return 'Mesh'
2 years ago
func _get_save_extension():
return 'mesh'
2 years ago
func _get_preset_count():
return 0
2 years ago
func _get_preset_name(_preset):
return 'Default'
2 years ago
func _get_import_order():
return 0
2 years ago
func _get_priority() -> float:
return 1.0
2 years ago
func _get_import_options(path, preset):
return [
{
'name': 'Scale',
'default_value': 0.1
},
{
'name': 'GreedyMeshGenerator',
'default_value': true
},
{
'name': 'SnapToGround',
'default_value': false
},
{
'name': 'FirstKeyframeOnly',
'default_value': true
}
]
2 years ago
func _get_option_visibility(path, option, options):
return true
2 years ago
func _import(source_path, destination_path, options, _platforms, _gen_files):
var meshes = VoxImporterCommon.new().import(source_path, destination_path, options, _platforms, _gen_files);
var full_path = "%s.%s" % [ destination_path, _get_save_extension() ]
var res = ResourceSaver.save(meshes[0], full_path)
Util.refresh_mesh_library([full_path])
return res