diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 7 | ||||
-rw-r--r-- | source/blender/editors/render/render_internal.c | 21 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 10 |
4 files changed, 35 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 50e7c83447b..103f9b76ba7 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -309,4 +309,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) { + Scene *scene; + for (scene = main->scene.first; scene; scene = scene->id.next) { + scene->r.preview_start_resolution = 64; + } + } } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index bf7b4cf785b..fd67115808f 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1014,8 +1014,6 @@ void RENDER_OT_render(wmOperatorType *ot) #define PR_UPDATE_MATERIAL 4 #define PR_UPDATE_DATABASE 8 -#define START_RESOLUTION_DIVIDER 8 - typedef struct RenderPreview { /* from wmJob */ void *owner; @@ -1032,6 +1030,7 @@ typedef struct RenderPreview { float viewmat[4][4]; + int start_resolution_divider; int resolution_divider; } RenderPreview; @@ -1193,7 +1192,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda rstats = RE_GetStats(re); if (update_flag & PR_UPDATE_VIEW) { - rp->resolution_divider = START_RESOLUTION_DIVIDER; + rp->resolution_divider = rp->start_resolution_divider; } use_border = render_view3d_disprect(rp->scene, rp->ar, rp->v3d, @@ -1388,7 +1387,12 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C) wmJob *wm_job; RenderPreview *rp; Scene *scene = CTX_data_scene(C); - + ARegion *ar = CTX_wm_region(C); + int width = ar->winx, height = ar->winy; + int divider = 1; + int resolution_threshold = scene->r.preview_start_resolution * + scene->r.preview_start_resolution; + if (CTX_wm_window(C) == NULL) return; if (!render_view3d_flag_changed(engine, C)) @@ -1399,6 +1403,12 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C) rp = MEM_callocN(sizeof(RenderPreview), "render preview"); rp->job = wm_job; + while (width * height > resolution_threshold) { + width = max_ii(1, width / 2); + height = max_ii(1, height / 2); + divider *= 2; + } + /* customdata for preview thread */ rp->scene = scene; rp->engine = engine; @@ -1407,7 +1417,8 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C) rp->v3d = rp->sa->spacedata.first; rp->rv3d = CTX_wm_region_view3d(C); rp->bmain = CTX_data_main(C); - rp->resolution_divider = START_RESOLUTION_DIVIDER; + rp->resolution_divider = divider; + rp->start_resolution_divider = divider; copy_m4_m4(rp->viewmat, rp->rv3d->viewmat); /* clear info text */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 6b1cad120a7..6cf2b338308 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -604,6 +604,9 @@ typedef struct RenderData { /* Cycles baking */ struct BakeData bake; + + int preview_start_resolution; + int pad; } RenderData; /* *************************************************************** */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bce7d0062f2..13349446168 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -4436,7 +4436,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_range(prop, 8, 65536); RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - + + prop = RNA_def_property(srna, "preview_start_resolution", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 8, 16384); + RNA_def_property_int_default(prop, 64); + RNA_def_property_ui_text(prop, "Start Resolution", "Resolution to start rendering preview at, " + "progressively increasing it to the full viewport size"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xasp"); RNA_def_property_flag(prop, PROP_PROPORTIONAL); |