Extended the brush texture rotate option to work with Tile mode.
This commit is contained in:
@@ -4346,7 +4346,7 @@ void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsig
|
|||||||
uiDefButC(block,ROW, REDRAWBUTSEDIT, "3D", cx+78,cy,37,19, &sd->texrept, 18,SCULPTREPT_3D, 0,0,"Use vertex coords as texture coordinates");
|
uiDefButC(block,ROW, REDRAWBUTSEDIT, "3D", cx+78,cy,37,19, &sd->texrept, 18,SCULPTREPT_3D, 0,0,"Use vertex coords as texture coordinates");
|
||||||
cy-= 20;
|
cy-= 20;
|
||||||
|
|
||||||
if(sd->texrept == SCULPTREPT_DRAG) {
|
if(sd->texrept != SCULPTREPT_3D) {
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiDefButF(block,NUM,0, "Rot", cx,cy,115,19, &mtex->warpfac, 0,360,100,0, "Rotate texture clockwise");
|
uiDefButF(block,NUM,0, "Rot", cx,cy,115,19, &mtex->warpfac, 0,360,100,0, "Rotate texture clockwise");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1045,6 +1045,7 @@ float tex_strength(EditData *e, float *point, const float len,const unsigned vin
|
|||||||
else if(ss->texrndr) {
|
else if(ss->texrndr) {
|
||||||
const short bsize= sculptmode_brush()->size * 2;
|
const short bsize= sculptmode_brush()->size * 2;
|
||||||
const short half= sculptmode_brush()->size;
|
const short half= sculptmode_brush()->size;
|
||||||
|
const float rot= sd->mtex[sd->texact]->warpfac * (M_PI/180.0f);
|
||||||
int px, py;
|
int px, py;
|
||||||
unsigned i, *p;
|
unsigned i, *p;
|
||||||
RenderInfo *ri= ss->texrndr;
|
RenderInfo *ri= ss->texrndr;
|
||||||
@@ -1063,14 +1064,23 @@ float tex_strength(EditData *e, float *point, const float len,const unsigned vin
|
|||||||
const float sx= sd->mtex[sd->texact]->size[0];
|
const float sx= sd->mtex[sd->texact]->size[0];
|
||||||
const float sy= sd->texsep ? sd->mtex[sd->texact]->size[1] : sx;
|
const float sy= sd->texsep ? sd->mtex[sd->texact]->size[1] : sx;
|
||||||
|
|
||||||
px= pv.co[0];
|
float fx= pv.co[0];
|
||||||
py= pv.co[1];
|
float fy= pv.co[1];
|
||||||
|
|
||||||
|
float angle= atan2(fy, fx) + rot;
|
||||||
|
float len= sqrtf(fx*fx + fy*fy);
|
||||||
|
|
||||||
|
if(rot<0.001 && rot>-0.001) {
|
||||||
|
px= pv.co[0];
|
||||||
|
py= pv.co[1];
|
||||||
|
} else {
|
||||||
|
px= len * cos(angle) + 2000;
|
||||||
|
py= len * sin(angle) + 2000;
|
||||||
|
}
|
||||||
px%= (int)sx;
|
px%= (int)sx;
|
||||||
py%= (int)sy;
|
py%= (int)sy;
|
||||||
p= get_ri_pixel(ri, ri->pr_rectx*px/sx, ri->pr_recty*py/sy);
|
p= get_ri_pixel(ri, ri->pr_rectx*px/sx, ri->pr_recty*py/sy);
|
||||||
} else {
|
} else {
|
||||||
const float rot= sd->mtex[sd->texact]->warpfac * (M_PI/180.0f);
|
|
||||||
|
|
||||||
float fx= (pv.co[0] - e->mouse[0] + half) * (ri->pr_rectx*1.0f/bsize) - ri->pr_rectx/2;
|
float fx= (pv.co[0] - e->mouse[0] + half) * (ri->pr_rectx*1.0f/bsize) - ri->pr_rectx/2;
|
||||||
float fy= (pv.co[1] - e->mouse[1] + half) * (ri->pr_recty*1.0f/bsize) - ri->pr_recty/2;
|
float fy= (pv.co[1] - e->mouse[1] + half) * (ri->pr_recty*1.0f/bsize) - ri->pr_recty/2;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user