From 7f9097334409201a9534d214570d9b1a55ac9f16 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Thu, 1 Jan 2004 19:21:06 +0000 Subject: Fix a problem that has been bugging me for a while. Tracking axis by default are different for Lamp and Camera than for the rest. For the constraint, it wasn't using the correct ones for them, so obviously, it didn't track correctly by default. 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 | 4 ++-- source/blender/src/editobject.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 1fb28fb8d87..d48e18c177a 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -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; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 6db681d9d9f..71b3c4ec844 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -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); } } -- cgit v1.2.3