Pixel-Composer/scripts/preset_data/preset_data.gml

28 lines
827 B
Plaintext
Raw Normal View History

2022-12-10 05:06:01 +01:00
#region loading
global.PRESETS_MAP = ds_map_create();
function __initPresets() {
ds_map_clear(global.PRESETS_MAP);
2023-03-22 07:07:38 +01:00
var _preset_path = "data/Preset.zip";
var root = DIRECTORY + "Presets";
directory_verify(root);
2023-12-08 03:50:09 +01:00
if(check_version($"{root}/version") && file_exists_empty(_preset_path))
zip_unzip(_preset_path, root);
2023-02-14 02:51:14 +01:00
2022-12-10 05:06:01 +01:00
global.PRESETS = new DirectoryObject("Presets", root);
global.PRESETS.scan([".json"]);
for( var i = 0; i < ds_list_size(global.PRESETS.subDir); i++ ) {
var l = [];
var grp = global.PRESETS.subDir[| i];
for( var j = 0; j < ds_list_size(grp.content); j++ ) {
var pth = grp.content[| j].path;
var f = new FileObject(grp.content[| j].name, pth);
2023-08-06 16:00:59 +02:00
f.content = json_load_struct(pth);
2022-12-10 05:06:01 +01:00
array_push(l, f);
}
global.PRESETS_MAP[? grp.name] = l;
}
}
#endregion