svn merge ^/trunk/blender -r42009:42053
[blender.git] / source / blender / editors / sculpt_paint / paint_image.c
index f165c83..7625633 100644 (file)
@@ -2962,11 +2962,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? */
        
@@ -2999,15 +2999,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;
@@ -3486,7 +3489,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 */
@@ -4795,9 +4799,20 @@ 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;
+
+               /* 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;