diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-11-02 21:53:33 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-11-02 22:19:16 +0300 |
commit | 0277579b2850f0ba097741ca22eb8ae9ccd9bcea (patch) | |
tree | bd7a6273d8cc91f006f3a22a8421aac4c06192f7 /source/blender/makesrna/intern/rna_sequencer.c | |
parent | 5ed4e1e23ab19282a8673bdeba3724026b80a880 (diff) |
VSE: Media transform redesign
This patch changes behavior of strip transform and crop feature.
Purpose of this change is to allow display arbitrary portion of input
image, simplify user interface and workflow.
Offset and Crop values in old files are converted in versioning.
Offset animation is also converted. Crop animation and animation of
crop or offset enable properties is not taken into account
Changes in behavior and interface:
- If image is added to timeline it is scaled to fit inside preview area
while maintaining aspect ratio. Image is centered. This is considered
as a baseline for further transformation.
- Scale and rotation was added, so it is possible to transform image at
it's original resolution.
- Crop will not affect image transformation (does not move image).
- Values of Crop and Transform Position are in pixels, these values are
corrected if preview is fraction of project resolution.
- Transform and Mirror panel has been removed and new Transform panel
and Crop panel is moved to Adjust panel. Mirror is now part of new
Transform panel.
Technical changes:
- Preprocessing stage must work on duplicated image, because original is
cached. Previously Crop and Offset could run at once and required only
one duplication of image. This is not the case with new algorithms, so
duplication on demand is implemented. Transformation can read original
image and will output new image that is safe to modify. It should be
possible to add crop step to transform algorithm, so that Crop won't
require previous duplication though.
- Use Crop and Use Translation checkboxes were removed. Individual
values are compared to default values to check if image needs to be
processed. In case of transform this will be done also if resolution of
source.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8393
Diffstat (limited to 'source/blender/makesrna/intern/rna_sequencer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 69 |
1 files changed, 23 insertions, 46 deletions
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 8da2d762c94..eed30b05c82 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -473,34 +473,6 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, bool value) BKE_sequencer_proxy_set(seq, value != 0); } -static void rna_Sequence_use_translation_set(PointerRNA *ptr, bool value) -{ - Sequence *seq = (Sequence *)ptr->data; - if (value) { - seq->flag |= SEQ_USE_TRANSFORM; - if (seq->strip->transform == NULL) { - seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform"); - } - } - else { - seq->flag &= ~SEQ_USE_TRANSFORM; - } -} - -static void rna_Sequence_use_crop_set(PointerRNA *ptr, bool value) -{ - Sequence *seq = (Sequence *)ptr->data; - if (value) { - seq->flag |= SEQ_USE_CROP; - if (seq->strip->crop == NULL) { - seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop"); - } - } - else { - seq->flag &= ~SEQ_USE_CROP; - } -} - static int transform_seq_cmp_fn(Sequence *seq, void *arg_pt) { SequenceSearchData *data = arg_pt; @@ -1409,18 +1381,35 @@ static void rna_def_strip_transform(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip"); RNA_def_struct_sdna(srna, "StripTransform"); + prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "scale_x"); + RNA_def_property_ui_text(prop, "Scale X", "Scale along X axis"); + RNA_def_property_ui_range(prop, 0, FLT_MAX, 3, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); + + prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "scale_y"); + RNA_def_property_ui_text(prop, "Scale Y", "Scale along Y axis"); + RNA_def_property_ui_range(prop, 0, FLT_MAX, 3, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); + prop = RNA_def_property(srna, "offset_x", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "xofs"); - RNA_def_property_ui_text( - prop, "Offset X", "Amount to move the input on the X axis within its boundaries"); - RNA_def_property_ui_range(prop, -4096, 4096, 1, -1); + RNA_def_property_ui_text(prop, "Translate X", "Move along X axis"); + RNA_def_property_ui_range(prop, INT_MIN, INT_MAX, 1, 6); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); prop = RNA_def_property(srna, "offset_y", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "yofs"); - RNA_def_property_ui_text( - prop, "Offset Y", "Amount to move the input on the Y axis within its boundaries"); - RNA_def_property_ui_range(prop, -4096, 4096, 1, -1); + RNA_def_property_ui_text(prop, "Translate Y", "Move along Y axis"); + RNA_def_property_ui_range(prop, INT_MIN, INT_MAX, 1, 6); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); + + prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "rotation"); + RNA_def_property_ui_text(prop, "Rotation", "Rotate around image centr"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); RNA_def_struct_path_func(srna, "rna_SequenceTransform_path"); @@ -2175,22 +2164,10 @@ static void rna_def_filter_video(StructRNA *srna) RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); - prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM); - RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing"); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); - prop = RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->transform"); RNA_def_property_ui_text(prop, "Transform", ""); - prop = RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP); - RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing"); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); - prop = RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->crop"); RNA_def_property_ui_text(prop, "Crop", ""); |