Fix a problem that has been bugging me for a while. Tracking axis by default are...
authorMartin Poirier <theeth@yahoo.com>
Thu, 1 Jan 2004 19:21:06 +0000 (19:21 +0000)
committerMartin Poirier <theeth@yahoo.com>
Thu, 1 Jan 2004 19:21:06 +0000 (19:21 +0000)
Fixed by checking the object type and changing the up and track axis accordingly.

Also added some comments in the DNA file (recompiling makedna because of comments is fun!)

source/blender/makesdna/DNA_constraint_types.h
source/blender/src/editobject.c

index 1fb28fb8d87d6a7f0b7932a1623b707b0c8ae2ef..d48e18c177acbb7a3f2359c3a30332471645a296 100644 (file)
@@ -79,8 +79,8 @@ typedef struct bKinematicConstraint{
 
 typedef struct bTrackToConstraint{
        Object          *tar;
-       int                     reserved1;
-       int                     reserved2;
+       int                     reserved1; /* Track Axis */
+       int                     reserved2; /* Up Axis */
        char            subtarget[32];
 } bTrackToConstraint;
 
index 6db681d9d9fe55f596d4aa541ca526e943934673..71b3c4ec84416d9a9305f6a2f582d0fb5ae8633c 100644 (file)
@@ -288,6 +288,12 @@ void make_track(void)
                                        data = con->data;
                                        data->tar = BASACT->object;
 
+                                       /* Lamp and Camera track differently by default */
+                                       if (base->object->type == OB_LAMP || base->object->type == OB_CAMERA) {
+                                               data->reserved1 = TRACK_nZ;
+                                               data->reserved2 = UP_Y;
+                                       }
+
                                        add_constraint_to_object(con, base->object);
                                }
                        }