fix [#30666] Texturepaint "Soften" brush gets stuck

use derived mesh tessfaces since the mesh doesnt ensure this, also means non-project-painting in the viewport works with modifiers now.
This commit is contained in:
Campbell Barton
2012-03-28 00:42:38 +00:00
parent 046eb6531c
commit 48afa89dd2
2 changed files with 6 additions and 5 deletions

View File

@@ -132,7 +132,7 @@ void paint_calc_redraw_planes(float planes[4][4],
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
float paint_get_tex_pixel(struct Brush* br, float u, float v);
int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, const int mval[2], unsigned int *index);
int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);

View File

@@ -314,17 +314,18 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
dm->release(dm);
}
///* returns 0 if not found, otherwise 1 */
int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned int *index)
/* returns 0 if not found, otherwise 1 */
int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface)
{
if (!me || me->totface==0)
if (totface == 0)
return 0;
/* sample only on the exact position */
*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
if ((*index)<=0 || (*index)>(unsigned int)me->totface)
if ((*index) <= 0 || (*index) > (unsigned int)totface) {
return 0;
}
(*index)--;