BGE: TrackTo actuator: increasing up & track axis options
[blender.git] / source / blender / blenloader / intern / versioning_270.c
index 103f9b76ba7cb19de9d4f5f3335242d5d7a87bde..dde16c8d44f711e866e849f4a2f20445b67d446c 100644 (file)
@@ -42,6 +42,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_linestyle_types.h"
+#include "DNA_actuator_types.h"
 
 #include "DNA_genfile.h"
 
@@ -310,6 +311,29 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                }
        }
 
+       if (!MAIN_VERSION_ATLEAST(main, 271, 2)) {
+               /* init up & track axis property of trackto actuators */
+               Object *ob;
+
+               for (ob = main->object.first; ob; ob = ob->id.next) {
+                       bActuator *act;
+                       for (act = ob->actuators.first; act; act = act->next) {
+                               if (act->type == ACT_EDIT_OBJECT) {
+                                       bEditObjectActuator *eoact = act->data;
+                                       eoact->trackflag = ob->trackflag;
+                                       /* if trackflag is pointing +-Z axis then upflag should point Y axis.
+                                        * Rest of trackflag cases, upflag should be point z axis */
+                                       if ((ob->trackflag == OB_POSZ) || (ob->trackflag == OB_NEGZ)) {
+                                               eoact->upflag = 1;
+                                       }
+                                       else {
+                                               eoact->upflag = 2;
+                                       }
+                               }
+                       }
+               }
+       }
+
        if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
                Scene *scene;
                for (scene = main->scene.first; scene; scene = scene->id.next) {