diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-18 00:18:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-18 00:46:11 +0300 |
commit | d40a24a037eae679ac2bdfc5151625ba485ef375 (patch) | |
tree | b8804a41f0ff9a7218f88e14cf076bac17207b1d /source | |
parent | 0eb54bd2266d2c8157342892a0c186dfefe7f5dc (diff) |
Fix crash on exit with Blender Internal baking and envmap render.
Diffstat (limited to 'source')
5 files changed, 20 insertions, 24 deletions
diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h index a831ab3c29c..c5d6e3b44b1 100644 --- a/source/blender/render/intern/include/renderpipeline.h +++ b/source/blender/render/intern/include/renderpipeline.h @@ -41,6 +41,7 @@ struct RenderResult; struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr); float panorama_pixel_rot(struct Render *re); void render_update_anim_renderdata(struct Render *re, struct RenderData *rd); +void render_copy_renderdata(struct RenderData *to, struct RenderData *from); #endif /* __RENDERPIPELINE_H__ */ diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 1e5e9025dcd..8aea86cf6d0 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5871,11 +5871,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, re->lay= lay; /* renderdata setup and exceptions */ - BLI_freelistN(&re->r.layers); - BLI_freelistN(&re->r.views); - re->r = scene->r; - BLI_duplicatelist(&re->r.layers, &scene->r.layers); - BLI_duplicatelist(&re->r.views, &scene->r.views); + render_copy_renderdata(&re->r, &scene->r); RE_init_threadcount(re); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index d70cc4b1ee0..b1afb86e5af 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -56,7 +56,8 @@ /* this module */ #include "render_types.h" #include "envmap.h" -#include "renderdatabase.h" +#include "renderdatabase.h" +#include "renderpipeline.h" #include "texture.h" #include "zbuf.h" @@ -138,7 +139,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->flag = re->flag; /* set up renderdata */ - envre->r = re->r; + render_copy_renderdata(&envre->r, &re->r); envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR); BLI_listbase_clear(&envre->r.layers); BLI_listbase_clear(&envre->r.views); diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 094c4de1f55..2804e2d7638 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -452,18 +452,9 @@ RenderData *RE_engine_get_render_data(Render *re) /* Bake */ void RE_bake_engine_set_engine_parameters(Render *re, Main *bmain, Scene *scene) { - curvemapping_free_data(&re->r.mblur_shutter_curve); - re->scene = scene; re->main = bmain; - re->r = scene->r; - - /* prevent crash when freeing the scene - * but it potentially leaves unfreed memory blocks - * not sure how to fix this yet -- dfelinto */ - BLI_listbase_clear(&re->r.layers); - BLI_listbase_clear(&re->r.views); - curvemapping_copy_data(&re->r.mblur_shutter_curve, &scene->r.mblur_shutter_curve); + render_copy_renderdata(&re->r, &scene->r); } bool RE_bake_has_engine(Render *re) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 59b9da9b2a6..6fef581e0ed 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -684,6 +684,19 @@ static void re_init_resolution(Render *re, Render *source, re->clipcrop = 1.0f + 2.0f / (float)(re->winx > re->winy ? re->winy : re->winx); } +void render_copy_renderdata(RenderData *to, RenderData *from) +{ + BLI_freelistN(&to->layers); + BLI_freelistN(&to->views); + curvemapping_free_data(&to->mblur_shutter_curve); + + *to = *from; + + BLI_duplicatelist(&to->layers, &from->layers); + BLI_duplicatelist(&to->views, &from->views); + curvemapping_copy_data(&to->mblur_shutter_curve, &from->mblur_shutter_curve); +} + /* what doesn't change during entire render sequence */ /* disprect is optional, if NULL it assumes full window render */ void RE_InitState(Render *re, Render *source, RenderData *rd, @@ -697,13 +710,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, re->i.starttime = PIL_check_seconds_timer(); /* copy render data and render layers for thread safety */ - BLI_freelistN(&re->r.layers); - BLI_freelistN(&re->r.views); - curvemapping_free_data(&re->r.mblur_shutter_curve); - re->r = *rd; - BLI_duplicatelist(&re->r.layers, &rd->layers); - BLI_duplicatelist(&re->r.views, &rd->views); - curvemapping_copy_data(&re->r.mblur_shutter_curve, &rd->mblur_shutter_curve); + render_copy_renderdata(&re->r, rd); if (source) { /* reuse border flags from source renderer */ |