BGE Animations: FCurve Actuators are now converted to Action Actuators in do_versions...
authorMitchell Stokes <mogurijin@gmail.com>
Thu, 16 Jun 2011 01:57:39 +0000 (01:57 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Thu, 16 Jun 2011 01:57:39 +0000 (01:57 +0000)
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_actuator_types.h

index 1e604c45772fa884eccbf7a63ddf54363133e2ef..7c9dfc48fb00256891164199b4ec41b71ff208e3 100644 (file)
@@ -11662,8 +11662,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                }
+               
+               {
+                       /* convert fcurve actuator to action actuator */
+                       Object *ob;
+                       bActuator *act;
+                       bIpoActuator *ia;
+                       bActionActuator *aa;
+
+                       for (ob= main->object.first; ob; ob= ob->id.next) {
+                               for (act= ob->actuators.first; act; act= act->next) {
+                                       if (act->type == ACT_IPO) {
+                                               // Create the new actuator
+                                               ia= act->data;
+                                               aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
+
+                                               // Copy values
+                                               aa->type = ia->type;
+                                               aa->flag = ia->flag;
+                                               aa->sta = ia->sta;
+                                               aa->end = ia->end;
+                                               strcpy(aa->name, ia->name);
+                                               strcpy(aa->frameProp, ia->frameProp);
+                                               aa->act = ob->adt->action;
+
+                                               // Get rid of the old actuator
+                                               MEM_freeN(ia);
+
+                                               // Assign the new actuator
+                                               act->data = aa;
+                                               act->type= act->otype= ACT_ACTION;
+                                               
+                                       }
+                               }
+                       }
+               }
        }
-       
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
 
index b368aadf4c2d043e3d4b5ef8f787a665c6bfd6f1..071f66cddd66f87af181eb5bdfee4566e585199a 100644 (file)
@@ -122,6 +122,7 @@ typedef struct bObjectActuator {
        struct Object *reference;
 } bObjectActuator;
 
+/* deprecated, handled by bActionActuator now */
 typedef struct bIpoActuator {
        short flag, type;
        float sta, end;