diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index 38b5501a6..c71ab2ccb 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -180,6 +180,12 @@ event_inherited(); new checkBox(function() /*=>*/ { PREFERENCES.save_file_minify = !PREFERENCES.save_file_minify; PREF_SAVE(); }) )); + ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference( + __txtx("pref_save_file_compress", "Compress save file"), + "save_compress", + new checkBox(function() /*=>*/ { PREFERENCES.save_compress = !PREFERENCES.save_compress; PREF_SAVE(); }) + )); + ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference( __txtx("pref_save_backups", "Backup saves"), "save_backup", diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 378612c22..5b6688f70 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -44,7 +44,7 @@ LATEST_VERSION = 1_18_00_0; VERSION = 1_18_04_0; SAVE_VERSION = 1_18_04_0; - VERSION_STRING = MAC? "1.18.003m" : "1.18.5.003"; + VERSION_STRING = MAC? "1.18.003m" : "1.18.5.004"; BUILD_NUMBER = 1_18_04_1; HOTKEYS = ds_map_create(); diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 72ded6062..f15658725 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -126,16 +126,19 @@ function LOAD_AT(path, params = new __loadParams()) { var _ext = filename_ext_raw(path); var s; - if(_ext == "pxc") { - var f = file_text_open_read(path); - s = file_text_read_all(f); - file_text_close(f); + var bf = buffer_load(path); + var bc = buffer_decompress(bf); + + if(bc == -1) { + s = buffer_read(bf, buffer_string); - } else if(_ext == "cpxc") { - var b = buffer_decompress(buffer_load(path)); - s = buffer_read(b, buffer_string); + } else { + s = buffer_read(bc, buffer_string); + buffer_delete(bc); } + buffer_delete(bf); + _load_content = json_try_parse(s); printIf(log, $" > Load struct : {(get_timer() - t1) / 1000} ms"); t1 = get_timer(); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 3d40a7ba4..0493b959c 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -2243,7 +2243,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var _attr = attributeSerialize(); var attri = struct_append(variable_clone(attributes), _attr); - #region attribute stripping + #region attribute stripping // TODO : make it an array if(struct_try_get(attri, "color_depth") == 3) struct_remove(attri, "color_depth"); if(struct_try_get(attri, "interpolate") == 1) struct_remove(attri, "interpolate"); if(struct_try_get(attri, "oversample") == 1) struct_remove(attri, "oversample"); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 21fa2c3c8..234f2afb7 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -2201,12 +2201,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru draw_line_shift_y = struct_try_get(_map, "shift_y", 0); is_modified = struct_try_get(_map, "is_modified", false); - if(struct_has(_map, "attri")) { - var _lattr = _map.attri; - _lattr.mapped = struct_try_get(_lattr, "mapped", 0); - - struct_append(attri, _lattr); - } + if(struct_has(_map, "attri")) + struct_append(attributes, _map.attri); if(struct_has(_map, "linked")) display_data.linked = _map.linked; diff --git a/scripts/preferences/preferences.gml b/scripts/preferences/preferences.gml index 5dfd353b3..3e145a2ab 100644 --- a/scripts/preferences/preferences.gml +++ b/scripts/preferences/preferences.gml @@ -51,6 +51,7 @@ PREFERENCES.keyboard_double_delay = 0.25; PREFERENCES.file_watcher_delay = 0.1; + #endregion #region ///////////////////////////////////////////////////////////////////////// DIALOG //////////////////////////////////////////////////////////////////////// @@ -141,6 +142,7 @@ PREFERENCES.save_file_minify = true; PREFERENCES.save_backup = 1; PREFERENCES.save_layout = false; + PREFERENCES.save_compress = true; #endregion diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 0eee279b7..0d3a05388 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -22,6 +22,7 @@ function SERIALIZE_PROJECT(project = PROJECT) { function SET_PATH(project, path) { if(path == "") { project.readonly = false; + } else if(!project.readonly) { ds_list_remove(RECENT_FILES, path); ds_list_insert(RECENT_FILES, 0, path); @@ -29,7 +30,6 @@ function SET_PATH(project, path) { ds_list_delete(RECENT_FILES, ds_list_size(RECENT_FILES) - 1); RECENT_SAVE(); RECENT_REFRESH(); - //project.path = filename_name(path); } project.path = path; @@ -88,9 +88,10 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { if(file_exists_empty(path)) file_delete(path); var _ext = filename_ext_raw(path); var _prj = SERIALIZE_PROJECT(project); + var _cmp = PREFERENCES.save_compress; - if(_ext == "pxc") file_text_write_all(path, _prj); - else if(_ext == "cpxc") buffer_save(buffer_compress_string(_prj), path); + if(_cmp) buffer_save(buffer_compress_string(_prj), path); + else file_text_write_all(path, _prj); SAVING = false; project.readonly = false;