mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-11 16:33:01 -06:00
Settings: older settings files split layers above the original (#2545)
Create Split Layers Above Original Layer became on by default in #2083, but a settings file saved before then still holds `false` (every later save keeps it), so Split Layer kept stacking the new layer below. Settings version 4 moves a stored `false` to the new default once, like version 3 did for the old disk cache size; a choice made since stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e56c916085
commit
561c2a8e48
@@ -36,7 +36,7 @@ pub use sections::{
|
||||
use sections::{Extra, default_labels, lenient_comp_presets};
|
||||
|
||||
/// Current settings layout version.
|
||||
pub const PREFS_VERSION: u32 = 3;
|
||||
pub const PREFS_VERSION: u32 = 4;
|
||||
/// Settings file name in the config store.
|
||||
pub const PREFS_FILE: &str = "prefs.json";
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ use super::{Appearance, General, Map, PREFS_VERSION, Prefs, Startup, Value, json
|
||||
/// `autoSaveMinutes`, `autoSaveVersions`, `labelNames` (array) and `theme` at the top level.
|
||||
/// - version 2 defaulted the disk cache to 100 GB, more than most laptops have free; the stored
|
||||
/// old default becomes the new one (a size the user chose is kept).
|
||||
/// - version 3 and earlier could still hold `createSplitLayersAbove: false`, the default before
|
||||
/// #2083 (every save kept it); it becomes After Effects' default, above (#2545).
|
||||
pub fn migrate(mut v: Value) -> Value {
|
||||
let Some(obj) = v.as_object_mut() else { return json!({}) };
|
||||
let version = obj.get("version").and_then(Value::as_u64).unwrap_or(0);
|
||||
@@ -42,6 +44,12 @@ pub fn migrate(mut v: Value) -> Value {
|
||||
{
|
||||
d.insert("diskCacheMaxGb".into(), json!(20));
|
||||
}
|
||||
if version < 4
|
||||
&& let Some(g) = obj.get_mut("general").and_then(Value::as_object_mut)
|
||||
&& g.get("createSplitLayersAbove") == Some(&json!(false))
|
||||
{
|
||||
g.insert("createSplitLayersAbove".into(), json!(true));
|
||||
}
|
||||
// Settings saved before appearance modes had one theme: keep showing it, as a fixed Dark or
|
||||
// Light mode, instead of switching established users to Auto.
|
||||
if let Some(a) = obj.get_mut("appearance").and_then(Value::as_object_mut)
|
||||
|
||||
Reference in New Issue
Block a user