aboutsummaryrefslogtreecommitdiff
path: root/addons/voxel-core/engine/importers/voxel_sets.gd
blob: fc560b4d19b17df45bb86634fb581dd20f45cff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
tool
extends EditorImportPlugin



## Enums
enum Presets { DEFAULT }



## Built-In Virtual Methods
func get_visible_name() -> String:
	return "VoxelSet"


func get_importer_name() -> String:
	return "VoxelCore.VoxelSet"


func get_recognized_extensions() -> Array:
	return [
		"png", "jpg",
		"vox",
		"gpl",
	]


func get_resource_type() -> String:
	return "Resource"


func get_save_extension() -> String:
	return "tres"


func get_preset_count() -> int:
	return Presets.size()


func get_preset_name(preset : int) -> String:
	match preset:
		Presets.DEFAULT:
			return "Default"
		_:
			return "Unknown"


func get_import_options(preset : int) -> Array:
	var preset_options = [
		
	]
	
	return preset_options


func get_option_visibility(option : String, options : Dictionary) -> bool:
	return true


func import(source_file : String, save_path : String, options : Dictionary, r_platform_variants : Array, r_gen_files : Array) -> int:
	var voxel_set := VoxelSet.new()
	var error = voxel_set.load_file(source_file)
	if error == OK:
		voxel_set.request_refresh()
		error = ResourceSaver.save("%s.%s" % [save_path, get_save_extension()], voxel_set)
	return error