diff options
author | Martin Poirier <theeth@yahoo.com> | 2004-01-01 22:21:06 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2004-01-01 22:21:06 +0300 |
commit | 7f9097334409201a9534d214570d9b1a55ac9f16 (patch) | |
tree | 4c9f40eacd8ecfed514135a92f30d8d7f5be55c5 | |
parent | 4b6bc29bf27c49f3545eac13d922d1ef03c655a7 (diff) |
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!)
-rw-r--r-- | source/blender/makesdna/DNA_constraint_types.h | 4 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 6 |
2 files changed, 8 insertions, 2 deletions
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); } } |