svn merge ^/trunk/blender -r43564:43609
[blender.git] / source / blender / editors / object / object_add.c
index f96da9e5b07b9f4b437e0eba94ec8e2ef951f691..1b289732302baba70707a77a20c6edb711f97fff 100644 (file)
@@ -46,6 +46,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_speaker_types.h"
 #include "DNA_vfont_types.h"
+#include "DNA_actuator_types.h"
 
 #include "BLI_ghash.h"
 #include "BLI_listbase.h"
@@ -1795,8 +1796,22 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
                        Key *key = ob_get_key(obn);
                        
                        if(dupflag & USER_DUP_ACT) {
+                               bActuator *act;
+
                                BKE_copy_animdata_id_action((ID *)obn->data);
-                               if(key) BKE_copy_animdata_id_action((ID*)key);
+                               if(key) {
+                                       BKE_copy_animdata_id_action((ID*)key);
+                               }
+
+                               /* Update the duplicated action in the action actuators */
+                               for (act = obn->actuators.first; act; act = act->next) {
+                                       if(act->type == ACT_ACTION) {
+                                               bActionActuator* actact = (bActionActuator*) act->data;
+                                               if(actact->act == ob->adt->action) {
+                                                       actact->act = obn->adt->action;
+                                               }
+                                       }
+                               }
                        }
                        
                        if(dupflag & USER_DUP_MAT) {