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:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
commit981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch)
tree70800c93ec1a12579c32874e2a72eaf3290eba8e /source/blender/editors/transform
parent5b91a783cf0ec132398a2767d3419d675e5126b5 (diff)
parent2365c64014b3e067bb212b2061f1d14c1f944090 (diff)
merge with trunk r39834
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c48
-rw-r--r--source/blender/editors/transform/transform_conversions.c41
-rw-r--r--source/blender/editors/transform/transform_generics.c910
-rw-r--r--source/blender/editors/transform/transform_ops.c2
4 files changed, 527 insertions, 474 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 31ea15925f0..c9f0113691f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1359,16 +1359,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
ToolSettings *ts = CTX_data_tool_settings(C);
int constraint_axis[3] = {0, 0, 0};
int proportional = 0;
+ PropertyRNA *prop;
- if (RNA_struct_find_property(op->ptr, "value"))
- {
- if (t->flag & T_AUTOVALUES)
- {
- RNA_float_set_array(op->ptr, "value", t->auto_values);
+ if ((prop= RNA_struct_find_property(op->ptr, "value"))) {
+ float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values;
+ if (RNA_property_array_check(prop)) {
+ RNA_property_float_set_array(op->ptr, prop, values);
}
- else
- {
- RNA_float_set_array(op->ptr, "value", t->values);
+ else {
+ RNA_property_float_set(op->ptr, prop, values[0]);
}
}
@@ -1945,12 +1944,15 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
/* ******************* TRANSFORM LIMITS ********************** */
-static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
+static void constraintTransLim(TransInfo *t, TransData *td)
{
if (td->con) {
- bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
+ bConstraintTypeInfo *ctiLoc= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
+ bConstraintTypeInfo *ctiDist= get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT);
+
bConstraintOb cob= {NULL};
bConstraint *con;
+ float ctime = (float)(t->scene->r.cfra);
/* Make a temporary bConstraintOb for using these limit constraints
* - they only care that cob->matrix is correctly set ;-)
@@ -1961,6 +1963,8 @@ static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
/* Evaluate valid constraints */
for (con= td->con; con; con= con->next) {
+ bConstraintTypeInfo *cti = NULL;
+ ListBase targets = {NULL, NULL};
float tmat[4][4];
/* only consider constraint if enabled */
@@ -1973,7 +1977,17 @@ static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
if ((data->flag2 & LIMIT_TRANSFORM)==0)
continue;
+ cti = ctiLoc;
+ }
+ else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) {
+ bDistLimitConstraint *data= con->data;
+ if ((data->flag & LIMITDIST_TRANSFORM)==0)
+ continue;
+ cti = ctiDist;
+ }
+
+ if (cti) {
/* do space conversions */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
@@ -1985,8 +1999,11 @@ static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
continue;
}
+ /* get constraint targets if needed */
+ get_constraint_targets_for_solving(con, &cob, &targets, ctime);
+
/* do constraint */
- cti->evaluate_constraint(con, &cob, NULL);
+ cti->evaluate_constraint(con, &cob, &targets);
/* convert spaces again */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
@@ -1994,6 +2011,9 @@ static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
copy_m4_m4(tmat, cob.matrix);
mul_m4_m3m4(cob.matrix, td->smtx, tmat);
}
+
+ /* free targets list */
+ BLI_freelistN(&targets);
}
}
@@ -4652,7 +4672,7 @@ static int createSlideVerts(TransInfo *t)
uv_new = tf->uv[k];
if (ev->tmp.l) {
- if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
+ if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
ev->tmp.l = -1; /* Tag as invalid */
BLI_linklist_free(suv->fuv_list,NULL);
suv->fuv_list = NULL;
@@ -5713,8 +5733,8 @@ int TimeSlide(TransInfo *t, const int mval[2])
char str[200];
/* calculate mouse co-ordinates */
- UI_view2d_region_to_view(v2d, mval[0], mval[0], &cval[0], &cval[1]);
- UI_view2d_region_to_view(v2d, t->imval[0], t->imval[0], &sval[0], &sval[1]);
+ UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
+ UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &sval[0], &sval[1]);
/* t->values[0] stores cval[0], which is the current mouse-pointer location (in frames) */
// XXX Need to be able to repeat this
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 0a5e290643a..7b43d0955a7 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2486,6 +2486,7 @@ static short FrameOnMouseSide(char side, float frame, float cframe)
static void createTransNlaData(bContext *C, TransInfo *t)
{
Scene *scene= t->scene;
+ SpaceNla *snla = NULL;
TransData *td = NULL;
TransDataNla *tdn = NULL;
@@ -2499,9 +2500,10 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
+ snla = (SpaceNla *)ac.sl;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
@@ -2584,7 +2586,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
tdn->strip= strip;
tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt);
- yval= (float)(tdn->trackIndex * NLACHANNEL_STEP);
+ yval= (float)(tdn->trackIndex * NLACHANNEL_STEP(snla));
tdn->h1[0]= strip->start;
tdn->h1[1]= yval;
@@ -2688,7 +2690,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
static void posttrans_gpd_clean (bGPdata *gpd)
{
bGPDlayer *gpl;
-
+
for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
ListBase sel_buffer = {NULL, NULL};
bGPDframe *gpf, *gpfn;
@@ -2841,7 +2843,7 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
ANIM_animdata_filter(ac, &anim_data, filter, act, ANIMCONT_ACTION);
/* loop through relevant data, removing keyframes as appropriate
@@ -2849,7 +2851,7 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act)
*/
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(ac, ale);
-
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
posttrans_fcurve_clean(ale->key_data);
@@ -3043,9 +3045,9 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* filter data */
if (ac.datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
@@ -3138,12 +3140,18 @@ static void createTransActionData(bContext *C, TransInfo *t)
float min=999999999.0f, max=-999999999.0f;
int i;
- td= (t->data + 1);
- for (i=1; i < count; i+=3, td+=3) {
+ td= t->data;
+ for (i=0; i < count; i++, td++) {
if (min > *(td->val)) min= *(td->val);
if (max < *(td->val)) max= *(td->val);
}
+ if (min == max) {
+ /* just use the current frame ranges */
+ min = (float)PSFRA;
+ max = (float)PEFRA;
+ }
+
/* minx/maxx values used by TimeSlide are stored as a
* calloced 2-float array in t->customData. This gets freed
* in postTrans (T_FREE_CUSTOMDATA).
@@ -3264,7 +3272,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
return;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
@@ -3444,7 +3452,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
- if ((bezt->h1 == HD_AUTO) && (bezt->h2 == HD_AUTO) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
bezt->h2= HD_ALIGN;
@@ -4783,7 +4791,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (ELEM(ac.datatype, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -4850,7 +4858,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
- if (ID_REAL_USERS(gpd) > 1)
+ if (ID_REAL_USERS(gpd))
posttrans_gpd_clean(gpd);
}
}
@@ -4878,7 +4886,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
/* make sure all F-Curves are set correctly */
- ANIM_editkeyframes_refresh(&ac);
+ if (ac.datatype != ANIMCONT_GPENCIL)
+ ANIM_editkeyframes_refresh(&ac);
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
@@ -4895,7 +4904,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -4945,7 +4954,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NLATRACKS);
+ short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 306796efee9..ec76bb3ac35 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -323,524 +323,548 @@ static int fcu_test_selected(FCurve *fcu)
return 0;
}
-/* called for updating while transform acts, once per redraw */
-void recalcData(TransInfo *t)
+/* helper for recalcData() - for Action Editor transforms */
+static void recalcData_actedit(TransInfo *t)
{
- Base *base = t->scene->basact;
-
- if (t->spacetype==SPACE_NODE) {
- flushTransNodes(t);
- }
- else if (t->spacetype==SPACE_SEQ) {
- flushTransSeq(t);
+ Scene *scene= t->scene;
+ SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
+
+ bAnimContext ac= {NULL};
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ /* initialise relevant anim-context 'context' data from TransInfo data */
+ /* NOTE: sync this with the code in ANIM_animdata_get_context() */
+ ac.scene= t->scene;
+ ac.obact= OBACT;
+ ac.sa= t->sa;
+ ac.ar= t->ar;
+ ac.sl= (t->sa)? t->sa->spacedata.first : NULL;
+ ac.spacetype= (t->sa)? t->sa->spacetype : 0;
+ ac.regiontype= (t->ar)? t->ar->regiontype : 0;
+
+ ANIM_animdata_context_getdata(&ac);
+
+ /* perform flush */
+ if (ac.datatype == ANIMCONT_GPENCIL) {
+ /* flush transform values back to actual coordinates */
+ flushTransGPactionData(t);
}
- else if (t->spacetype == SPACE_ACTION) {
- Scene *scene= t->scene;
- SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
-
- bAnimContext ac= {NULL};
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
- int filter;
-
- /* initialise relevant anim-context 'context' data from TransInfo data */
- /* NOTE: sync this with the code in ANIM_animdata_get_context() */
- ac.scene= t->scene;
- ac.obact= OBACT;
- ac.sa= t->sa;
- ac.ar= t->ar;
- ac.spacetype= (t->sa)? t->sa->spacetype : 0;
- ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
- ANIM_animdata_context_getdata(&ac);
+ else {
+ /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- /* perform flush */
- if (ac.datatype == ANIMCONT_GPENCIL) {
- /* flush transform values back to actual coordinates */
- flushTransGPactionData(t);
- }
- else {
- /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA);
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
- /* just tag these animdata-blocks to recalc, assuming that some data there changed
- * BUT only do this if realtime updates are enabled
- */
- if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
- for (ale= anim_data.first; ale; ale= ale->next) {
- /* set refresh tags for objects using this animation */
- ANIM_list_elem_update(t->scene, ale);
- }
+ /* just tag these animdata-blocks to recalc, assuming that some data there changed
+ * BUT only do this if realtime updates are enabled
+ */
+ if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ /* set refresh tags for objects using this animation */
+ ANIM_list_elem_update(t->scene, ale);
}
-
- /* now free temp channels */
- BLI_freelistN(&anim_data);
}
- }
- else if (t->spacetype == SPACE_IPO) {
- Scene *scene;
- SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
- ListBase anim_data = {NULL, NULL};
- bAnimContext ac;
- int filter;
+ /* now free temp channels */
+ BLI_freelistN(&anim_data);
+ }
+}
+
+/* helper for recalcData() - for Graph Editor transforms */
+static void recalcData_graphedit(TransInfo *t)
+{
+ SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
+ Scene *scene;
+
+ ListBase anim_data = {NULL, NULL};
+ bAnimContext ac= {NULL};
+ int filter;
+
+ bAnimListElem *ale;
+ int dosort = 0;
+
+
+ /* initialise relevant anim-context 'context' data from TransInfo data */
+ /* NOTE: sync this with the code in ANIM_animdata_get_context() */
+ scene= ac.scene= t->scene;
+ ac.obact= OBACT;
+ ac.sa= t->sa;
+ ac.ar= t->ar;
+ ac.sl= (t->sa)? t->sa->spacedata.first : NULL;
+ ac.spacetype= (t->sa)? t->sa->spacetype : 0;
+ ac.regiontype= (t->ar)? t->ar->regiontype : 0;
+
+ ANIM_animdata_context_getdata(&ac);
+
+ /* do the flush first */
+ flushTransGraphData(t);
+
+ /* get curves to check if a re-sort is needed */
+ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* now test if there is a need to re-sort */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ FCurve *fcu= (FCurve *)ale->key_data;
- bAnimListElem *ale;
- int dosort = 0;
+ /* ignore unselected fcurves */
+ if (!fcu_test_selected(fcu))
+ continue;
+ // fixme: only do this for selected verts...
+ ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS|ANIM_UNITCONV_RESTORE);
- /* initialise relevant anim-context 'context' data from TransInfo data */
- /* NOTE: sync this with the code in ANIM_animdata_get_context() */
- memset(&ac, 0, sizeof(bAnimContext));
- scene= ac.scene= t->scene;
- ac.obact= OBACT;
- ac.sa= t->sa;
- ac.ar= t->ar;
- ac.spacetype= (t->sa)? t->sa->spacetype : 0;
- ac.regiontype= (t->ar)? t->ar->regiontype : 0;
+ /* watch it: if the time is wrong: do not correct handles yet */
+ if (test_time_fcurve(fcu))
+ dosort++;
+ else
+ calchandles_fcurve(fcu);
- ANIM_animdata_context_getdata(&ac);
+ /* set refresh tags for objects using this animation,
+ * BUT only if realtime updates are enabled
+ */
+ if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
+ ANIM_list_elem_update(t->scene, ale);
+ }
+
+ /* do resort and other updates? */
+ if (dosort) remake_graph_transdata(t, &anim_data);
+
+ /* now free temp channels */
+ BLI_freelistN(&anim_data);
+}
+
+/* helper for recalcData() - for NLA Editor transforms */
+static void recalcData_nla(TransInfo *t)
+{
+ TransDataNla *tdn= (TransDataNla *)t->customData;
+ SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
+ Scene *scene= t->scene;
+ double secf= FPS;
+ int i;
+
+ /* for each strip we've got, perform some additional validation of the values that got set before
+ * using RNA to set the value (which does some special operations when setting these values to make
+ * sure that everything works ok)
+ */
+ for (i = 0; i < t->total; i++, tdn++) {
+ NlaStrip *strip= tdn->strip;
+ PointerRNA strip_ptr;
+ short pExceeded, nExceeded, iter;
+ int delta_y1, delta_y2;
- /* do the flush first */
- flushTransGraphData(t);
+ /* if this tdn has no handles, that means it is just a dummy that should be skipped */
+ if (tdn->handle == 0)
+ continue;
- /* get curves to check if a re-sort is needed */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ /* set refresh tags for objects using this animation,
+ * BUT only if realtime updates are enabled
+ */
+ if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
+ ANIM_id_update(t->scene, tdn->id);
- /* now test if there is a need to re-sort */
- for (ale= anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->key_data;
+ /* if cancelling transform, just write the values without validating, then move on */
+ if (t->state == TRANS_CANCEL) {
+ /* clear the values by directly overwriting the originals, but also need to restore
+ * endpoints of neighboring transition-strips
+ */
- /* ignore unselected fcurves */
- if (!fcu_test_selected(fcu))
- continue;
+ /* start */
+ strip->start= tdn->h1[0];
- // fixme: only do this for selected verts...
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS|ANIM_UNITCONV_RESTORE);
+ if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
+ strip->prev->end= tdn->h1[0];
+ /* end */
+ strip->end= tdn->h2[0];
- /* watch it: if the time is wrong: do not correct handles yet */
- if (test_time_fcurve(fcu))
- dosort++;
- else
- calchandles_fcurve(fcu);
+ if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
+ strip->next->start= tdn->h2[0];
- /* set refresh tags for objects using this animation,
- * BUT only if realtime updates are enabled
- */
- if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
- ANIM_list_elem_update(t->scene, ale);
+ /* flush transforms to child strips (since this should be a meta) */
+ BKE_nlameta_flush_transforms(strip);
+
+ /* restore to original track (if needed) */
+ if (tdn->oldTrack != tdn->nlt) {
+ /* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
+ BLI_remlink(&tdn->nlt->strips, strip);
+ BLI_addtail(&tdn->oldTrack->strips, strip);
+ }
+
+ continue;
}
- /* do resort and other updates? */
- if (dosort) remake_graph_transdata(t, &anim_data);
-
- /* now free temp channels */
- BLI_freelistN(&anim_data);
- }
- else if (t->spacetype == SPACE_NLA) {
- TransDataNla *tdn= (TransDataNla *)t->customData;
- SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
- Scene *scene= t->scene;
- double secf= FPS;
- int i;
-
- /* for each strip we've got, perform some additional validation of the values that got set before
- * using RNA to set the value (which does some special operations when setting these values to make
- * sure that everything works ok)
+ /* firstly, check if the proposed transform locations would overlap with any neighbouring strips
+ * (barring transitions) which are absolute barriers since they are not being moved
+ *
+ * this is done as a iterative procedure (done 5 times max for now)
*/
- for (i = 0; i < t->total; i++, tdn++) {
- NlaStrip *strip= tdn->strip;
- PointerRNA strip_ptr;
- short pExceeded, nExceeded, iter;
- int delta_y1, delta_y2;
-
- /* if this tdn has no handles, that means it is just a dummy that should be skipped */
- if (tdn->handle == 0)
- continue;
+ for (iter=0; iter < 5; iter++) {
+ pExceeded= ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end));
+ nExceeded= ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start));
- /* set refresh tags for objects using this animation,
- * BUT only if realtime updates are enabled
- */
- if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
- ANIM_id_update(t->scene, tdn->id);
-
- /* if cancelling transform, just write the values without validating, then move on */
- if (t->state == TRANS_CANCEL) {
- /* clear the values by directly overwriting the originals, but also need to restore
- * endpoints of neighboring transition-strips
+ if ((pExceeded && nExceeded) || (iter == 4) ) {
+ /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
+ * - simply crop strip to fit within the bounds of the strips bounding it
+ * - if there were no neighbours, clear the transforms (make it default to the strip's current values)
*/
-
- /* start */
- strip->start= tdn->h1[0];
-
- if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
- strip->prev->end= tdn->h1[0];
-
- /* end */
- strip->end= tdn->h2[0];
-
- if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
- strip->next->start= tdn->h2[0];
-
- /* flush transforms to child strips (since this should be a meta) */
- BKE_nlameta_flush_transforms(strip);
-
- /* restore to original track (if needed) */
- if (tdn->oldTrack != tdn->nlt) {
- /* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
- BLI_remlink(&tdn->nlt->strips, strip);
- BLI_addtail(&tdn->oldTrack->strips, strip);
+ if (strip->prev && strip->next) {
+ tdn->h1[0]= strip->prev->end;
+ tdn->h2[0]= strip->next->start;
+ }
+ else {
+ tdn->h1[0]= strip->start;
+ tdn->h2[0]= strip->end;
}
-
- continue;
}
-
- /* firstly, check if the proposed transform locations would overlap with any neighbouring strips
- * (barring transitions) which are absolute barriers since they are not being moved
- *
- * this is done as a iterative procedure (done 5 times max for now)
- */
- for (iter=0; iter < 5; iter++) {
- pExceeded= ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end));
- nExceeded= ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start));
+ else if (nExceeded) {
+ /* move backwards */
+ float offset= tdn->h2[0] - strip->next->start;
- if ((pExceeded && nExceeded) || (iter == 4) ) {
- /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
- * - simply crop strip to fit within the bounds of the strips bounding it
- * - if there were no neighbours, clear the transforms (make it default to the strip's current values)
- */
- if (strip->prev && strip->next) {
- tdn->h1[0]= strip->prev->end;
- tdn->h2[0]= strip->next->start;
- }
- else {
- tdn->h1[0]= strip->start;
- tdn->h2[0]= strip->end;
- }
- }
- else if (nExceeded) {
- /* move backwards */
- float offset= tdn->h2[0] - strip->next->start;
-
- tdn->h1[0] -= offset;
- tdn->h2[0] -= offset;
- }
- else if (pExceeded) {
- /* more forwards */
- float offset= strip->prev->end - tdn->h1[0];
-
- tdn->h1[0] += offset;
- tdn->h2[0] += offset;
- }
- else /* all is fine and well */
- break;
+ tdn->h1[0] -= offset;
+ tdn->h2[0] -= offset;
}
-
- /* handle auto-snapping */
- switch (snla->autosnap) {
- case SACTSNAP_FRAME: /* snap to nearest frame/time */
- if (snla->flag & SNLA_DRAWTIME) {
- tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf );
- tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf );
- }
- else {
- tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) );
- tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) );
- }
- break;
+ else if (pExceeded) {
+ /* more forwards */
+ float offset= strip->prev->end - tdn->h1[0];
- case SACTSNAP_MARKER: /* snap to nearest marker */
- tdn->h1[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
- tdn->h2[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]);
- break;
+ tdn->h1[0] += offset;
+ tdn->h2[0] += offset;
}
+ else /* all is fine and well */
+ break;
+ }
+
+ /* handle auto-snapping */
+ switch (snla->autosnap) {
+ case SACTSNAP_FRAME: /* snap to nearest frame/time */
+ if (snla->flag & SNLA_DRAWTIME) {
+ tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf );
+ tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf );
+ }
+ else {
+ tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) );
+ tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) );
+ }
+ break;
- /* use RNA to write the values... */
- // TODO: do we need to write in 2 passes to make sure that no truncation goes on?
- RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
-
- RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
- RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
-
- /* flush transforms to child strips (since this should be a meta) */
- BKE_nlameta_flush_transforms(strip);
-
+ case SACTSNAP_MARKER: /* snap to nearest marker */
+ tdn->h1[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
+ tdn->h2[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]);
+ break;
+ }
+
+ /* use RNA to write the values... */
+ // TODO: do we need to write in 2 passes to make sure that no truncation goes on?
+ RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
+
+ RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
+ RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
+
+ /* flush transforms to child strips (since this should be a meta) */
+ BKE_nlameta_flush_transforms(strip);
+
+
+ /* now, check if we need to try and move track
+ * - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
+ */
+ delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
+ delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
+
+ if (delta_y1 || delta_y2) {
+ NlaTrack *track;
+ int delta = (delta_y2) ? delta_y2 : delta_y1;
+ int n;
- /* now, check if we need to try and move track
- * - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
+ /* move in the requested direction, checking at each layer if there's space for strip to pass through,
+ * stopping on the last track available or that we're able to fit in
*/
- delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP - tdn->trackIndex);
- delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP - tdn->trackIndex);
-
- if (delta_y1 || delta_y2) {
- NlaTrack *track;
- int delta = (delta_y2) ? delta_y2 : delta_y1;
- int n;
-
- /* move in the requested direction, checking at each layer if there's space for strip to pass through,
- * stopping on the last track available or that we're able to fit in
- */
- if (delta > 0) {
- for (track=tdn->nlt->next, n=0; (track) && (n < delta); track=track->next, n++) {
- /* check if space in this track for the strip */
- if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
- /* move strip to this track */
- BLI_remlink(&tdn->nlt->strips, strip);
- BKE_nlatrack_add_strip(track, strip);
-
- tdn->nlt= track;
- tdn->trackIndex++;
- }
- else /* can't move any further */
- break;
+ if (delta > 0) {
+ for (track=tdn->nlt->next, n=0; (track) && (n < delta); track=track->next, n++) {
+ /* check if space in this track for the strip */
+ if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
+ /* move strip to this track */
+ BLI_remlink(&tdn->nlt->strips, strip);
+ BKE_nlatrack_add_strip(track, strip);
+
+ tdn->nlt= track;
+ tdn->trackIndex++;
}
+ else /* can't move any further */
+ break;
}
- else {
- /* make delta 'positive' before using it, since we now know to go backwards */
- delta= -delta;
-
- for (track=tdn->nlt->prev, n=0; (track) && (n < delta); track=track->prev, n++) {
- /* check if space in this track for the strip */
- if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
- /* move strip to this track */
- BLI_remlink(&tdn->nlt->strips, strip);
- BKE_nlatrack_add_strip(track, strip);
-
- tdn->nlt= track;
- tdn->trackIndex--;
- }
- else /* can't move any further */
- break;
+ }
+ else {
+ /* make delta 'positive' before using it, since we now know to go backwards */
+ delta= -delta;
+
+ for (track=tdn->nlt->prev, n=0; (track) && (n < delta); track=track->prev, n++) {
+ /* check if space in this track for the strip */
+ if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
+ /* move strip to this track */
+ BLI_remlink(&tdn->nlt->strips, strip);
+ BKE_nlatrack_add_strip(track, strip);
+
+ tdn->nlt= track;
+ tdn->trackIndex--;
}
+ else /* can't move any further */
+ break;
}
}
}
}
- else if (t->spacetype == SPACE_IMAGE) {
- if (t->obedit && t->obedit->type == OB_MESH) {
- SpaceImage *sima= t->sa->spacedata.first;
+}
+
+/* helper for recalcData() - for 3d-view transforms */
+static void recalcData_view3d(TransInfo *t)
+{
+ Base *base = t->scene->basact;
+
+ if (t->obedit) {
+ if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
+ Curve *cu= t->obedit->data;
+ ListBase *nurbs= ED_curve_editnurbs(cu);
+ Nurb *nu= nurbs->first;
- flushTransUVs(t);
- if(sima->flag & SI_LIVE_UNWRAP)
- ED_uvedit_live_unwrap_re_solve();
+ if(t->state != TRANS_CANCEL) {
+ clipMirrorModifier(t, t->obedit);
+ applyProject(t);
+ }
- DAG_id_tag_update(t->obedit->data, 0);
- }
- }
- else if (t->spacetype == SPACE_VIEW3D) {
-
- if (t->obedit) {
- if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
- Curve *cu= t->obedit->data;
- ListBase *nurbs= ED_curve_editnurbs(cu);
- Nurb *nu= nurbs->first;
-
- if(t->state != TRANS_CANCEL) {
- clipMirrorModifier(t, t->obedit);
- applyProject(t);
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
+
+ if (t->state == TRANS_CANCEL) {
+ while(nu) {
+ calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ nu= nu->next;
}
-
- DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
-
- if (t->state == TRANS_CANCEL) {
- while(nu) {
- calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
- nu= nu->next;
- }
- } else {
- /* Normal updating */
- while(nu) {
- test2DNurb(nu);
- calchandlesNurb(nu);
- nu= nu->next;
- }
+ }
+ else {
+ /* Normal updating */
+ while(nu) {
+ test2DNurb(nu);
+ calchandlesNurb(nu);
+ nu= nu->next;
}
}
- else if(t->obedit->type==OB_LATTICE) {
- Lattice *la= t->obedit->data;
-
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
-
- DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
-
- if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
+ }
+ else if(t->obedit->type==OB_LATTICE) {
+ Lattice *la= t->obedit->data;
+
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
}
- else if (t->obedit->type == OB_MESH) {
- EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
- /* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL) {
- /* apply clipping after so we never project past the clip plane [#25423] */
- applyProject(t);
- clipMirrorModifier(t, t->obedit);
- }
- if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
- editmesh_apply_to_mirror(t);
-
- DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
+
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
+
+ if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
+ }
+ else if (t->obedit->type == OB_MESH) {
+ EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
+ /* mirror modifier clipping? */
+ if(t->state != TRANS_CANCEL) {
+ /* apply clipping after so we never project past the clip plane [#25423] */
+ applyProject(t);
+ clipMirrorModifier(t, t->obedit);
+ }
+ if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+ editmesh_apply_to_mirror(t);
- recalc_editnormals(em);
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
+
+ recalc_editnormals(em);
+ }
+ else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
+ bArmature *arm= t->obedit->data;
+ ListBase *edbo = arm->edbo;
+ EditBone *ebo;
+ TransData *td = t->data;
+ int i;
+
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
}
- else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
- bArmature *arm= t->obedit->data;
- ListBase *edbo = arm->edbo;
- EditBone *ebo;
- TransData *td = t->data;
- int i;
+
+ /* Ensure all bones are correctly adjusted */
+ for (ebo = edbo->first; ebo; ebo = ebo->next){
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
-
- /* Ensure all bones are correctly adjusted */
- for (ebo = edbo->first; ebo; ebo = ebo->next){
-
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
- /* If this bone has a parent tip that has been moved */
- if (ebo->parent->flag & BONE_TIPSEL){
- VECCOPY (ebo->head, ebo->parent->tail);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
- }
- /* If this bone has a parent tip that has NOT been moved */
- else{
- VECCOPY (ebo->parent->tail, ebo->head);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
- }
- }
-
- /* on extrude bones, oldlength==0.0f, so we scale radius of points */
- ebo->length= len_v3v3(ebo->head, ebo->tail);
- if(ebo->oldlength==0.0f) {
- ebo->rad_head= 0.25f*ebo->length;
- ebo->rad_tail= 0.10f*ebo->length;
- ebo->dist= 0.25f*ebo->length;
- if(ebo->parent) {
- if(ebo->rad_head > ebo->parent->rad_tail)
- ebo->rad_head= ebo->parent->rad_tail;
- }
+ if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
+ /* If this bone has a parent tip that has been moved */
+ if (ebo->parent->flag & BONE_TIPSEL){
+ VECCOPY (ebo->head, ebo->parent->tail);
+ if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
}
- else if(t->mode!=TFM_BONE_ENVELOPE) {
- /* if bones change length, lets do that for the deform distance as well */
- ebo->dist*= ebo->length/ebo->oldlength;
- ebo->rad_head*= ebo->length/ebo->oldlength;
- ebo->rad_tail*= ebo->length/ebo->oldlength;
- ebo->oldlength= ebo->length;
+ /* If this bone has a parent tip that has NOT been moved */
+ else{
+ VECCOPY (ebo->parent->tail, ebo->head);
+ if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
}
}
-
- if (t->mode != TFM_BONE_ROLL)
+ /* on extrude bones, oldlength==0.0f, so we scale radius of points */
+ ebo->length= len_v3v3(ebo->head, ebo->tail);
+ if(ebo->oldlength==0.0f) {
+ ebo->rad_head= 0.25f*ebo->length;
+ ebo->rad_tail= 0.10f*ebo->length;
+ ebo->dist= 0.25f*ebo->length;
+ if(ebo->parent) {
+ if(ebo->rad_head > ebo->parent->rad_tail)
+ ebo->rad_head= ebo->parent->rad_tail;
+ }
+ }
+ else if(t->mode!=TFM_BONE_ENVELOPE) {
+ /* if bones change length, lets do that for the deform distance as well */
+ ebo->dist*= ebo->length/ebo->oldlength;
+ ebo->rad_head*= ebo->length/ebo->oldlength;
+ ebo->rad_tail*= ebo->length/ebo->oldlength;
+ ebo->oldlength= ebo->length;
+ }
+ }
+
+
+ if (t->mode != TFM_BONE_ROLL)
+ {
+ /* fix roll */
+ for(i = 0; i < t->total; i++, td++)
{
- /* fix roll */
- for(i = 0; i < t->total; i++, td++)
+ if (td->extra)
{
- if (td->extra)
+ float vec[3], up_axis[3];
+ float qrot[4];
+
+ ebo = td->extra;
+ VECCOPY(up_axis, td->axismtx[2]);
+
+ if (t->mode != TFM_ROTATION)
{
- float vec[3], up_axis[3];
- float qrot[4];
-
- ebo = td->extra;
- VECCOPY(up_axis, td->axismtx[2]);
-
- if (t->mode != TFM_ROTATION)
- {
- sub_v3_v3v3(vec, ebo->tail, ebo->head);
- normalize_v3(vec);
- rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
- mul_qt_v3(qrot, up_axis);
- }
- else
- {
- mul_m3_v3(t->mat, up_axis);
- }
-
- ebo->roll = ED_rollBoneToVector(ebo, up_axis, FALSE);
+ sub_v3_v3v3(vec, ebo->tail, ebo->head);
+ normalize_v3(vec);
+ rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
+ mul_qt_v3(qrot, up_axis);
+ }
+ else
+ {
+ mul_m3_v3(t->mat, up_axis);
}
+
+ ebo->roll = ED_rollBoneToVector(ebo, up_axis, FALSE);
}
}
-
- if(arm->flag & ARM_MIRROR_EDIT)
- transform_armature_mirror_update(t->obedit);
-
}
- else
- {
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
- DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
+
+ if(arm->flag & ARM_MIRROR_EDIT)
+ transform_armature_mirror_update(t->obedit);
+
+ }
+ else
+ {
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
}
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
}
- else if( (t->flag & T_POSE) && t->poseobj) {
- Object *ob= t->poseobj;
- bArmature *arm= ob->data;
+ }
+ else if( (t->flag & T_POSE) && t->poseobj) {
+ Object *ob= t->poseobj;
+ bArmature *arm= ob->data;
+
+ /* if animtimer is running, and the object already has animation data,
+ * check if the auto-record feature means that we should record 'samples'
+ * (i.e. uneditable animation values)
+ *
+ * context is needed for keying set poll() functions.
+ */
+ // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
+ if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
+ int targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
+
+ animrecord_check_state(t->scene, &ob->id, t->animtimer);
+ autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
+ }
+
+ /* old optimize trick... this enforces to bypass the depgraph */
+ if (!(arm->flag & ARM_DELAYDEFORM)) {
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
+ }
+ else
+ where_is_pose(t->scene, ob);
+ }
+ else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
+ flushTransParticles(t);
+ }
+ else {
+ int i;
+
+ if(t->state != TRANS_CANCEL) {
+ applyProject(t);
+ }
+
+ for (i = 0; i < t->total; i++) {
+ TransData *td = t->data + i;
+ Object *ob = td->ob;
+
+ if (td->flag & TD_NOACTION)
+ break;
+
+ if (td->flag & TD_SKIP)
+ continue;
/* if animtimer is running, and the object already has animation data,
* check if the auto-record feature means that we should record 'samples'
* (i.e. uneditable animation values)
- *
- * context is needed for keying set poll() functions.
*/
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
- if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
- int targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
-
+ if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
animrecord_check_state(t->scene, &ob->id, t->animtimer);
- autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
+ autokeyframe_ob_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode);
}
- /* old optimize trick... this enforces to bypass the depgraph */
- if (!(arm->flag & ARM_DELAYDEFORM)) {
- DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
- }
- else
- where_is_pose(t->scene, ob);
- }
- else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
- flushTransParticles(t);
+ /* sets recalc flags fully, instead of flushing existing ones
+ * otherwise proxies don't function correctly
+ */
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
- else {
- int i;
-
- if(t->state != TRANS_CANCEL) {
- applyProject(t);
- }
+ }
+}
- for (i = 0; i < t->total; i++) {
- TransData *td = t->data + i;
- Object *ob = td->ob;
-
- if (td->flag & TD_NOACTION)
- break;
-
- if (td->flag & TD_SKIP)
- continue;
-
- /* if animtimer is running, and the object already has animation data,
- * check if the auto-record feature means that we should record 'samples'
- * (i.e. uneditable animation values)
- */
- // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
- if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
- animrecord_check_state(t->scene, &ob->id, t->animtimer);
- autokeyframe_ob_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode);
- }
-
- /* sets recalc flags fully, instead of flushing existing ones
- * otherwise proxies don't function correctly
- */
- DAG_id_tag_update(&ob->id, OB_RECALC_OB);
- }
+/* called for updating while transform acts, once per redraw */
+void recalcData(TransInfo *t)
+{
+ if (t->spacetype==SPACE_NODE) {
+ flushTransNodes(t);
+ }
+ else if (t->spacetype==SPACE_SEQ) {
+ flushTransSeq(t);
+ }
+ else if (t->spacetype == SPACE_ACTION) {
+ recalcData_actedit(t);
+ }
+ else if (t->spacetype == SPACE_IPO) {
+ recalcData_graphedit(t);
+ }
+ else if (t->spacetype == SPACE_NLA) {
+ recalcData_nla(t);
+ }
+ else if (t->spacetype == SPACE_IMAGE) {
+ if (t->obedit && t->obedit->type == OB_MESH) {
+ SpaceImage *sima= t->sa->spacedata.first;
+
+ flushTransUVs(t);
+ if(sima->flag & SI_LIVE_UNWRAP)
+ ED_uvedit_live_unwrap_re_solve();
+
+ DAG_id_tag_update(t->obedit->data, 0);
}
}
+ else if (t->spacetype == SPACE_VIEW3D) {
+ recalcData_view3d(t);
+ }
}
void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 23cd83dc6b9..b9ccb02ff5b 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -913,7 +913,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(km->ptr, "mode", TFM_TIME_SCALE);
- km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, 0, 0);
+ km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(km->ptr, "mode", TFM_TIME_SLIDE);
break;
case SPACE_IPO: