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:
authorCampbell Barton <ideasman42@gmail.com>2010-03-08 12:06:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-03-08 12:06:58 +0300
commit3b105657d50bdcc2dfaf574ac3a5ad4f22b8b237 (patch)
tree7345436a325903302be27a50b85f214e8e16d919 /source/blender/editors/transform
parent581efb43469c68cc728a2dab3a9db48d296f2c18 (diff)
option to transform markers in the dope sheet, needed for re-timing animation. currently supports translate and extend.
TODO: - select markers in dope sheet. - transform time scale.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_conversions.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index e5e6809bf13..5c29650b987 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -100,6 +100,7 @@
#include "BKE_bmesh.h"
#include "BKE_context.h"
#include "BKE_report.h"
+#include "BKE_scene.h"
//#include "BIF_editview.h"
//#include "BIF_editlattice.h"
@@ -288,7 +289,7 @@ static void set_prop_dist(TransInfo *t, short with_dist)
static void createTransTexspace(bContext *C, TransInfo *t)
{
- Scene *scene = CTX_data_scene(C);
+ Scene *scene = t->scene;
TransData *td;
Object *ob;
ID *id;
@@ -2460,7 +2461,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
{
SpaceImage *sima = CTX_wm_space_image(C);
Image *ima = CTX_data_edit_image(C);
- Scene *scene = CTX_data_scene(C);
+ Scene *scene = t->scene;
TransData *td = NULL;
TransData2D *td2d = NULL;
MTFace *tf;
@@ -2617,7 +2618,7 @@ static short FrameOnMouseSide(char side, float frame, float cframe)
static void createTransNlaData(bContext *C, TransInfo *t)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene= t->scene;
TransData *td = NULL;
TransDataNla *tdn = NULL;
@@ -2627,7 +2628,6 @@ static void createTransNlaData(bContext *C, TransInfo *t)
int filter;
int count=0;
- char side;
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -2643,11 +2643,11 @@ static void createTransNlaData(bContext *C, TransInfo *t)
float xmouse, ymouse;
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
- side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
+ t->frame_side= (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
}
else {
/* normal transform - both sides of current frame are considered */
- side = 'B';
+ t->frame_side = 'B';
}
/* loop 1: count how many strips are selected (consider each strip as 2 points) */
@@ -2664,8 +2664,8 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* transition strips can't get directly transformed */
if (strip->type != NLASTRIP_TYPE_TRANSITION) {
if (strip->flag & NLASTRIP_FLAG_SELECT) {
- if (FrameOnMouseSide(side, strip->start, (float)CFRA)) count++;
- if (FrameOnMouseSide(side, strip->end, (float)CFRA)) count++;
+ if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) count++;
+ if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) count++;
}
}
}
@@ -2728,7 +2728,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
center[2]= 0.0f;
/* set td's based on which handles are applicable */
- if (FrameOnMouseSide(side, strip->start, (float)CFRA))
+ if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA))
{
/* just set tdn to assume that it only has one handle for now */
tdn->handle= -1;
@@ -2759,7 +2759,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->extra= tdn;
td++;
}
- if (FrameOnMouseSide(side, strip->end, (float)CFRA))
+ if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA))
{
/* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
tdn->handle= (tdn->handle) ? 2 : 1;
@@ -3156,7 +3156,7 @@ static int GPLayerToTransData (TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl
static void createTransActionData(bContext *C, TransInfo *t)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene= t->scene;
TransData *td = NULL;
tGPFtransdata *tfd = NULL;
@@ -3167,7 +3167,6 @@ static void createTransActionData(bContext *C, TransInfo *t)
int count=0;
float cfra;
- char side;
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -3186,11 +3185,11 @@ static void createTransActionData(bContext *C, TransInfo *t)
float xmouse, ymouse;
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
- side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
+ t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
}
else {
/* normal transform - both sides of current frame are considered */
- side = 'B';
+ t->frame_side = 'B';
}
/* loop 1: fully select ipo-keys and count how many BezTriples are selected */
@@ -3206,9 +3205,9 @@ static void createTransActionData(bContext *C, TransInfo *t)
cfra = (float)CFRA;
//if (ale->type == ANIMTYPE_GPLAYER)
- // count += count_gplayer_frames(ale->data, side, cfra);
+ // count += count_gplayer_frames(ale->data, t->frame_side, cfra);
//else
- count += count_fcurve_keys(ale->key_data, side, cfra);
+ count += count_fcurve_keys(ale->key_data, t->frame_side, cfra);
}
/* stop if trying to build list if nothing selected */
@@ -3243,7 +3242,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
// bGPDlayer *gpl= (bGPDlayer *)ale->data;
// int i;
//
- // i = GPLayerToTransData(td, tfd, gpl, side, cfra);
+ // i = GPLayerToTransData(td, tfd, gpl, t->frame_side, cfra);
// td += i;
// tfd += i;
//}
@@ -3259,7 +3258,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
else
cfra = (float)CFRA;
- td= FCurveToTransData(td, fcu, adt, side, cfra);
+ td= FCurveToTransData(td, fcu, adt, t->frame_side, cfra);
//}
}
@@ -3351,8 +3350,8 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
static void createTransGraphEditData(bContext *C, TransInfo *t)
{
SpaceIpo *sipo= CTX_wm_space_graph(C);
- Scene *scene= CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
+ Scene *scene= t->scene;
+ ARegion *ar= t->ar;
View2D *v2d= &ar->v2d;
TransData *td = NULL;
@@ -3366,7 +3365,6 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
BezTriple *bezt;
int count=0, i;
float cfra;
- char side;
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -3383,11 +3381,11 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
float xmouse, ymouse;
UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
- side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
+ t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
}
else {
/* normal transform - both sides of current frame are considered */
- side = 'B';
+ t->frame_side = 'B';
}
/* loop 1: count how many BezTriples (specifically their verts) are selected (or should be edited) */
@@ -3409,7 +3407,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
+ if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
if (sipo->around == V3D_LOCAL) {
/* for local-pivot we only need to count the number of selected handles only, so that centerpoints don't
* don't get moved wrong
@@ -3469,7 +3467,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
for (i=0, bezt= fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
+ if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
TransDataCurveHandleFlags *hdata = NULL;
short h1=1, h2=1;
@@ -4147,7 +4145,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
{
View2D *v2d= UI_view2d_fromcontext(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene= t->scene;
Editing *ed= seq_give_editing(t->scene, FALSE);
TransData *td = NULL;
TransData2D *td2d= NULL;
@@ -4200,7 +4198,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
/* transcribe given object into TransData for Transforming */
static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob)
{
- Scene *scene = CTX_data_scene(C);
+ Scene *scene = t->scene;
Object *track;
float obmtx[3][3];
short constinv;
@@ -4795,6 +4793,21 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
posttrans_action_clean(&ac, (bAction *)ac.data);
}
}
+
+ /* marker transform, not especially nice but we may want to move markers
+ * at the same time as keyframes in the dope sheet. */
+ if ((saction->flag & SACTION_MARKERS_MOVE) && (cancelled == 0)) {
+ /* cant use , TFM_TIME_EXTEND
+ * for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
+
+ if(t->mode == TFM_TIME_TRANSLATE) {
+ if(t->frame_side == 'B')
+ scene_marker_tfm_translate(t->scene, floor(t->vec[0] + 0.5f), SELECT);
+ else if (ELEM(t->frame_side, 'L', 'R'))
+ scene_marker_tfm_extend(t->scene, floor(t->vec[0] + 0.5f), SELECT, t->scene->r.cfra, t->frame_side);
+ }
+ }
+
#if 0 // XXX future of this is still not clear
else if (ac.datatype == ANIMCONT_GPENCIL) {
/* remove duplicate frames and also make sure points are in order! */
@@ -5139,7 +5152,7 @@ void createTransNodeData(bContext *C, TransInfo *t)
void createTransData(bContext *C, TransInfo *t)
{
- Scene *scene = CTX_data_scene(C);
+ Scene *scene = t->scene;
Object *ob = OBACT;
if (t->options & CTX_TEXTURE) {