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:
authorEitan <EitanSomething>2021-03-20 02:08:32 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-03-20 03:40:53 +0300
commit7bf977e9f0cf57add1543f83d357a19f0848b2b5 (patch)
tree5274055ce8b9e4379abc71df9755d2bd59e7b826 /source/blender/sequencer/intern/strip_add.c
parentbfad8deb0be0d014b5e05c7e1af564acb3d494d1 (diff)
Fix T54395: Original image size set incorrectly
`SequenceElement` type `orig_height` and `orig_width` members were set to incorrect size when using proxies and not set when strip was added which caused value to be unset. Since now image dimensions must be read when strip is created, these members can be initialized. When proxies are used, do not set original size since it is not guaranteed, that proxies are exact size. These values are not guaranteed to be up to date or exact. They should be used for strictly informative purposes. Reviewed By: ISS Differential Revision: https://developer.blender.org/D6506
Diffstat (limited to 'source/blender/sequencer/intern/strip_add.c')
-rw-r--r--source/blender/sequencer/intern/strip_add.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c
index aab522da659..99a01dbe791 100644
--- a/source/blender/sequencer/intern/strip_add.c
+++ b/source/blender/sequencer/intern/strip_add.c
@@ -327,6 +327,15 @@ Sequence *SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
BLI_path_abs(file_path, BKE_main_blendfile_path(bmain));
ImBuf *ibuf = IMB_loadiffname(file_path, IB_rect, seq->strip->colorspace_settings.name);
if (ibuf != NULL) {
+ /* Set image resolution. Assume that all images in sequence are same size. This fields are only
+ * informative. */
+ StripElem *strip_elem = strip->stripdata;
+ for (int i = 0; i < load_data->image.len; i++) {
+ strip_elem->orig_width = ibuf->x;
+ strip_elem->orig_height = ibuf->y;
+ strip_elem++;
+ }
+
SEQ_set_scale_to_fit(
seq, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method);
IMB_freeImBuf(ibuf);
@@ -458,6 +467,8 @@ Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
const int totfiles = seq_num_files(scene, load_data->views_format, load_data->use_multiview);
struct anim **anim_arr = MEM_callocN(sizeof(struct anim *) * totfiles, "Video files");
int i;
+ float width;
+ float height;
if (load_data->use_multiview && (load_data->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
char prefix[FILE_MAX];
@@ -528,8 +539,8 @@ Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
}
/* Set initial scale based on load_data->fit_method. */
- const float width = IMB_anim_get_image_width(anim_arr[0]);
- const float height = IMB_anim_get_image_height(anim_arr[0]);
+ width = IMB_anim_get_image_width(anim_arr[0]);
+ height = IMB_anim_get_image_height(anim_arr[0]);
SEQ_set_scale_to_fit(seq, width, height, scene->r.xsch, scene->r.ysch, load_data->fit_method);
}
@@ -542,6 +553,8 @@ Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
/* We only need 1 element for MOVIE strips. */
StripElem *se;
strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
+ strip->stripdata->orig_width = width;
+ strip->stripdata->orig_height = height;
BLI_split_dirfile(load_data->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
seq_add_set_name(seq, load_data);