diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-27 12:34:32 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-27 12:34:32 +0400 |
commit | e4530c47f04556bb0387eebc7acf0652eedde342 (patch) | |
tree | 1b25431de935a455836c380acb81c19a201c87df | |
parent | 6e92ddf8b37dbfae733a9738a20777917610b4a0 (diff) |
Logic Editor: fix for datablock counting when copying/deleting sound actuator
("bug" from 2.49)
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 5a06c251b88..3102d4b054b 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -44,6 +44,7 @@ #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_library.h" /* ******************* SENSORS ************************ */ @@ -348,7 +349,19 @@ void unlink_actuators(ListBase *lb) void free_actuator(bActuator *act) { - if(act->data) MEM_freeN(act->data); + bSoundActuator *sa; + + if(act->data) { + switch (act->type) { + case ACT_SOUND: + sa = (bSoundActuator *) act->data; + if(sa->sound) + id_us_min((ID *) sa->sound); + break; + } + + MEM_freeN(act->data); + } MEM_freeN(act); } @@ -365,6 +378,7 @@ void free_actuators(ListBase *lb) bActuator *copy_actuator(bActuator *act) { bActuator *actn; + bSoundActuator *sa; act->mynew=actn= MEM_dupallocN(act); actn->flag |= ACT_NEW; @@ -372,6 +386,13 @@ bActuator *copy_actuator(bActuator *act) actn->data= MEM_dupallocN(act->data); } + switch (act->type) { + case ACT_SOUND: + sa= (bSoundActuator *)act->data; + if(sa->sound) + id_us_plus((ID *) sa->sound); + break; + } return actn; } |