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));