From 70509468e83ec2bdd3c25b93507a73b630aa14ed Mon Sep 17 00:00:00 2001 From: Rebornim <250083243+Rebornim@users.noreply.github.com> Date: Sun, 29 Nov 2026 06:52:03 +0000 Subject: [PATCH] Layers: a generator swapped in place takes its new kind's name --- crates/engine/src/mask_cmds.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/mask_cmds.rs b/crates/engine/src/mask_cmds.rs index 892e50f3..905c1a35 100644 --- a/crates/engine/src/mask_cmds.rs +++ b/crates/engine/src/mask_cmds.rs @@ -1122,6 +1122,13 @@ pub(crate) fn set(session: &mut Session, params: &Value) -> Result { session.edit("Edit effect", |session| { let edited = session.doc.project.effect_mut(effect).ok_or_else(|| bad(CMD, format!("no effect {}", effect.0)))?; if let Some(generator) = swapped_generator { + // A name taken from the kind follows the new kind, unless one is given with the change + if let EffectKind::Generator(old) = &edited.kind + && (edited.name == old.kind.label() || edited.name == FORMER_GENERATOR_NAME) + { + edited.name = generator.kind.label().to_string(); + } + edited.kind = EffectKind::Generator(generator); } if let Some((kind, label)) = swapped { @@ -1153,11 +1160,6 @@ pub(crate) fn set(session: &mut Session, params: &Value) -> Result { if let Some(kind) = generator_kind && kind != generator.kind { - // A name taken from the kind follows the new kind - let named_by_kind = edited.name == generator.kind.label() || edited.name == FORMER_GENERATOR_NAME; - if named_by_kind && name_param(params).is_none() { - edited.name = kind.label().to_string(); - } generator.kind = kind; generator.detail = Generator::new(kind).detail; generator.inputs.retain(|map, _| kind.inputs().contains(map));