[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52182] trunk/blender/source/blender/ blenkernel/intern/object.c: fix [#33156] Ctrl+L Link modifiers produce copies with identical names

Campbell Barton ideasman42 at gmail.com
Tue Nov 13 15:53:34 CET 2012


Revision: 52182
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52182
Author:   campbellbarton
Date:     2012-11-13 14:53:33 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
fix [#33156] Ctrl+L Link modifiers produce copies with identical names

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/object.c

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2012-11-13 14:34:36 UTC (rev 52181)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2012-11-13 14:53:33 UTC (rev 52182)
@@ -196,18 +196,18 @@
 	return TRUE;
 }
 
-void BKE_object_link_modifiers(struct Object *ob, struct Object *from)
+void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src)
 {
 	ModifierData *md;
-	BKE_object_free_modifiers(ob);
+	BKE_object_free_modifiers(ob_dst);
 
-	if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+	if (!ELEM5(ob_dst->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
 		/* only objects listed above can have modifiers and linking them to objects
 		 * which doesn't have modifiers stack is quite silly */
 		return;
 	}
 
-	for (md = from->modifiers.first; md; md = md->next) {
+	for (md = ob_src->modifiers.first; md; md = md->next) {
 		ModifierData *nmd = NULL;
 
 		if (ELEM4(md->type,
@@ -219,16 +219,18 @@
 			continue;
 		}
 
-		if (!BKE_object_support_modifier_type_check(ob, md->type))
+		if (!BKE_object_support_modifier_type_check(ob_dst, md->type))
 			continue;
 
 		nmd = modifier_new(md->type);
+		BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
 		modifier_copyData(md, nmd);
-		BLI_addtail(&ob->modifiers, nmd);
+		BLI_addtail(&ob_dst->modifiers, nmd);
+		modifier_unique_name(&ob_dst->modifiers, nmd);
 	}
 
-	BKE_object_copy_particlesystems(ob, from);
-	BKE_object_copy_softbody(ob, from);
+	BKE_object_copy_particlesystems(ob_dst, ob_src);
+	BKE_object_copy_softbody(ob_dst, ob_src);
 
 	/* TODO: smoke?, cloth? */
 }




More information about the Bf-blender-cvs mailing list