diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-02-21 14:42:32 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-02-21 14:42:32 +0300 |
commit | ddc0c68a5c7187f33ec1fe0136e6509afd25cb29 (patch) | |
tree | fc3d20132a0559f2bc25b630c184d02545a98de3 /source/blender/editors/object/object_relations.c | |
parent | 02b2c2f39d85e7b7884bf8f4dbdfcd8777193702 (diff) |
Bugfix #21234: Autokey "insert only available" userpref inserts keys for all bones in an armature
--
Bugfix: When autokey is enabled, notifiers to refresh the animation editors *after* transforms finished for objects were missing.
While I understand the need to limit these to not doing this during transform, after transform, this lead to lag/inconsistent UI problems.
--
* Added 'Damped Track' Option to 'Make Track' Operator
* Improved the code of the 'Clear Track' operator to include other types of tracking constraint too
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b2ccd96f3a7..f55e7594c24 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -873,16 +873,18 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { + bConstraint *con, *pcon; + /* remove track-object for old track */ ob->track= NULL; ob->recalc |= OB_RECALC; - /* also remove all Track To constraints - * TODO: - * - do we only want to do the last instance (use 1 as last arg instead) - * - also, what about other forms of tracking? - */ - remove_constraints_type(&ob->constraints, CONSTRAINT_TYPE_TRACKTO, 0); + /* also remove all tracking constraints */ + for (con= ob->constraints.last; con; con= pcon) { + pcon= con->prev; + if (ELEM3(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK)) + remove_constraint(&ob->constraints, con); + } if(type == 1) ED_object_apply_obmat(ob); @@ -918,9 +920,10 @@ void OBJECT_OT_track_clear(wmOperatorType *ot) /************************** Make Track Operator *****************************/ static EnumPropertyItem prop_make_track_types[] = { - {1, "TRACKTO", 0, "TrackTo Constraint", ""}, - {2, "LOCKTRACK", 0, "LockTrack Constraint", ""}, - {3, "OLDTRACK", 0, "Old Track", ""}, + {1, "DAMPTRACK", 0, "Damped Track Constraint", ""}, + {2, "TRACKTO", 0, "Track To Constraint", ""}, + {3, "LOCKTRACK", 0, "Lock Track Constraint", ""}, + {4, "OLDTRACK", 0, "Old Track", ""}, {0, NULL, 0, NULL, NULL} }; @@ -933,6 +936,25 @@ static int track_set_exec(bContext *C, wmOperator *op) if(type == 1) { bConstraint *con; + bDampTrackConstraint *data; + + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { + if(ob!=obact) { + con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK); + + data = con->data; + data->tar = obact; + ob->recalc |= OB_RECALC; + + /* Lamp and Camera track differently by default */ + if (ob->type == OB_LAMP || ob->type == OB_CAMERA) + data->trackflag = TRACK_nZ; + } + } + CTX_DATA_END; + } + else if(type == 2) { + bConstraint *con; bTrackToConstraint *data; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -952,7 +974,7 @@ static int track_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; } - else if(type == 2) { + else if(type == 3) { bConstraint *con; bLockTrackConstraint *data; |