51 MEM_CXX_CLASS_ALLOC_FUNCS(
"TransSeqSnapData")
68 snap_sources.
add(strip);
87static int cmp_fn(
const void *a,
const void *
b)
96 for (
Strip *strip : snap_sources) {
97 int left = 0, right = 0;
125 for (
auto item : retiming_selection.
items()) {
140 for (
Strip *strip : snap_sources) {
143 for (
int i = 0;
i < 4;
i++) {
158 const size_t point_count_source = snap_sources.
size();
160 if (point_count_source == 0) {
166 for (
Strip *strip : snap_sources) {
185 Strip *strip_reference,
189 if (strips.
contains(strip_reference)) {
192 strips.
add(strip_reference);
204 const bool exclude_selected)
213 VectorSet effects_of_snap_sources = snap_sources;
221 if (exclude_selected && strip->
flag &
SELECT) {
230 if (effects_of_snap_sources.
contains(strip)) {
234 snap_targets.
add(strip);
270 for (
Strip *strip : snap_strip_targets) {
274 visible_keys.
add(&key, strip);
283 const short snap_mode,
302 for (
Strip *strip : strip_targets) {
330 for (
auto item : retiming_key_targets.
items()) {
343 const short snap_mode,
360 const short snap_mode,
367 for (
Strip *strip : snap_targets) {
370 for (
int i = 0;
i < 4;
i++) {
384 for (
int i = 0;
i < 4;
i++) {
407 for (
Strip *strip : snap_sources) {
411 for (
Strip *strip : snap_targets) {
501 MEM_delete(snap_data);
526 int best_dist =
MAXFRAME, best_target_frame = 0, best_source_frame = 0;
530 int snap_source_frame = snap_source_point[0];
531 int snap_target_frame = snap_target_point[0];
533 if (dist > best_dist) {
538 best_target_frame = snap_target_frame;
539 best_source_frame = snap_source_frame;
555 float best_dist(std::numeric_limits<float>::max());
556 float2 best_target_point(0.0f);
557 float2 best_source_point(0.0f);
562 const float2 transformed_point(snap_source_point.x + t->
values[0],
563 snap_source_point.y + t->
values[1]);
565 if (dist > best_dist) {
570 best_target_point = snap_target_point;
571 best_source_point = snap_source_point;
587 float2 best_dist(std::numeric_limits<float>::max());
588 float2 best_target_point(0.0f);
589 float2 best_source_point(0.0f);
594 for (
int i = 0;
i < 2;
i++) {
595 int dist =
abs(snap_target_point[
i] - (snap_source_point[
i] + t->
values[
i]));
596 if (dist > best_dist[
i]) {
601 best_target_point[
i] = snap_target_point[
i];
602 best_source_point[
i] = snap_source_point[
i];
610 if (best_dist[0] <= thr) {
616 if (best_dist[1] <= thr) {
622 return (best_dist[0] <= thr || best_dist[1] <= thr);
628 if (snap_data ==
nullptr) {
681 float snap_offset = 0;
697 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