diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
commit | 5fa7d1c1b4e7bde1d173caa60af0e273c86b6f0b (patch) | |
tree | 186a794aef722993c7067a657b4d007c62dd669b /source/blender/render | |
parent | c34f831757e0985b7523b6e5bbfadd7dd6a2c161 (diff) |
2.5: code changes to reduce the usage of G.main and pass it along
or get it from the context instead.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 7 | ||||
-rw-r--r-- | source/blender/render/intern/include/render_types.h | 4 | ||||
-rw-r--r-- | source/blender/render/intern/include/texture.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 18 | ||||
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 23 | ||||
-rw-r--r-- | source/blender/render/intern/source/pointdensity.c | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/sss.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/texture.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/voxeldata.c | 3 |
10 files changed, 37 insertions, 36 deletions
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 802703d476c..bc25c9857d5 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -37,14 +37,15 @@ struct bNodeTree; struct Image; +struct Main; struct NodeBlurData; struct Object; -struct ReportList; struct RenderData; struct RenderEngine; struct RenderEngineType; struct RenderResult; struct ReportList; +struct ReportList; struct Scene; struct SceneRenderLayer; @@ -208,8 +209,8 @@ void RE_init_threadcount(Render *re); void RE_TileProcessor(struct Render *re); /* only RE_NewRender() needed, main Blender render calls */ -void RE_BlenderFrame(struct Render *re, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); +void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); +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); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index c75ae594daf..b124102f50b 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -55,6 +55,7 @@ struct RenderBuckets; struct ObjectInstanceRen; struct RayObject; struct RayFace; +struct Main; #define TABLEINITSIZE 1024 #define LAMPINITSIZE 256 @@ -170,7 +171,8 @@ struct Render /* shadow counter, detect shadow-reuse for shaders */ int shadowsamplenr[BLENDER_MAX_THREADS]; - /* scene, and its full copy of renderdata and world */ + /* main, scene, and its full copy of renderdata and world */ + struct Main *main; Scene *scene; RenderData r; World wrld; diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 436b365b352..fb941d1b7f3 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -65,7 +65,7 @@ void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val); void init_render_textures(Render *re); -void end_render_textures(void); +void end_render_textures(Render *re); void render_realtime_texture(struct ShadeInput *shi, struct Image *ima); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 6564dd09864..45ffcc72bc4 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3855,12 +3855,12 @@ static void set_material_lightgroups(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) group->id.flag |= LIB_DOIT; /* it's a bit too many loops in loops... but will survive */ /* hola! materials not in use...? */ - for(ma= G.main->mat.first; ma; ma=ma->id.next) { + for(ma= re->main->mat.first; ma; ma=ma->id.next) { if(ma->group && (ma->group->id.flag & LIB_DOIT)) add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY); } @@ -4542,8 +4542,8 @@ void RE_Database_Free(Render *re) #if 0 /* radio can be redone better */ end_radio_render(); #endif - end_render_materials(); - end_render_textures(); + end_render_materials(re->main); + end_render_textures(re); free_pointdensities(re); @@ -4868,7 +4868,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* objects in groups with OB_RENDER_DUPLI set still need to be created, * since they may not be part of the scene */ - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) add_group_render_dupli_obs(re, group, nolamps, onlyselected, actob, timeoffset, renderlay, 0); /* imat objects has to be done again, since groups can mess it up */ @@ -4916,7 +4916,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* applies changes fully */ if((re->r.scemode & R_PREVIEWBUTS)==0) - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(use_camera_view && re->scene->camera) { @@ -4943,7 +4943,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* still bad... doing all */ init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); /* MAKE RENDER DATA */ @@ -5070,7 +5070,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la /* applies changes fully */ scene->r.cfra += timeoffset; - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(re->scene->camera) { @@ -5626,7 +5626,7 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 1accb0fdb60..8977bc7f379 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -46,7 +46,6 @@ #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_global.h" #include "BKE_image.h" // BKE_write_ibuf #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -508,7 +507,7 @@ void make_envmaps(Render *re) /* 5 = hardcoded max recursion level */ while(depth<5) { - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us && tex->type==TEX_ENVMAP) { if(tex->env && tex->env->object) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 64932313259..0db1bdc9abd 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2164,7 +2164,7 @@ static void tag_scenes_for_render(Render *re) bNode *node; Scene *sce; - for(sce= G.main->scene.first; sce; sce= sce->id.next) + for(sce= re->main->scene.first; sce; sce= sce->id.next) sce->id.flag &= ~LIB_DOIT; re->scene->id.flag |= LIB_DOIT; @@ -2319,7 +2319,7 @@ void RE_MergeFullSample(Render *re, Scene *sce, bNodeTree *ntree) /* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */ /* tag scenes unread */ - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= re->main->scene.first; scene; scene= scene->id.next) scene->id.flag |= LIB_DOIT; for(node= ntree->nodes.first; node; node= node->next) { @@ -2394,7 +2394,7 @@ static void do_render_composite_fields_blur_3d(Render *re) R.stats_draw= re->stats_draw; if (update_newframe) - scene_update_for_newframe(re->scene, re->lay); + scene_update_for_newframe(re->main, re->scene, re->lay); if(re->r.scemode & R_FULL_SAMPLE) do_merge_fullsample(re, ntree); @@ -2457,7 +2457,7 @@ static void do_render_seq(Render * re) if(recurs_depth==0) { /* otherwise sequencer animation isnt updated */ - BKE_animsys_evaluate_all_animation(G.main, (float)cfra); // XXX, was BKE_curframe(re->scene) + BKE_animsys_evaluate_all_animation(re->main, (float)cfra); // XXX, was BKE_curframe(re->scene) } recurs_depth++; @@ -2692,7 +2692,7 @@ static void update_physics_cache(Render *re, Scene *scene, int anim_init) BKE_ptcache_make_cache(&baker); } /* evaluating scene options for general Blender render */ -static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) +static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) { int winx, winy; rcti disprect; @@ -2718,6 +2718,7 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay disprect.ymax= winy; } + re->main= bmain; re->scene= scene; re->lay= lay; @@ -2760,14 +2761,14 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay } /* general Blender frame render call */ -void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) +void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) { /* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */ G.rendering= 1; scene->r.cfra= frame; - if(render_initialize_from_scene(re, scene, srl, lay, 0, 0)) { + if(render_initialize_from_main(re, bmain, scene, srl, lay, 0, 0)) { MEM_reset_peak_memory(); do_render_all_options(re); } @@ -2863,14 +2864,14 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) +void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); int cfrao= scene->r.cfra; int nfra; /* do not fully call for each frame, it initializes & pops output window */ - if(!render_initialize_from_scene(re, scene, NULL, lay, 0, 1)) + if(!render_initialize_from_main(re, bmain, scene, NULL, lay, 0, 1)) return; /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ @@ -2903,7 +2904,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ - render_initialize_from_scene(re, scene, NULL, lay, 1, 0); + render_initialize_from_main(re, bmain, scene, NULL, lay, 1, 0); if(nfra!=scene->r.cfra) { /* @@ -2918,7 +2919,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef else updatelay= re->lay; - scene_update_for_newframe(scene, updatelay); + scene_update_for_newframe(bmain, scene, updatelay); continue; } else diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 32ae3ba12dc..a09c16b7ed9 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -282,7 +282,7 @@ void make_pointdensities(Render *re) re->i.infostr= "Caching Point Densities"; re->stats_draw(re->sdh, &re->i); - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { cache_pointdensity(re, tex); } @@ -299,7 +299,7 @@ void free_pointdensities(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { free_pointdensity(re, tex); } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index aa285401524..e8c95a34ac4 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -56,7 +56,6 @@ #include "DNA_material_types.h" #include "BKE_colortools.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -993,7 +992,7 @@ void make_sss_tree(Render *re) re->i.infostr= "SSS preprocessing"; re->stats_draw(re->sdh, &re->i); - for(mat= G.main->mat.first; mat; mat= mat->id.next) + for(mat= re->main->mat.first; mat; mat= mat->id.next) if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS)) sss_create_tree_mat(re, mat); } diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 658748bdaeb..60565d0ff16 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -131,7 +131,7 @@ void init_render_textures(Render *re) { Tex *tex; - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us) init_render_texture(re, tex); tex= tex->id.next; @@ -144,10 +144,10 @@ void end_render_texture(Tex *tex) ntreeEndExecTree(tex->nodetree); } -void end_render_textures(void) +void end_render_textures(Render *re) { Tex *tex; - for(tex= G.main->tex.first; tex; tex= tex->id.next) + for(tex= re->main->tex.first; tex; tex= tex->id.next) if(tex->id.us) end_render_texture(tex); } diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 64ba206bb86..076d6355585 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -39,7 +39,6 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -#include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_modifier.h" @@ -318,7 +317,7 @@ void make_voxeldata(struct Render *re) re->stats_draw(re->sdh, &re->i); /* XXX: should be doing only textures used in this render */ - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_VOXELDATA) { cache_voxeldata(re, tex); } |