[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27050] trunk/blender/source/blender/ editors: Bugfix #21234: Autokey "insert only available" userpref inserts keys for all bones in an armature
Joshua Leung
aligorith at gmail.com
Sun Feb 21 12:42:32 CET 2010
Revision: 27050
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27050
Author: aligorith
Date: 2010-02-21 12:42:32 +0100 (Sun, 21 Feb 2010)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/editors/object/object_relations.c
trunk/blender/source/blender/editors/transform/transform.c
trunk/blender/source/blender/editors/transform/transform_conversions.c
trunk/blender/source/blender/editors/transform/transform_generics.c
Modified: trunk/blender/source/blender/editors/object/object_relations.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_relations.c 2010-02-21 11:07:06 UTC (rev 27049)
+++ trunk/blender/source/blender/editors/object/object_relations.c 2010-02-21 11:42:32 UTC (rev 27050)
@@ -873,16 +873,18 @@
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 @@
/************************** 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 @@
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 @@
}
CTX_DATA_END;
}
- else if(type == 2) {
+ else if(type == 3) {
bConstraint *con;
bLockTrackConstraint *data;
Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c 2010-02-21 11:07:06 UTC (rev 27049)
+++ trunk/blender/source/blender/editors/transform/transform.c 2010-02-21 11:42:32 UTC (rev 27050)
@@ -307,8 +307,10 @@
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 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);
Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c 2010-02-21 11:07:06 UTC (rev 27049)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c 2010-02-21 11:42:32 UTC (rev 27050)
@@ -4607,8 +4607,20 @@
/* 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? */
Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c 2010-02-21 11:07:06 UTC (rev 27049)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c 2010-02-21 11:42:32 UTC (rev 27050)
@@ -955,6 +955,7 @@
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;
More information about the Bf-blender-cvs
mailing list