Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_sequencer.c
| Show All 19 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup edtransform | * \ingroup edtransform | ||||
| */ | */ | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_listbase.h" | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "ED_markers.h" | #include "ED_markers.h" | ||||
| #include "SEQ_relations.h" | #include "SEQ_relations.h" | ||||
| Show All 23 Lines | |||||
| /** | /** | ||||
| * Sequencer transform customdata (stored in #TransCustomDataContainer). | * Sequencer transform customdata (stored in #TransCustomDataContainer). | ||||
| */ | */ | ||||
| typedef struct TransSeq { | typedef struct TransSeq { | ||||
| TransDataSeq *tdseq; | TransDataSeq *tdseq; | ||||
| int min; | int min; | ||||
| int max; | int max; | ||||
| bool snap_left; | bool snap_left; | ||||
| int selection_channel_range_min; | |||||
sergey: At least add a comment explaining what is stored in the elements of the array.
Maybe for… | |||||
Done Inline ActionsI guess I could have wrap these values in struct, so I don't need 2 _get functions? ISS: I guess I could have wrap these values in struct, so I don't need 2 `_get` functions? | |||||
Done Inline ActionsThe thing here is that it seems weird to require TransSeq be defined in a private place of some .c file, and implement accessory to individual fields. What would work better here is either of those:
sergey: The thing here is that it seems weird to require `TransSeq` be defined in a private place of… | |||||
| int selection_channel_range_max; | |||||
| } TransSeq; | } TransSeq; | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Sequencer Transform Creation | /** \name Sequencer Transform Creation | ||||
| * | * | ||||
| * \{ */ | * \{ */ | ||||
| /* This function applies the rules for transforming a strip so duplicate | /* This function applies the rules for transforming a strip so duplicate | ||||
| ▲ Show 20 Lines • Show All 543 Lines • ▼ Show 20 Lines | #endif | ||||
| if (t->flag & T_MODAL) { | if (t->flag & T_MODAL) { | ||||
| /* set the snap mode based on how close the mouse is at the end/start points */ | /* set the snap mode based on how close the mouse is at the end/start points */ | ||||
| int xmouse = (int)UI_view2d_region_to_view_x((View2D *)t->view, t->mouse.imval[0]); | int xmouse = (int)UI_view2d_region_to_view_x((View2D *)t->view, t->mouse.imval[0]); | ||||
| if (abs(xmouse - ts->max) > abs(xmouse - ts->min)) { | if (abs(xmouse - ts->max) > abs(xmouse - ts->min)) { | ||||
| ts->snap_left = true; | ts->snap_left = true; | ||||
| } | } | ||||
| } | } | ||||
| ts->selection_channel_range_min = MAXSEQ + 1; | |||||
sergeyUnsubmitted Done Inline ActionsYou initialize min, but not max. This is a bit weird. sergey: You initialize min, but not max. This is a bit weird. | |||||
| LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { | |||||
| if ((seq->flag & SELECT) != 0) { | |||||
| ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, seq->machine); | |||||
| ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, seq->machine); | |||||
| } | |||||
| } | |||||
| #undef XXX_DURIAN_ANIM_TX_HACK | #undef XXX_DURIAN_ANIM_TX_HACK | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name UVs Transform Flush | /** \name UVs Transform Flush | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | if (sseq->flag & SEQ_MARKER_TRANS) { | ||||
| } | } | ||||
| else if (ELEM(t->frame_side, 'L', 'R')) { | else if (ELEM(t->frame_side, 'L', 'R')) { | ||||
| ED_markers_post_apply_transform( | ED_markers_post_apply_transform( | ||||
| &t->scene->markers, t->scene, TFM_TIME_EXTEND, t->values[0], t->frame_side); | &t->scene->markers, t->scene, TFM_TIME_EXTEND, t->values[0], t->frame_side); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| int transform_convert_sequencer_get_selection_channel_range_min(TransInfo *t) | |||||
| { | |||||
| TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; | |||||
| return ts->selection_channel_range_min; | |||||
| } | |||||
| int transform_convert_sequencer_get_selection_channel_range_max(TransInfo *t) | |||||
| { | |||||
| TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; | |||||
| return ts->selection_channel_range_max; | |||||
| } | |||||
| int transform_convert_sequencer_get_snap_bound(TransInfo *t) | int transform_convert_sequencer_get_snap_bound(TransInfo *t) | ||||
| { | { | ||||
| TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; | TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; | ||||
| return ts->snap_left ? ts->min : ts->max; | return ts->snap_left ? ts->min : ts->max; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
At least add a comment explaining what is stored in the elements of the array.
Maybe for readability it even makes more sense to store explicit min and max values?