Bring copy/free operations into line with changes in previous commit
authorJoshua Leung <aligorith@gmail.com>
Sat, 14 Feb 2015 04:42:57 +0000 (17:42 +1300)
committerJoshua Leung <aligorith@gmail.com>
Sat, 14 Feb 2015 11:06:19 +0000 (00:06 +1300)
source/blender/blenkernel/intern/sca.c

index 4be7534413362842957979fb96096223fe6911f6..9159c9e9afc2571380e2e4f46e6c0d6905884136 100644 (file)
@@ -323,15 +323,23 @@ void unlink_actuators(ListBase *lb)
 
 void free_actuator(bActuator *act)
 {
-       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;
+                       case ACT_ACTION:
+                       case ACT_SHAPEACTION:
+                       {
+                               bActionActuator *aa = (bActionActuator *)act->data;
+                               if (aa->act)
+                                       id_us_min((ID *)aa->act);
+                               break;
+                       }
+                       case ACT_SOUND:
+                       {
+                               bSoundActuator *sa = (bSoundActuator *) act->data;
+                               if (sa->sound)
+                                       id_us_min((ID *)sa->sound);
+                               break;
+                       }
                }
 
                MEM_freeN(act->data);
@@ -351,7 +359,6 @@ void free_actuators(ListBase *lb)
 bActuator *copy_actuator(bActuator *act)
 {
        bActuator *actn;
-       bSoundActuator *sa;
        
        act->mynew=actn= MEM_dupallocN(act);
        actn->flag |= ACT_NEW;
@@ -360,11 +367,21 @@ bActuator *copy_actuator(bActuator *act)
        }
        
        switch (act->type) {
+               case ACT_ACTION:
+               case ACT_SHAPEACTION:
+               {
+                       bActionActuator *aa = (bActionActuator *)act->data;
+                       if (aa->act)
+                               id_us_plus((ID *)aa->act);
+                       break;
+               }
                case ACT_SOUND:
-                       sa= (bSoundActuator *)act->data;
+               {
+                       bSoundActuator *sa = (bSoundActuator *)act->data;
                        if (sa->sound)
-                               id_us_plus((ID *) sa->sound);
+                               id_us_plus((ID *)sa->sound);
                        break;
+               }
        }
        return actn;
 }