Fix #135159: Copied modifier doesn't keep the name of the modifier

`BKE_modifier_copy_ex` did it (which is called e.g. when copying the
whole stack from one object to another), but when simply duplicating a
modifier (`modifier_copy`), it was just ensuring a unique name (based on
the default name) without copyig the existing name prior.

Pull Request: https://projects.blender.org/blender/blender/pulls/135172
This commit is contained in:
Philipp Oeser
2025-02-26 15:35:35 +01:00
committed by Philipp Oeser
parent 0741d0141e
commit 7ac3de70fd

View File

@@ -1640,6 +1640,7 @@ bool modifier_copy(
ModifierData *nmd = BKE_modifier_new(md->type);
BKE_modifier_copydata(md, nmd);
BLI_insertlinkafter(&ob->modifiers, md, nmd);
STRNCPY(nmd->name, md->name);
BKE_modifier_unique_name(&ob->modifiers, nmd);
BKE_modifiers_persistent_uid_init(*ob, *nmd);
BKE_object_modifier_set_active(ob, nmd);