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:
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index d49ce0cf49a..1d2bab1862a 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -2902,11 +2902,11 @@ static void project_paint_begin(ProjPaintState *ps)
}
ps->dm_mvert = ps->dm->getVertArray(ps->dm);
- ps->dm_mface = ps->dm->getFaceArray(ps->dm);
- ps->dm_mtface= ps->dm->getFaceDataArray(ps->dm, CD_MTFACE);
+ ps->dm_mface = ps->dm->getTessFaceArray(ps->dm);
+ ps->dm_mtface= ps->dm->getTessFaceDataArray(ps->dm, CD_MTFACE);
ps->dm_totvert = ps->dm->getNumVerts(ps->dm);
- ps->dm_totface = ps->dm->getNumFaces(ps->dm);
+ ps->dm_totface = ps->dm->getNumTessFaces(ps->dm);
/* use clone mtface? */
@@ -2939,15 +2939,18 @@ static void project_paint_begin(ProjPaintState *ps)
}
/* when using subsurf or multires, mface arrays are thrown away, we need to keep a copy */
- if(ps->dm->type != DM_TYPE_CDDM) {
+ // this seems like a bad check, since some constructive modifiers use cddm? - joeedh
+ if(1) { //ps->dm->type != DM_TYPE_CDDM) {
ps->dm_mvert= MEM_dupallocN(ps->dm_mvert);
ps->dm_mface= MEM_dupallocN(ps->dm_mface);
/* looks like these are ok for now.*/
- /*
+
ps->dm_mtface= MEM_dupallocN(ps->dm_mtface);
- ps->dm_mtface_clone= MEM_dupallocN(ps->dm_mtface_clone);
- ps->dm_mtface_stencil= MEM_dupallocN(ps->dm_mtface_stencil);
- */
+ if (ps->dm_mtface_clone)
+ ps->dm_mtface_clone= MEM_dupallocN(ps->dm_mtface_clone);
+ if (ps->dm_mtface_stencil)
+ ps->dm_mtface_stencil= MEM_dupallocN(ps->dm_mtface_stencil);
+
}
ps->viewDir[0] = 0.0f;
@@ -3424,7 +3427,8 @@ static void project_paint_end(ProjPaintState *ps)
}
/* copy for subsurf/multires, so throw away */
- if(ps->dm->type != DM_TYPE_CDDM) {
+ // this seems like a bad check, since some constructive modifiers use cddm? - joeedh
+ if(1) { //ps->dm->type != DM_TYPE_CDDM) {
if(ps->dm_mvert) MEM_freeN(ps->dm_mvert);
if(ps->dm_mface) MEM_freeN(ps->dm_mface);
/* looks like these dont need copying */
@@ -4733,9 +4737,29 @@ static int texture_paint_init(bContext *C, wmOperator *op)
pop->orig_brush_size= brush_size(brush);
if(pop->mode != PAINT_MODE_2D) {
+ Mesh *me;
+
pop->s.ob = OBACT;
+ if (!pop->ps.ob)
+ pop->ps.ob = pop->s.ob;
+
pop->s.me = get_mesh(pop->s.ob);
if (!pop->s.me) return 0;
+
+ me = pop->s.me;
+
+ /*recalc mesh tesselation so the face origindex values point
+ to the tesselation faces themselves, instead of polys*/
+ me->totface = mesh_recalcTesselation(&me->fdata, &me->ldata,
+ &me->pdata, me->mvert, me->totface, me->totloop, me->totpoly, 0, 1);
+ mesh_update_customdata_pointers(me);
+
+ /*force customdata update*/
+ makeDerivedMesh(scene, pop->ps.ob, NULL, CD_MASK_BAREMESH, 0);
+
+ /* Dont allow brush size below 2 */
+ if (pop->ps.brush && pop->ps.brush->size<=1)
+ pop->ps.brush->size = 2;
}
else {
pop->s.image = pop->s.sima->image;