Fix #37123: UV editor view does not update when using large faces

Update tagging was happening only after full triangle was handled.
Now made it so images are updating once in 0.5sec, progress bar
will still update only after the whole triangle is done.
This commit is contained in:
Sergey Sharybin
2013-10-17 18:29:01 +00:00
parent 2e8ab664d5
commit a709cb2d55
3 changed files with 14 additions and 4 deletions

View File

@@ -556,7 +556,7 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake",
WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
WM_jobs_customdata_set(wm_job, bkr, multiresbake_freejob);
WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_timer(wm_job, 0.5, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(wm_job, multiresbake_startjob, NULL, NULL, NULL);
G.is_break = FALSE;
@@ -816,7 +816,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, const wmEvent
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake",
WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
WM_jobs_customdata_set(wm_job, bkr, bake_freejob);
WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_timer(wm_job, 0.5, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(wm_job, bake_startjob, NULL, bake_update, NULL);
G.is_break = FALSE;

View File

@@ -322,6 +322,10 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
if (bs->rect_mask) {
bs->rect_mask[bs->rectx * y + x] = FILTER_MASK_USED;
}
if (bs->do_update) {
*bs->do_update = true;
}
}
static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist, int x, int y)

View File

@@ -95,6 +95,7 @@ typedef struct {
char *texels;
const MResolvePixelData *data;
MFlushPixel flush_pixel;
short *do_update;
} MBakeRast;
typedef struct {
@@ -162,7 +163,8 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
}
}
static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data, MFlushPixel flush_pixel)
static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data,
MFlushPixel flush_pixel, short *do_update)
{
BakeImBufuserData *userdata = (BakeImBufuserData *) ibuf->userdata;
@@ -173,6 +175,7 @@ static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResol
bake_rast->h = ibuf->y;
bake_rast->data = data;
bake_rast->flush_pixel = flush_pixel;
bake_rast->do_update = do_update;
}
static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
@@ -240,6 +243,9 @@ static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int
if ((bake_rast->texels[y * w + x]) == 0) {
bake_rast->texels[y * w + x] = FILTER_MASK_USED;
flush_pixel(bake_rast->data, x, y);
if (bake_rast->do_update) {
*bake_rast->do_update = true;
}
}
}
}
@@ -529,7 +535,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, int require_ta
handle->height_min = FLT_MAX;
handle->height_max = -FLT_MAX;
init_bake_rast(&handle->bake_rast, ibuf, &handle->data, flush_pixel);
init_bake_rast(&handle->bake_rast, ibuf, &handle->data, flush_pixel, bkr->do_update);
if (tot_thread > 1)
BLI_insert_thread(&threads, handle);