diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-13 18:23:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-13 18:23:44 +0400 |
commit | 0738ae7688d19b471b7cde9cc631096a6162b3fc (patch) | |
tree | 4e83e06a400cc1b2845f6e0945bee09196b8083f /source/blender/blenkernel/intern/texture.c | |
parent | 9ce2086506dcf16ecc0d5dce7851439ae8818e78 (diff) |
2.5: more removal of G.main.
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index fe5abbd0868..9075c64d286 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -602,9 +602,10 @@ void tex_set_type(Tex *tex, int type) Tex *add_texture(const char *name) { + Main *bmain= G.main; Tex *tex; - tex= alloc_libblock(&G.main->tex, ID_TE, name); + tex= alloc_libblock(&bmain->tex, ID_TE, name); default_tex(tex); @@ -726,6 +727,7 @@ Tex *copy_texture(Tex *tex) void make_local_texture(Tex *tex) { + Main *bmain= G.main; Tex *texn; Material *ma; World *wrld; @@ -755,7 +757,7 @@ void make_local_texture(Tex *tex) return; } - ma= G.main->mat.first; + ma= bmain->mat.first; while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { @@ -765,7 +767,7 @@ void make_local_texture(Tex *tex) } ma= ma->id.next; } - la= G.main->lamp.first; + la= bmain->lamp.first; while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { @@ -775,7 +777,7 @@ void make_local_texture(Tex *tex) } la= la->id.next; } - wrld= G.main->world.first; + wrld= bmain->world.first; while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { @@ -785,7 +787,7 @@ void make_local_texture(Tex *tex) } wrld= wrld->id.next; } - br= G.main->brush.first; + br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { if(br->id.lib) lib= 1; @@ -803,7 +805,7 @@ void make_local_texture(Tex *tex) texn= copy_texture(tex); texn->id.us= 0; - ma= G.main->mat.first; + ma= bmain->mat.first; while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { @@ -816,7 +818,7 @@ void make_local_texture(Tex *tex) } ma= ma->id.next; } - la= G.main->lamp.first; + la= bmain->lamp.first; while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { @@ -829,7 +831,7 @@ void make_local_texture(Tex *tex) } la= la->id.next; } - wrld= G.main->world.first; + wrld= bmain->world.first; while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { @@ -842,7 +844,7 @@ void make_local_texture(Tex *tex) } wrld= wrld->id.next; } - br= G.main->brush.first; + br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { if(br->id.lib==0) { @@ -860,6 +862,7 @@ void make_local_texture(Tex *tex) void autotexname(Tex *tex) { + Main *bmain= G.main; char texstr[20][15]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend", "Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave", "Voronoi", "DistNoise", "Point Density", "Voxel Data", "", "", "", ""}; @@ -868,7 +871,7 @@ void autotexname(Tex *tex) if(tex) { if(tex->use_nodes) { - new_id(&G.main->tex, (ID *)tex, "Noddy"); + new_id(&bmain->tex, (ID *)tex, "Noddy"); } else if(tex->type==TEX_IMAGE) { @@ -878,12 +881,12 @@ void autotexname(Tex *tex) BLI_splitdirstring(di, fi); strcpy(di, "I."); strcat(di, fi); - new_id(&G.main->tex, (ID *)tex, di); + new_id(&bmain->tex, (ID *)tex, di); } - else new_id(&G.main->tex, (ID *)tex, texstr[tex->type]); + else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } - else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&G.main->tex, (ID *)tex, tex->plugin->pname); - else new_id(&G.main->tex, (ID *)tex, texstr[tex->type]); + else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname); + else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } } |