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 15 Lines | typedef struct TransDataSeq { | ||||
| /** Use this so we can have transform data at the strips start, | /** Use this so we can have transform data at the strips start, | ||||
| * but apply correctly to the start frame. */ | * but apply correctly to the start frame. */ | ||||
| int start_offset; | int start_offset; | ||||
| /** one of #SELECT, #SEQ_LEFTSEL and #SEQ_RIGHTSEL. */ | /** one of #SELECT, #SEQ_LEFTSEL and #SEQ_RIGHTSEL. */ | ||||
| short sel_flag; | short sel_flag; | ||||
| } TransDataSeq; | } TransDataSeq; | ||||
| /** | |||||
| * Sequencer transform customdata (stored in #TransCustomDataContainer). | |||||
| */ | |||||
| typedef struct TransSeq { | |||||
| TransDataSeq *tdseq; | |||||
| int min; | |||||
| int max; | |||||
| bool snap_left; | |||||
| } TransSeq; | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
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… | |||||
| /** \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 | ||||
| * checks don't need to be added in multiple places. | * checks don't need to be added in multiple places. | ||||
| * | * | ||||
| * recursive, count and flag MUST be set. | * recursive, count and flag MUST be set. | ||||
| ▲ Show 20 Lines • Show All 540 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; | |||||
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. | |||||
| ts->selection_channel_range_max = 0; | |||||
| 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 226 Lines • Show Last 20 Lines | |||||
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?