Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/object/object_relations.c42
-rw-r--r--source/blender/editors/transform/transform.c10
-rw-r--r--source/blender/editors/transform/transform_conversions.c16
-rw-r--r--source/blender/editors/transform/transform_generics.c1
4 files changed, 56 insertions, 13 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;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index fcbadf5b7a6..5ff80a62cee 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -307,8 +307,10 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
/* for realtime animation record - send notifiers recognised by animation editors */
+ // XXX: is this notifier a lame duck?
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
+
}
else if (t->spacetype == SPACE_ACTION) {
//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
@@ -341,7 +343,13 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
static void viewRedrawPost(TransInfo *t)
{
ED_area_headerprint(t->sa, NULL);
-
+
+ if(t->spacetype == SPACE_VIEW3D) {
+ /* if autokeying is enabled, send notifiers that keyframes were added */
+ if (IS_AUTOKEY_ON(t->scene))
+ WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
+ }
+
#if 0 // TRANSFORM_FIX_ME
if(t->spacetype==SPACE_VIEW3D) {
allqueue(REDRAWBUTSOBJECT, 0);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 6ad0b62dce0..9d0cfdc5ac0 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4607,8 +4607,20 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
/* only insert into available channels? */
else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
if (act) {
- for (fcu= act->curves.first; fcu; fcu= fcu->next)
- insert_keyframe(id, act, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+ for (fcu= act->curves.first; fcu; fcu= fcu->next) {
+ /* only insert keyframes for this F-Curve if it affects the current bone */
+ if (strstr(fcu->rna_path, "bones")) {
+ char *pchanName= BLI_getQuotedStr(fcu->rna_path, "bones[");
+
+ /* only if bone name matches too...
+ * NOTE: this will do constraints too, but those are ok to do here too?
+ */
+ if (pchanName && strcmp(pchanName, pchan->name) == 0)
+ insert_keyframe(id, act, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+
+ if (pchanName) MEM_freeN(pchanName);
+ }
+ }
}
}
/* only insert keyframe if needed? */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index f8f9dda8f1d..27eb48614d2 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -955,6 +955,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->animtimer= CTX_wm_screen(C)->animtimer;
/* turn manipulator off during transform */
+ // FIXME: but don't do this when USING the manipulator...
if (t->flag & T_MODAL) {
t->twtype = v3d->twtype;
v3d->twtype = 0;