diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-02 00:36:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-02 00:36:24 +0400 |
commit | 9b006d6d00c72de51b97e1b2c96b2df09db6b72b (patch) | |
tree | b90338bd20e40cfd0a859493b76ab3693b668885 /source/blender | |
parent | 0753766a578f78b003e038370abcde8732ce45db (diff) |
Fix preview render crash after recent G.main changes.
Diffstat (limited to 'source/blender')
5 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 9f9d41147b6..6261c33a6f7 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -94,6 +94,7 @@ static ScrArea *biggest_image_area(bScreen *screen) typedef struct BakeRender { Render *re; + Main *main; Scene *scene; struct Object *actob; int tot, ready; @@ -139,6 +140,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) Scene *scene= CTX_data_scene(C); bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ + bkr->main= CTX_data_main(C); bkr->scene= scene; bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL; bkr->re= RE_NewRender("_Bake View_"); @@ -196,6 +198,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr { BakeRender *bkr= bkv; Scene *scene= bkr->scene; + Main *bmain= bkr->main; bkr->stop= stop; bkr->do_update= do_update; @@ -204,7 +207,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr RE_test_break_cb(bkr->re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr->re, scene, scene->lay, scene->r.bake_mode, bkr->actob); + RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob); /* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */ bkr->tot= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress); @@ -284,6 +287,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve static int bake_image_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -302,7 +306,7 @@ static int bake_image_exec(bContext *C, wmOperator *op) RE_test_break_cb(bkr.re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr.re, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); + RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); /* baking itself is threaded, cannot use test_break in threads */ BLI_init_threads(&threads, do_bake_render, 1); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index d4c90a7f24e..49395f7fb56 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -975,7 +975,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex; /* entire cycle for render engine */ - RE_PreviewRender(re, sce); + RE_PreviewRender(re, G.main, sce); ((Camera *)sce->camera->data)->lens= oldlens; diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index bc25c9857d5..af7f3fcf387 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -213,7 +213,7 @@ void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); /* main preview render call */ -void RE_PreviewRender(struct Render *re, struct Scene *scene); +void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); @@ -249,7 +249,7 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, #define RE_BAKE_DISPLACEMENT 5 #define RE_BAKE_SHADOW 6 -void RE_Database_Baking(struct Render *re, struct Scene *scene, unsigned int lay, int type, struct Object *actob); +void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob); void RE_DataBase_GetView(struct Render *re, float mat[][4]); void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4]); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 45ffcc72bc4..e17e3a3c600 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5560,12 +5560,13 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce, unsigned int lay) RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects RE_BAKE_SHADOW: for baking, only shadows, but all objects */ -void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Object *actob) +void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, int type, Object *actob) { float mat[4][4]; float amb[3]; int onlyselected, nolamps; + re->main= bmain; re->scene= scene; re->lay= lay; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index dbb117d3542..e9004f6a90f 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2975,7 +2975,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int G.rendering= 0; } -void RE_PreviewRender(Render *re, Scene *sce) +void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) { int winx, winy; @@ -2984,6 +2984,7 @@ void RE_PreviewRender(Render *re, Scene *sce) RE_InitState(re, NULL, &sce->r, NULL, winx, winy, NULL); + re->main = bmain; re->scene = sce; re->lay = sce->lay; |