patch: 'set the right Action Actuator when duplicating an object' by Daniel Macedo

bug and patch not in tracker. little fix by me (replace while loop by for(...;act;...). Thanks Daniel ;)
This commit is contained in:
Dalai Felinto 2012-01-21 23:57:28 +00:00
parent 83b1f21cf9
commit 2139c7080e

@ -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"
@ -1789,10 +1790,22 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
/* check if obdata is copied */
if(didit) {
Key *key = ob_get_key(obn);
bActuator *act;
if(dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action((ID *)obn->data);
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;
}
}
act= act->next;
}
}
if(dupflag & USER_DUP_MAT) {