[Bf-blender-cvs] [825006e2026] soc-2021-vse-strip-thumbnails: Fixed Refresh cache and strip slide error
Aditya Y Jeppu
noreply at git.blender.org
Tue Jul 13 10:44:38 CEST 2021
Commit: 825006e202653a40bdbab89c4ccea46424132809
Author: Aditya Y Jeppu
Date: Tue Jul 13 14:14:02 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB825006e202653a40bdbab89c4ccea46424132809
Fixed Refresh cache and strip slide error
===================================================================
M source/blender/editors/space_sequencer/sequencer_draw.c
M source/blender/sequencer/SEQ_render.h
M source/blender/sequencer/intern/render.c
===================================================================
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index fe58bed3b8e..daf453bb5be 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1085,6 +1085,7 @@ static void draw_seq_fcurve_overlay(
typedef struct ThumbnailDrawJob {
SeqRenderData context;
Sequence *seq;
+ Sequence *seq_orig;
Scene *scene;
float x1;
float offset;
@@ -1094,6 +1095,7 @@ typedef struct ThumbnailDrawJob {
static void thumbnail_freejob(void *data)
{
ThumbnailDrawJob *tj = data;
+ SEQ_sequence_free(tj->scene, tj->seq, false);
MEM_freeN(tj->cache_limits);
MEM_freeN(tj);
}
@@ -1107,7 +1109,7 @@ static void thumbnail_endjob(void *data)
static void thumbnail_startjob(void *data, short *stop, short *do_update, float *progress)
{
ThumbnailDrawJob *tj = data;
- SEQ_render_thumbnails(&tj->context, tj->seq, tj->x1, tj->offset, tj->cache_limits);
+ SEQ_render_thumbnails(&tj->context, tj->seq, tj->seq_orig, tj->x1, tj->offset, tj->cache_limits);
UNUSED_VARS(stop, do_update, progress);
}
@@ -1141,7 +1143,8 @@ static void sequencer_thumbnail_get_job(
tj->offset = offset;
tj->cache_limits = cache_limits;
tj->context = context;
- tj->seq = seq;
+ tj->seq = SEQ_sequence_dupli_recursive(tj->scene, tj->scene, NULL, seq, 0);
+ tj->seq_orig = seq;
WM_jobs_customdata_set(wm_job, tj, thumbnail_freejob);
WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, thumbnail_endjob);
@@ -1169,11 +1172,10 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
{
struct Main *bmain = CTX_data_main(C);
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
- ScrArea *area = CTX_wm_area(C);
SeqRenderData context = {0};
ImBuf *ibuf;
bool min_size, clipped = false;
- float aspect_ratio, image_y, image_x, cropx_min, cropx_max;
+ float image_y, image_x, cropx_min, cropx_max;
rcti crop;
/* If thumbs too small ignore */
@@ -1188,11 +1190,19 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
context.is_prefetch_render = false;
context.is_proxy_render = false;
- ibuf = SEQ_get_thumbnail(&context, seq, 1.0, &crop, false, true);
- image_x = ibuf->x;
- image_y = ibuf->y;
+ image_x = seq->strip->stripdata->orig_width;
+ image_y = seq->strip->stripdata->orig_height;
- IMB_freeImBuf(ibuf);
+ /* Fix the dimensions to be max 256 for x or y */
+ float aspect_ratio = (float)image_x / image_y;
+ if (image_x > image_y) {
+ image_x = 256;
+ image_y = round_fl_to_int(image_x / aspect_ratio);
+ }
+ else {
+ image_y = 256;
+ image_x = round_fl_to_int(image_y * aspect_ratio);
+ }
/*Calculate thumb dimensions */
float thumb_h = (SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM) - (20 * U.dpi_fac * pixely);
@@ -1281,8 +1291,8 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
IMB_freeImBuf(ibuf);
}
else {
- strip_change_check = 0;
- BLI_rctf_init(&view_check, 0, 0, 0, 0);
+ sequencer_thumbnail_get_job(C, v2d, x1, thumb_w, context, seq);
+ break;
}
cut_off = 0;
diff --git a/source/blender/sequencer/SEQ_render.h b/source/blender/sequencer/SEQ_render.h
index afed2215bf3..69a3193557a 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -69,6 +69,7 @@ struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context,
struct Sequence *seq);
void SEQ_render_thumbnails(struct SeqRenderData *context,
struct Sequence *seq,
+ struct Sequence *seq_orig,
float timeline_frame,
float thumb_w,
float *cache_limits);
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index 3f394080bcf..1807c577a24 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2029,9 +2029,7 @@ static ImBuf *seq_get_uncached_thumbnail(SeqRenderData *context,
bool is_proxy_image = false;
int rectx, recty;
- BLI_mutex_lock(&seq_render_mutex);
ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image);
- BLI_mutex_unlock(&seq_render_mutex);
if (ibuf) {
float aspect_ratio = (float)ibuf->x / ibuf->y;
@@ -2102,6 +2100,7 @@ ImBuf *SEQ_get_thumbnail(SeqRenderData *context,
/* Render the series of thumbnails and store in cache */
void SEQ_render_thumbnails(SeqRenderData *context,
Sequence *seq,
+ Sequence *seq_orig,
float timeline_frame,
float thumb_w,
float *cache_limits)
@@ -2115,7 +2114,7 @@ void SEQ_render_thumbnails(SeqRenderData *context,
timeline_frame = timeline_frame - 30 * thumb_w;
float upper_limit = cache_limits[3] + 30 * thumb_w;
while (timeline_frame < upper_limit) {
- ibuf = seq_cache_get(context, seq, roundf(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL);
+ ibuf = seq_cache_get(context, seq_orig, roundf(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL);
if (ibuf) {
IMB_freeImBuf(ibuf);
timeline_frame += thumb_w;
@@ -2125,8 +2124,12 @@ void SEQ_render_thumbnails(SeqRenderData *context,
ibuf = seq_get_uncached_thumbnail(context, &state, seq, roundf(timeline_frame));
if (ibuf) {
- seq_cache_thumbnail_put(
- context, seq, roundf(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL, ibuf, cache_limits);
+ seq_cache_thumbnail_put(context,
+ seq_orig,
+ roundf(timeline_frame),
+ SEQ_CACHE_STORE_THUMBNAIL,
+ ibuf,
+ cache_limits);
IMB_freeImBuf(ibuf);
}
More information about the Bf-blender-cvs
mailing list