Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2007-02-09 18:08:53 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2007-02-09 18:08:53 +0300
commitac6e958e8e8026119a9d48edcf441c77071da30e (patch)
treeb16a5fc3a98329644f804ff11a3401e2e48fa34a
parentf9ff15680065d523ffa7dbeb966880440f81eda8 (diff)
Bugfix: texture paint brushes didn't work correct with multiple
texture channels.
-rw-r--r--source/blender/blenkernel/intern/brush.c11
-rw-r--r--source/blender/src/buttons_editing.c4
-rw-r--r--source/blender/src/buttons_shading.c2
-rw-r--r--source/blender/src/drawimage.c4
4 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 53fdb2ac115..b9687af3a20 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -330,7 +330,9 @@ float brush_sample_falloff(Brush *brush, float dist)
void brush_sample_tex(Brush *brush, float *xy, float *rgba)
{
- if (brush->mtex[0] && brush->mtex[0]->tex) {
+ MTex *mtex= brush->mtex[brush->texact];
+
+ if (mtex && mtex->tex) {
float co[3], tin, tr, tg, tb, ta;
int hasrgb;
@@ -338,7 +340,7 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba)
co[1]= xy[1]/(brush->size >> 1);
co[2]= 0.0f;
- hasrgb= externtex(brush->mtex[0], co, &tin, &tr, &tg, &tb, &ta);
+ hasrgb= externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
if (hasrgb) {
rgba[0]= tr;
@@ -686,6 +688,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
{
Brush *brush= painter->brush;
BrushPainterCache *cache= &painter->cache;
+ MTex *mtex= brush->mtex[brush->texact];
int size;
short flt;
@@ -703,7 +706,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
flt= cache->flt;
size= (cache->size)? cache->size: brush->size;
- if (!(brush->mtex[0] && brush->mtex[0]->tex) || (brush->mtex[0]->tex->type==0)) {
+ if (!(mtex && mtex->tex) || (mtex->tex->type==0)) {
brush_imbuf_new(brush, flt, 0, size, &cache->ibuf);
}
else if (brush->flag & BRUSH_FIXED_TEX) {
@@ -717,7 +720,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
cache->lastalpha= brush->alpha;
cache->lastinnerradius= brush->innerradius;
}
- else if ((brush->flag & BRUSH_FIXED_TEX) && brush->mtex[0] && brush->mtex[0]->tex) {
+ else if ((brush->flag & BRUSH_FIXED_TEX) && mtex && mtex->tex) {
int dx = (int)painter->lastpaintpos[0] - (int)pos[0];
int dy = (int)painter->lastpaintpos[1] - (int)pos[1];
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 52acf7b662f..94d294d2504 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -5020,6 +5020,8 @@ static void editing_panel_mesh_paint(void)
uiBlockSetCol(block, TH_AUTO);
if(brush && !brush->id.lib) {
+ MTex *mtex= brush->mtex[brush->texact];
+
butw= 320-(xco+10);
uiDefButS(block, MENU, B_NOP, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
@@ -5048,7 +5050,7 @@ static void editing_panel_mesh_paint(void)
yco -= 110;
uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (brush->mtex[0])? (ID*)brush->mtex[0]->tex: NULL;
+ id= (mtex)? (ID*)mtex->tex: NULL;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_BTEXBROWSE, ID_TE, 0, id, NULL, &(G.buts->menunr), 0, 0, B_BTEXDELETE, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_BRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
uiBlockSetCol(block, TH_AUTO);
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 514c54a1759..51e29f623bd 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -270,6 +270,8 @@ void do_texbuts(unsigned short event)
scrarea_queue_headredraw(curarea);
BIF_preview_changed(ID_TE);
allqueue(REDRAWBUTSSHADING, 0);
+ if(G.buts->texfrom == 3) /* brush texture */
+ allqueue(REDRAWIMAGE, 0);
break;
case B_TEXTYPE:
if(tex==NULL) return;
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index de80f5513a1..119beb8981c 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -1022,8 +1022,10 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
}
}
else {
+ MTex *mtex= brush->mtex[brush->texact];
+
uiBlockSetCol(block, TH_BUT_SETTING2);
- id= (brush->mtex[0])? (ID*)brush->mtex[0]->tex: NULL;
+ id= (mtex)? (ID*)mtex->tex: NULL;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMABTEXBROWSE, ID_TE, 0, id, NULL, &(G.sima->menunr), 0, 0, B_SIMABTEXDELETE, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_SIMABRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
uiBlockSetCol(block, TH_AUTO);