Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform_convert_sequencer_image.c')
-rw-r--r--source/blender/editors/transform/transform_convert_sequencer_image.c69
1 files changed, 47 insertions, 22 deletions
diff --git a/source/blender/editors/transform/transform_convert_sequencer_image.c b/source/blender/editors/transform/transform_convert_sequencer_image.c
index deae51a1149..8be454b540c 100644
--- a/source/blender/editors/transform/transform_convert_sequencer_image.c
+++ b/source/blender/editors/transform/transform_convert_sequencer_image.c
@@ -123,7 +123,8 @@ void createTransSeqImageData(TransInfo *t)
ListBase *seqbase = SEQ_active_seqbase_get(ed);
ListBase *channels = SEQ_channels_displayed_get(ed);
- SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, t->scene->r.cfra, 0);
+ SeqCollection *strips = SEQ_query_rendered_strips(
+ t->scene, channels, seqbase, t->scene->r.cfra, 0);
SEQ_filter_selected_strips(strips);
const int count = SEQ_collection_len(strips);
@@ -154,6 +155,42 @@ void createTransSeqImageData(TransInfo *t)
SEQ_collection_free(strips);
}
+static bool autokeyframe_sequencer_image(bContext *C,
+ Scene *scene,
+ StripTransform *transform,
+ const int tmode)
+{
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ RNA_pointer_create(&scene->id, &RNA_SequenceTransform, transform, &ptr);
+
+ const bool around_cursor = scene->toolsettings->sequencer_tool_settings->pivot_point ==
+ V3D_AROUND_CURSOR;
+ const bool do_loc = tmode == TFM_TRANSLATION || around_cursor;
+ const bool do_rot = tmode == TFM_ROTATION;
+ const bool do_scale = tmode == TFM_RESIZE;
+
+ bool changed = false;
+ if (do_rot) {
+ prop = RNA_struct_find_property(&ptr, "rotation");
+ changed |= ED_autokeyframe_property(C, scene, &ptr, prop, -1, scene->r.cfra, false);
+ }
+ if (do_loc) {
+ prop = RNA_struct_find_property(&ptr, "offset_x");
+ changed |= ED_autokeyframe_property(C, scene, &ptr, prop, -1, scene->r.cfra, false);
+ prop = RNA_struct_find_property(&ptr, "offset_y");
+ changed |= ED_autokeyframe_property(C, scene, &ptr, prop, -1, scene->r.cfra, false);
+ }
+ if (do_scale) {
+ prop = RNA_struct_find_property(&ptr, "scale_x");
+ changed |= ED_autokeyframe_property(C, scene, &ptr, prop, -1, scene->r.cfra, false);
+ prop = RNA_struct_find_property(&ptr, "scale_y");
+ changed |= ED_autokeyframe_property(C, scene, &ptr, prop, -1, scene->r.cfra, false);
+ }
+
+ return changed;
+}
+
void recalcData_sequencer_image(TransInfo *t)
{
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
@@ -187,6 +224,7 @@ void recalcData_sequencer_image(TransInfo *t)
copy_v2_v2(translation, tdseq->orig_origin_position);
sub_v2_v2(translation, origin);
mul_v2_v2(translation, mirror);
+ translation[0] *= t->scene->r.yasp / t->scene->r.xasp;
transform->xofs = tdseq->orig_translation[0] - translation[0];
transform->yofs = tdseq->orig_translation[1] - translation[1];
@@ -199,6 +237,12 @@ void recalcData_sequencer_image(TransInfo *t)
if (t->mode == TFM_ROTATION) {
transform->rotation = tdseq->orig_rotation - t->values_final[0];
}
+
+ if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+ animrecord_check_state(t, &t->scene->id);
+ autokeyframe_sequencer_image(t->context, t->scene, transform, t->mode);
+ }
+
SEQ_relations_invalidate_cache_preprocessed(t->scene, seq);
}
}
@@ -211,9 +255,6 @@ void special_aftertrans_update__sequencer_image(bContext *UNUSED(C), TransInfo *
TransData2D *td2d = NULL;
int i;
- PointerRNA ptr;
- PropertyRNA *prop;
-
for (i = 0, td = tc->data, td2d = tc->data_2d; i < tc->data_len; i++, td++, td2d++) {
TransDataSeq *tdseq = td->extra;
Sequence *seq = tdseq->seq;
@@ -225,24 +266,8 @@ void special_aftertrans_update__sequencer_image(bContext *UNUSED(C), TransInfo *
continue;
}
- Scene *scene = t->scene;
- RNA_pointer_create(&scene->id, &RNA_SequenceTransform, transform, &ptr);
-
- if (t->mode == TFM_ROTATION) {
- prop = RNA_struct_find_property(&ptr, "rotation");
- ED_autokeyframe_property(t->context, scene, &ptr, prop, -1, CFRA);
- }
- if (t->mode == TFM_TRANSLATION) {
- prop = RNA_struct_find_property(&ptr, "offset_x");
- ED_autokeyframe_property(t->context, scene, &ptr, prop, -1, CFRA);
- prop = RNA_struct_find_property(&ptr, "offset_y");
- ED_autokeyframe_property(t->context, scene, &ptr, prop, -1, CFRA);
- }
- if (t->mode == TFM_RESIZE) {
- prop = RNA_struct_find_property(&ptr, "scale_x");
- ED_autokeyframe_property(t->context, scene, &ptr, prop, -1, CFRA);
- prop = RNA_struct_find_property(&ptr, "scale_y");
- ED_autokeyframe_property(t->context, scene, &ptr, prop, -1, CFRA);
+ if (IS_AUTOKEY_ON(t->scene)) {
+ autokeyframe_sequencer_image(t->context, t->scene, transform, t->mode);
}
}
}