Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_snap_sequencer.c
| Show All 22 Lines | |||||
| #include "SEQ_effects.h" | #include "SEQ_effects.h" | ||||
| #include "SEQ_iterator.h" | #include "SEQ_iterator.h" | ||||
| #include "SEQ_relations.h" | #include "SEQ_relations.h" | ||||
| #include "SEQ_render.h" | #include "SEQ_render.h" | ||||
| #include "SEQ_sequencer.h" | #include "SEQ_sequencer.h" | ||||
| #include "SEQ_time.h" | #include "SEQ_time.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_convert.h" | |||||
| #include "transform_snap.h" | #include "transform_snap.h" | ||||
| typedef struct TransSeqSnapData { | typedef struct TransSeqSnapData { | ||||
| int *source_snap_points; | int *source_snap_points; | ||||
| int *target_snap_points; | int *target_snap_points; | ||||
| int source_snap_point_count; | int source_snap_point_count; | ||||
| int target_snap_point_count; | int target_snap_point_count; | ||||
| } TransSeqSnapData; | } TransSeqSnapData; | ||||
| ▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | static int seq_snap_threshold_get_frame_distance(const TransInfo *t) | ||||
| return round_fl_to_int(UI_view2d_region_to_view_x(v2d, snap_distance) - | return round_fl_to_int(UI_view2d_region_to_view_x(v2d, snap_distance) - | ||||
| UI_view2d_region_to_view_x(v2d, 0)); | UI_view2d_region_to_view_x(v2d, 0)); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t) | TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t) | ||||
| { | { | ||||
| if (t->data_type == TC_SEQ_IMAGE_DATA) { | if (t->data_type == &TransConvertType_SequencerImage) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Scene *scene = t->scene; | Scene *scene = t->scene; | ||||
| TransSeqSnapData *snap_data = MEM_callocN(sizeof(TransSeqSnapData), __func__); | TransSeqSnapData *snap_data = MEM_callocN(sizeof(TransSeqSnapData), __func__); | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ||||
| SeqCollection *snap_sources = SEQ_query_selected_strips(seqbase); | SeqCollection *snap_sources = SEQ_query_selected_strips(seqbase); | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | bool ED_transform_snap_sequencer_to_closest_strip_calc(Scene *scene, | ||||
| int frame_2, | int frame_2, | ||||
| int *r_snap_distance, | int *r_snap_distance, | ||||
| float *r_snap_frame) | float *r_snap_frame) | ||||
| { | { | ||||
| TransInfo t; | TransInfo t; | ||||
| t.scene = scene; | t.scene = scene; | ||||
| t.region = region; | t.region = region; | ||||
| t.values[0] = 0; | t.values[0] = 0; | ||||
| t.data_type = TC_SEQ_DATA; | t.data_type = &TransConvertType_Sequencer; | ||||
| t.tsnap.mode = SEQ_tool_settings_snap_mode_get(scene); | t.tsnap.mode = SEQ_tool_settings_snap_mode_get(scene); | ||||
| *r_snap_distance = transform_snap_sequencer_to_closest_strip_ex(&t, frame_1, frame_2); | *r_snap_distance = transform_snap_sequencer_to_closest_strip_ex(&t, frame_1, frame_2); | ||||
| *r_snap_frame = t.tsnap.snapPoint[0]; | *r_snap_frame = t.tsnap.snapPoint[0]; | ||||
| return validSnap(&t); | return validSnap(&t); | ||||
| } | } | ||||
| void ED_draw_sequencer_snap_point(struct bContext *C, float snap_point) | void ED_draw_sequencer_snap_point(struct bContext *C, float snap_point) | ||||
| Show All 11 Lines | |||||