aboutsummaryrefslogtreecommitdiff
path: root/addons/voxel-core/engine/importers/voxel_sets.gd
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2022-01-15 16:29:02 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2022-01-15 16:29:02 +0100
commitc9c5b5d7c2a238310ce7bde336f76d2d1b6f9f29 (patch)
treec6e935fea995752a0b307e56892e8422fb734c0e /addons/voxel-core/engine/importers/voxel_sets.gd
parent98f356e68b759bf84300290315d4ada09c41f79b (diff)
moved shapes to loading area & fixed asset paths
Diffstat (limited to 'addons/voxel-core/engine/importers/voxel_sets.gd')
-rw-r--r--addons/voxel-core/engine/importers/voxel_sets.gd66
1 files changed, 66 insertions, 0 deletions
diff --git a/addons/voxel-core/engine/importers/voxel_sets.gd b/addons/voxel-core/engine/importers/voxel_sets.gd
new file mode 100644
index 0000000..fc560b4
--- /dev/null
+++ b/addons/voxel-core/engine/importers/voxel_sets.gd
@@ -0,0 +1,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