diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-11-17 07:47:39 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-11-17 07:47:39 +0300 |
commit | c8ca36a9c8b9f8fabf1b8f09507f35349017cfbf (patch) | |
tree | f99eff303c17261e3fc8d19f192376f67977d179 | |
parent | 8768707610fbc1cea2bde069cdfd6d3f3e2fc522 (diff) |
Fixed the delete texture button for sculptmode textures
-rw-r--r-- | source/blender/src/headerbuttons.c | 6 | ||||
-rw-r--r-- | source/blender/src/sculptmode.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 6d9e216c47a..03f5972ee0f 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -164,6 +164,7 @@ #include "BDR_editobject.h" #include "BDR_editcurve.h" #include "BDR_editmball.h" +#include "BDR_sculptmode.h" #include "BPY_extern.h" #include "BPY_menus.h" @@ -804,7 +805,10 @@ void do_global_buttons(unsigned short event) } else { /* from brush */ br= G.scene->toolsettings->imapaint.brush; - if(br) { + if(G.f & G_SCULPTMODE) { + sculptmode_rem_tex(NULL, NULL); + allqueue(REDRAWBUTSSHADING, 0); + } else if(br) { mtex= br->mtex[ br->texact ]; if(mtex) { if(mtex->tex) mtex->tex->id.us--; diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c index 66c0d367cbc..dea45c59977 100644 --- a/source/blender/src/sculptmode.c +++ b/source/blender/src/sculptmode.c @@ -505,8 +505,9 @@ void sculptmode_rem_tex(void *junk0,void *junk1) { MTex *mtex= G.scene->sculptdata.mtex[G.scene->sculptdata.texact]; if(mtex) { - mtex->tex->id.us--; - G.scene->sculptdata.mtex[G.scene->sculptdata.texact]= 0; + if(mtex->tex) mtex->tex->id.us--; + MEM_freeN(mtex); + G.scene->sculptdata.mtex[G.scene->sculptdata.texact]= NULL; BIF_undo_push("Unlink brush texture"); allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWOOPS, 0); |