[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16674] trunk/blender/source/blender/src/ editobject.c: Bugfix #14428: Constraints lost when object made single user

Joshua Leung aligorith at gmail.com
Mon Sep 22 15:01:59 CEST 2008


Revision: 16674
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16674
Author:   aligorith
Date:     2008-09-22 15:01:51 +0200 (Mon, 22 Sep 2008)

Log Message:
-----------
Bugfix #14428: Constraints lost when object made single user

When there was a setup where an object was linked to more than one scene at once, and in one of those scenes some of the objects in that scene were related to it, the objects related to it were not correctly relinked to the new copy. 

This was due to the 2nd check for selected objects 
if( (base->flag & flag)==flag)
meaning that only selected objects would get corrected.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editobject.c

Modified: trunk/blender/source/blender/src/editobject.c
===================================================================
--- trunk/blender/source/blender/src/editobject.c	2008-09-22 12:31:27 UTC (rev 16673)
+++ trunk/blender/source/blender/src/editobject.c	2008-09-22 13:01:51 UTC (rev 16674)
@@ -4381,18 +4381,17 @@
 	
 	clear_sca_new_poins();	/* sensor/contr/act */
 
-	/* duplicate */
+	/* duplicate (must set newid) */
 	base= FIRSTBASE;
 	while(base) {
 		ob= base->object;
 		
-		if( (base->flag & flag)==flag) {
-
+		if( (base->flag & flag)==flag ) {
 			if(ob->id.lib==NULL && ob->id.us>1) {
-			
+				/* base gets copy of object */
 				obn= copy_object(ob);
-				ob->id.us--;
 				base->object= obn;
+				ob->id.us--;
 			}
 		}
 		base= base->next;
@@ -4406,20 +4405,17 @@
 	while(base) {
 		ob= base->object;
 		if(ob->id.lib==NULL) {
-			if( (base->flag & flag)==flag) {
-				
-				relink_constraints(&base->object->constraints);
-				if (base->object->pose){
-					bPoseChannel *chan;
-					for (chan = base->object->pose->chanbase.first; chan; chan=chan->next){
-						relink_constraints(&chan->constraints);
-					}
+			relink_constraints(&base->object->constraints);
+			if (base->object->pose){
+				bPoseChannel *chan;
+				for (chan = base->object->pose->chanbase.first; chan; chan=chan->next){
+					relink_constraints(&chan->constraints);
 				}
-				modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL);
-				
-				ID_NEW(ob->parent);
-				ID_NEW(ob->track);
 			}
+			modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL);
+			
+			ID_NEW(ob->parent);
+			ID_NEW(ob->track);
 		}
 		base= base->next;
 	}





More information about the Bf-blender-cvs mailing list