[Bf-blender-cvs] [491076f1b16] temp-transform-conversions-split: Transform: Move Sequencer conversion to its own file
mano-wii
noreply at git.blender.org
Wed Sep 4 23:52:56 CEST 2019
Commit: 491076f1b1645aeec13343bd5dc5dc2646b6d6ec
Author: mano-wii
Date: Wed Sep 4 17:35:42 2019 -0300
Branches: temp-transform-conversions-split
https://developer.blender.org/rB491076f1b1645aeec13343bd5dc5dc2646b6d6ec
Transform: Move Sequencer conversion to its own file
===================================================================
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/transform/transform_conversions.h
A source/blender/editors/transform/transform_conversions_sequencer.c
===================================================================
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index c379384c570..7e59a3bc8b7 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -51,6 +51,7 @@ set(SRC
transform_conversions_mesh.c
transform_conversions_nla.c
transform_conversions_particle.c
+ transform_conversions_sequencer.c
transform_generics.c
transform_gizmo_2d.c
transform_gizmo_3d.c
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 0b9e9eb972b..f7b4012c84f 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1784,569 +1784,6 @@ void flushTransGraphData(TransInfo *t)
}
}
-/* ******************* Sequencer Transform data ******************* */
-
-/* This function applies the rules for transforming a strip so duplicate
- * checks don't need to be added in multiple places.
- *
- * recursive, count and flag MUST be set.
- *
- * seq->depth must be set before running this function so we know if the strips
- * are root level or not
- */
-static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag)
-{
- /* for extend we need to do some tricks */
- if (t->mode == TFM_TIME_EXTEND) {
-
- /* *** Extend Transform *** */
-
- Scene *scene = t->scene;
- int cfra = CFRA;
- int left = BKE_sequence_tx_get_final_left(seq, true);
- int right = BKE_sequence_tx_get_final_right(seq, true);
-
- if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
- *recursive = false;
- *count = 0;
- *flag = 0;
- }
- else if (seq->type == SEQ_TYPE_META) {
-
- /* for meta's we only ever need to extend their children, no matter what depth
- * just check the meta's are in the bounds */
- if (t->frame_side == 'R' && right <= cfra) {
- *recursive = false;
- }
- else if (t->frame_side == 'L' && left >= cfra) {
- *recursive = false;
- }
- else {
- *recursive = true;
- }
-
- *count = 1;
- *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
- }
- else {
-
- *recursive = false; /* not a meta, so no thinking here */
- *count = 1; /* unless its set to 0, extend will never set 2 handles at once */
- *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
-
- if (t->frame_side == 'R') {
- if (right <= cfra) {
- *count = *flag = 0;
- } /* ignore */
- else if (left > cfra) {
- } /* keep the selection */
- else {
- *flag |= SEQ_RIGHTSEL;
- }
- }
- else {
- if (left >= cfra) {
- *count = *flag = 0;
- } /* ignore */
- else if (right < cfra) {
- } /* keep the selection */
- else {
- *flag |= SEQ_LEFTSEL;
- }
- }
- }
- }
- else {
-
- t->frame_side = 'B';
-
- /* *** Normal Transform *** */
-
- if (seq->depth == 0) {
-
- /* Count */
-
- /* Non nested strips (resect selection and handles) */
- if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
- *recursive = false;
- *count = 0;
- *flag = 0;
- }
- else {
- if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
- *flag = seq->flag;
- *count = 2; /* we need 2 transdata's */
- }
- else {
- *flag = seq->flag;
- *count = 1; /* selected or with a handle selected */
- }
-
- /* Recursive */
-
- if ((seq->type == SEQ_TYPE_META) && ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) {
- /* if any handles are selected, don't recurse */
- *recursive = true;
- }
- else {
- *recursive = false;
- }
- }
- }
- else {
- /* Nested, different rules apply */
-
-#ifdef SEQ_TX_NESTED_METAS
- *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
- *count = 1; /* ignore the selection for nested */
- *recursive = (seq->type == SEQ_TYPE_META);
-#else
- if (seq->type == SEQ_TYPE_META) {
- /* Meta's can only directly be moved between channels since they
- * don't have their start and length set directly (children affect that)
- * since this Meta is nested we don't need any of its data in fact.
- * BKE_sequence_calc() will update its settings when run on the toplevel meta */
- *flag = 0;
- *count = 0;
- *recursive = true;
- }
- else {
- *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
- *count = 1; /* ignore the selection for nested */
- *recursive = false;
- }
-#endif
- }
- }
-}
-
-static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int depth)
-{
- Sequence *seq;
- int tot = 0, recursive, count, flag;
-
- for (seq = seqbase->first; seq; seq = seq->next) {
- seq->depth = depth;
-
- /* 'seq->tmp' is used by seq_tx_get_final_{left, right}
- * to check sequence's range and clamp to it if needed.
- * It's first place where digging into sequences tree, so store link to parent here. */
- seq->tmp = parent;
-
- SeqTransInfo(t, seq, &recursive, &count, &flag); /* ignore the flag */
- tot += count;
-
- if (recursive) {
- tot += SeqTransCount(t, seq, &seq->seqbase, depth + 1);
- }
- }
-
- return tot;
-}
-
-static TransData *SeqToTransData(
- TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag)
-{
- int start_left;
-
- switch (sel_flag) {
- case SELECT:
- /* Use seq_tx_get_final_left() and an offset here
- * so transform has the left hand location of the strip.
- * tdsq->start_offset is used when flushing the tx data back */
- start_left = BKE_sequence_tx_get_final_left(seq, false);
- td2d->loc[0] = start_left;
- tdsq->start_offset = start_left - seq->start; /* use to apply the original location */
- break;
- case SEQ_LEFTSEL:
- start_left = BKE_sequence_tx_get_final_left(seq, false);
- td2d->loc[0] = start_left;
- break;
- case SEQ_RIGHTSEL:
- td2d->loc[0] = BKE_sequence_tx_get_final_right(seq, false);
- break;
- }
-
- td2d->loc[1] = seq->machine; /* channel - Y location */
- td2d->loc[2] = 0.0f;
- td2d->loc2d = NULL;
-
- tdsq->seq = seq;
-
- /* Use instead of seq->flag for nested strips and other
- * cases where the selection may need to be modified */
- tdsq->flag = flag;
- tdsq->sel_flag = sel_flag;
-
- td->extra = (void *)tdsq; /* allow us to update the strip from here */
-
- td->flag = 0;
- td->loc = td2d->loc;
- copy_v3_v3(td->center, td->loc);
- copy_v3_v3(td->iloc, td->loc);
-
- memset(td->axismtx, 0, sizeof(td->axismtx));
- td->axismtx[2][2] = 1.0f;
-
- td->ext = NULL;
- td->val = NULL;
-
- td->flag |= TD_SELECTED;
- td->dist = 0.0;
-
- unit_m3(td->mtx);
- unit_m3(td->smtx);
-
- /* Time Transform (extend) */
- td->val = td2d->loc;
- td->ival = td2d->loc[0];
-
- return td;
-}
-
-static int SeqToTransData_Recursive(
- TransInfo *t, ListBase *seqbase, TransData *td, TransData2D *td2d, TransDataSeq *tdsq)
-{
- Sequence *seq;
- int recursive, count, flag;
- int tot = 0;
-
- for (seq = seqbase->first; seq; seq = seq->next) {
-
- SeqTransInfo(t, seq, &recursive, &count, &flag);
-
- /* add children first so recalculating metastrips does nested strips first */
- if (recursive) {
- int tot_children = SeqToTransData_Recursive(t, &seq->seqbase, td, td2d, tdsq);
-
- td = td + tot_children;
- td2d = td2d + tot_children;
- tdsq = tdsq + tot_children;
-
- tot += tot_children;
- }
-
- /* use 'flag' which is derived from seq->flag but modified for special cases */
- if (flag & SELECT) {
- if (flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
- if (flag & SEQ_LEFTSEL) {
- SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL);
- tot++;
- }
- if (flag & SEQ_RIGHTSEL) {
- SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL);
- tot++;
- }
- }
- else {
- SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT);
- tot++;
- }
- }
- }
- return tot;
-}
-
-static void SeqTransDataBounds(TransInfo *t, ListBase *seqbase, TransSeq *ts)
-{
- Sequence *seq;
- int recursive, count, flag;
- int max = INT32_MIN, min = INT32_MAX;
-
- for (seq = seqbase->first; seq; seq = seq->next) {
-
- /* just to get the flag since there are corner cases where this isn't totally obvious */
- SeqTransInfo(t, seq, &recursive, &count, &flag);
-
- /* use 'flag' which is derived from seq->flag but modified for special cases */
- if (flag & SELECT) {
- if (flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
- if (flag & SEQ_LEFTSEL) {
- min = min_ii(seq->startdisp, min);
- max = max_ii(seq->startdisp, max);
- }
- if (flag & SEQ_RIGHTSEL) {
- min = min_ii(seq->enddisp, min);
- max = max_ii(seq->enddisp, max);
- }
- }
- else {
- min = min_ii(seq->startdisp, min);
- max = max_ii(seq->enddisp, max);
- }
- }
- }
-
- if (ts) {
- ts->max = max;
- ts->min = min;
- }
-}
-
-static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data)
-{
- Editing *ed = BKE_sequencer_editing_get(t->scene, false);
-
- if (ed != NULL) {
-
- ListBase *seqbasep = ed->seqbasep;
- TransData *td = tc->data;
- int a;
-
- /* prevent updating the same seq twice
- * if the transdata order is changed this will mess up
- * but so will TransDataSeq */
- Sequence *seq_prev = NULL;
- Sequence *seq;
-
- if (!(t->state == TRANS_CANCEL)) {
-
-#if 0 // default 2.4 behavior
-
- /* flush to 2d vector from internally used 3d vector */
- for (a = 0; a < t->total; a++, td++) {
- if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) {
- seq =
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list