51 MEM_CXX_CLASS_ALLOC_FUNCS(
"TransSeqSnapData")
68 snap_sources.
add(strip);
82 scene, channels,
ed->current_strips(), scene->
r.
cfra, 0);
88static int cmp_fn(
const void *a,
const void *
b)
97 for (
Strip *strip : snap_sources) {
98 int left = 0, right = 0;
126 for (
auto item : retiming_selection.
items()) {
141 for (
Strip *strip : snap_sources) {
144 for (
int i = 0;
i < 4;
i++) {
159 const size_t point_count_source = snap_sources.
size();
161 if (point_count_source == 0) {
167 for (
Strip *strip : snap_sources) {
186 Strip *strip_reference,
190 if (strips.
contains(strip_reference)) {
193 strips.
add(strip_reference);
205 const bool exclude_selected)
214 VectorSet effects_of_snap_sources = snap_sources;
222 if (exclude_selected && strip->
flag &
SELECT) {
231 if (effects_of_snap_sources.
contains(strip)) {
235 snap_targets.
add(strip);
257 scene, channels,
ed->current_strips(), scene->
r.
cfra, 0);
272 for (
Strip *strip : snap_strip_targets) {
276 visible_keys.
add(&key, strip);
285 const short snap_mode,
304 for (
Strip *strip : strip_targets) {
313 if (strip->is_effect() || strip->len == 1) {
332 for (
auto item : retiming_key_targets.
items()) {
345 const short snap_mode,
362 const short snap_mode,
369 for (
Strip *strip : snap_targets) {
372 for (
int i = 0;
i < 4;
i++) {
386 for (
int i = 0;
i < 4;
i++) {
409 for (
Strip *strip : snap_sources) {
413 for (
Strip *strip : snap_targets) {
503 MEM_delete(snap_data);
528 int best_dist =
MAXFRAME, best_target_frame = 0, best_source_frame = 0;
532 int snap_source_frame = snap_source_point[0];
533 int snap_target_frame = snap_target_point[0];
535 if (dist > best_dist) {
540 best_target_frame = snap_target_frame;
541 best_source_frame = snap_source_frame;
549 float2 best_offset(
float(best_target_frame - best_source_frame), 0.0f);
562 float best_dist(std::numeric_limits<float>::max());
563 float2 best_target_point(0.0f);
564 float2 best_source_point(0.0f);
569 const float2 transformed_point(snap_source_point.x + t->
values[0],
570 snap_source_point.y + t->
values[1]);
572 if (dist > best_dist) {
577 best_target_point = snap_target_point;
578 best_source_point = snap_source_point;
594 float2 best_dist(std::numeric_limits<float>::max());
595 float2 best_target_point(0.0f);
596 float2 best_source_point(0.0f);
601 for (
int i = 0;
i < 2;
i++) {
602 int dist =
abs(snap_target_point[
i] - (snap_source_point[
i] + t->
values[
i]));
603 if (dist > best_dist[
i]) {
608 best_target_point[
i] = snap_target_point[
i];
609 best_source_point[
i] = snap_source_point[
i];
617 if (best_dist[0] <= thr) {
623 if (best_dist[1] <= thr) {
629 return (best_dist[0] <= thr || best_dist[1] <= thr);
635 if (snap_data ==
nullptr) {
688 float snap_offset = 0;
704 int *r_snap_distance,
#define LISTBASE_FOREACH(type, var, list)
MINLINE int round_fl_to_int(float a)
MINLINE void copy_v2_v2(float r[2], const float a[2])
@ SEQ_SNAP_TO_FRAME_RANGE
@ SEQ_SNAP_TO_PREVIEW_CENTER
@ SEQ_SNAP_TO_STRIPS_PREVIEW
@ SEQ_SNAP_TO_PREVIEW_BORDERS
@ SEQ_SNAP_TO_CURRENT_FRAME
Read Guarded memory(de)allocation.
float UI_view2d_region_to_view_x(const View2D *v2d, float x)
BMesh const char void * data
ValueIterator values() const &
bool add(const Key &key, const Value &value)
ItemIterator items() const &
constexpr int64_t size() const
bool contains(const Key &key) const
int64_t remove_if(Predicate &&predicate)
T distance(const T &a, const T &b)
T interpolate(const T &a, const T &b, const FactorT &t)
bool render_is_muted(const ListBase *channels, const Strip *strip)
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
Array< float2 > image_transform_final_quad_get(const Scene *scene, const Strip *strip)
ListBase * channels_displayed_get(const Editing *ed)
float time_content_end_frame_get(const Scene *scene, const Strip *strip)
VectorSet< Strip * > query_selected_strips(ListBase *seqbase)
blender::Map< SeqRetimingKey *, Strip * > retiming_selection_get(const Editing *ed)
int retiming_key_timeline_frame_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key)
Editing * editing_get(const Scene *scene)
MutableSpan< SeqRetimingKey > retiming_keys_get(const Strip *strip)
int time_left_handle_frame_get(const Scene *, const Strip *strip)
float time_start_frame_get(const Strip *strip)
void iterator_set_expand(const Scene *scene, ListBase *seqbase, VectorSet< Strip * > &strips, void strip_query_func(const Scene *scene, Strip *strip_reference, ListBase *seqbase, VectorSet< Strip * > &strips))
bool time_strip_intersects_frame(const Scene *scene, const Strip *strip, const int timeline_frame)
float2 image_transform_origin_offset_pixelspace_get(const Scene *scene, const Strip *strip)
short tool_settings_snap_flag_get(Scene *scene)
int tool_settings_snap_distance_get(Scene *scene)
bool relation_is_effect_of_strip(const Strip *effect, const Strip *input)
VectorSet< Strip * > query_rendered_strips(const Scene *scene, ListBase *channels, ListBase *seqbase, const int timeline_frame, const int displayed_channel)
ListBase * active_seqbase_get(const Editing *ed)
short tool_settings_snap_mode_get(Scene *scene)
int effect_get_num_inputs(int strip_type)
VecBase< float, 2 > float2