RenderResult should have a valid view whenever possible
This commit is contained in:
parent
f9d23b82fe
commit
f8540d7fd5
@ -60,6 +60,7 @@ struct RenderResult *render_result_new_full_sample(struct Render *re,
|
||||
|
||||
struct RenderResult *render_result_new_from_exr(void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty);
|
||||
|
||||
void render_result_view_new(struct RenderResult *rr, const char *viewname);
|
||||
void render_result_views_new(struct RenderResult *rr, struct RenderData *rd);
|
||||
|
||||
/* Merge */
|
||||
|
@ -747,6 +747,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd,
|
||||
re->result = MEM_callocN(sizeof(RenderResult), "new render result");
|
||||
re->result->rectx = re->rectx;
|
||||
re->result->recty = re->recty;
|
||||
render_result_view_new(re->result, "new temporary view");
|
||||
}
|
||||
|
||||
if (re->r.scemode & R_VIEWPORT_PREVIEW)
|
||||
|
@ -911,10 +911,16 @@ RenderResult *render_result_new_from_exr(void *exrhandle, const char *colorspace
|
||||
return rr;
|
||||
}
|
||||
|
||||
void render_result_view_new(RenderResult *rr, const char *viewname)
|
||||
{
|
||||
RenderView *rv = MEM_callocN(sizeof(RenderView), "new render view");
|
||||
BLI_addtail(&rr->views, rv);
|
||||
BLI_strncpy(rv->name, viewname, sizeof(rv->name));
|
||||
}
|
||||
|
||||
void render_result_views_new(RenderResult *rr, RenderData *rd)
|
||||
{
|
||||
SceneRenderView *srv;
|
||||
RenderView *rv;
|
||||
|
||||
/* clear previously existing views - for sequencer */
|
||||
render_result_views_free(rr);
|
||||
@ -922,19 +928,15 @@ void render_result_views_new(RenderResult *rr, RenderData *rd)
|
||||
/* check renderdata for amount of views */
|
||||
if ((rd->scemode & R_MULTIVIEW)) {
|
||||
for (srv = rd->views.first; srv; srv = srv->next) {
|
||||
if (BKE_scene_multiview_is_render_view_active(rd, srv) == false) continue;
|
||||
|
||||
rv = MEM_callocN(sizeof(RenderView), "new render view");
|
||||
BLI_addtail(&rr->views, rv);
|
||||
|
||||
BLI_strncpy(rv->name, srv->name, sizeof(rv->name));
|
||||
if (BKE_scene_multiview_is_render_view_active(rd, srv) == false)
|
||||
continue;
|
||||
render_result_view_new(rr, srv->name);
|
||||
}
|
||||
}
|
||||
|
||||
/* we always need at least one view */
|
||||
if (BLI_listbase_count_ex(&rr->views, 1) == 0) {
|
||||
rv = MEM_callocN(sizeof(RenderView), "new render view");
|
||||
BLI_addtail(&rr->views, rv);
|
||||
render_result_view_new(rr, "new render view");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user