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:
Diffstat (limited to 'source/blender/editors/transform/transform_convert_action.c')
-rw-r--r--source/blender/editors/transform/transform_convert_action.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c
index cfa14e21d0d..30cb9fa20e5 100644
--- a/source/blender/editors/transform/transform_convert_action.c
+++ b/source/blender/editors/transform/transform_convert_action.c
@@ -140,19 +140,37 @@ static int count_masklayer_frames(MaskLayer *masklay, char side, float cfra, boo
}
/* This function assigns the information to transdata */
-static void TimeToTransData(TransData *td, float *time, AnimData *adt, float ypos)
+static void TimeToTransData(
+ TransData *td, TransData2D *td2d, BezTriple *bezt, AnimData *adt, float ypos)
{
- /* memory is calloc'ed, so that should zero everything nicely for us */
+ float *time = bezt->vec[1];
+
+ /* Setup #TransData2D. */
+ td2d->loc[0] = *time;
+ td2d->loc2d = time;
+ td2d->h1 = bezt->vec[0];
+ td2d->h2 = bezt->vec[2];
+ copy_v2_v2(td2d->ih1, td2d->h1);
+ copy_v2_v2(td2d->ih2, td2d->h2);
+
+ /* Setup #TransData. */
+ td->loc = time; /* Usually #td2d->loc is used here. But this is for when the original location is
+ not float[3]. */
td->val = time;
- td->ival = *(time);
-
+ td->ival = td->iloc[0] = *(time);
td->center[0] = td->ival;
td->center[1] = ypos;
- /* store the AnimData where this keyframe exists as a keyframe of the
- * active action as td->extra.
- */
+ /* Store the AnimData where this keyframe exists as a keyframe of the
+ * active action as #td->extra. */
td->extra = adt;
+
+ if (bezt->f2 & SELECT) {
+ td->flag |= TD_SELECTED;
+ }
+
+ /* Set flags to move handles as necessary. */
+ td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
}
/* This function advances the address to which td points to, so it must return
@@ -185,19 +203,7 @@ static TransData *ActionFCurveToTransData(TransData *td,
* so can't use BEZT_ISSEL_ANY() macro */
/* only add if on the right 'side' of the current frame */
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
- TimeToTransData(td, bezt->vec[1], adt, ypos);
-
- if (bezt->f2 & SELECT) {
- td->flag |= TD_SELECTED;
- }
-
- /* Set flags to move handles as necessary. */
- td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
- td2d->h1 = bezt->vec[0];
- td2d->h2 = bezt->vec[2];
-
- copy_v2_v2(td2d->ih1, td2d->h1);
- copy_v2_v2(td2d->ih2, td2d->h2);
+ TimeToTransData(td, td2d, bezt, adt, ypos);
td++;
td2d++;