[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39429] branches/soc-2011-pepper/source/ blender: Bugfix [#28267] keyframed values for shapekeys of copied objects are

Joshua Leung aligorith at gmail.com
Tue Aug 16 03:02:28 CEST 2011


Revision: 39429
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39429
Author:   aligorith
Date:     2011-08-16 01:02:26 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Bugfix [#28267] keyframed values for shapekeys of copied objects are
linked

Shapekey actions weren't getting copied when their owner data was.

This was due to the IMO totally convoluted way in which the duplicate
action flags have been set up:
- the function to copy animdata takes a param to specify whether
actions are copied or not, but this is never touched (i.e. this always
just gets FALSE passed in)
- instead, we jump around in hoops later figuring out whether the
userpref wants copying to occur, then fixing up the links

IIRC, part of this may be due to a desire/need to not duplicate
actions when dealing with NodeTree copies for multi-threaded
rendering, but at the expense of complicating everything else.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/fmodifier.c
    branches/soc-2011-pepper/source/blender/editors/object/object_add.c

Modified: branches/soc-2011-pepper/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2011-pepper/source/blender/blenkernel/intern/anim_sys.c	2011-08-15 23:38:51 UTC (rev 39428)
+++ branches/soc-2011-pepper/source/blender/blenkernel/intern/anim_sys.c	2011-08-16 01:02:26 UTC (rev 39429)
@@ -287,7 +287,7 @@
 	return 1;
 }
 
-void BKE_copy_animdata_id_action(struct ID *id)
+void BKE_copy_animdata_id_action(ID *id)
 {
 	AnimData *adt= BKE_animdata_from_id(id);
 	if (adt) {

Modified: branches/soc-2011-pepper/source/blender/blenkernel/intern/fmodifier.c
===================================================================
--- branches/soc-2011-pepper/source/blender/blenkernel/intern/fmodifier.c	2011-08-15 23:38:51 UTC (rev 39428)
+++ branches/soc-2011-pepper/source/blender/blenkernel/intern/fmodifier.c	2011-08-16 01:02:26 UTC (rev 39429)
@@ -604,7 +604,7 @@
 			
 		/* calculate the 'number' of the cycle */
 		cycle= ((float)side * (evaltime - ofs) / cycdx);
-
+		
 		/* calculate the time inside the cycle */
 		cyct= fmod(evaltime - ofs, cycdx);
 		

Modified: branches/soc-2011-pepper/source/blender/editors/object/object_add.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/object/object_add.c	2011-08-15 23:38:51 UTC (rev 39428)
+++ branches/soc-2011-pepper/source/blender/editors/object/object_add.c	2011-08-16 01:02:26 UTC (rev 39429)
@@ -39,6 +39,7 @@
 #include "DNA_curve_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
+#include "DNA_key_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
@@ -65,6 +66,7 @@
 #include "BKE_group.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h"
+#include "BKE_key.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_mball.h"
@@ -1496,28 +1498,6 @@
 		}
 		
 		/* duplicates using userflags */
-#if 0 // XXX old animation system				
-		if(dupflag & USER_DUP_IPO) {
-			bConstraintChannel *chan;
-			id= (ID *)obn->ipo;
-			
-			if(id) {
-				ID_NEW_US( obn->ipo)
-				else obn->ipo= copy_ipo(obn->ipo);
-				id->us--;
-			}
-			/* Handle constraint ipos */
-			for (chan=obn->constraintChannels.first; chan; chan=chan->next){
-				id= (ID *)chan->ipo;
-				if(id) {
-					ID_NEW_US( chan->ipo)
-					else chan->ipo= copy_ipo(chan->ipo);
-					id->us--;
-				}
-			}
-		}
-#endif // XXX old animation system
-		
 		if(dupflag & USER_DUP_ACT) {
 			BKE_copy_animdata_id_action(&obn->id);
 		}
@@ -1674,8 +1654,11 @@
 
 		/* check if obdata is copied */
 		if(didit) {
+			Key *key = ob_get_key(obn);
+			
 			if(dupflag & USER_DUP_ACT) {
 				BKE_copy_animdata_id_action((ID *)obn->data);
+				if(key) BKE_copy_animdata_id_action((ID*)key);
 			}
 			
 			if(dupflag & USER_DUP_MAT) {




More information about the Bf-blender-cvs mailing list