Revision: 37143
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37143
Author:   jwilkins
Date:     2011-06-03 19:33:15 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
Revision: 29352
Author: nicholasbishop
Date: 7:34:20 PM, Tuesday, June 08, 2010
Message:
* Added a button to invert the mask
* Renamed mask "Full" to "Fill"

** jwilkins:
** made mask brush obey Front-Face only

Modified Paths:
--------------
    
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c

Property Changed:
----------------
    branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29351
/trunk/blender:36833-37054
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29352
/trunk/blender:36833-37054

Modified: 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py   
    2011-06-03 17:43:52 UTC (rev 37142)
+++ 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py   
    2011-06-03 19:33:15 UTC (rev 37143)
@@ -716,10 +716,11 @@
 
         settings = self.paint_settings(context)
 
-        row = layout.row(align=True)
-        row.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
-        row.operator("paint.mask_set", text="Full").mode = 'FULL'
-        row.operator("paint.mask_set", text="Random").mode = 'RANDOM'
+        col = layout.column()
+        col.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
+        col.operator("paint.mask_set", text="Fill").mode = 'FILL'
+        col.operator("paint.mask_set", text="Invert").mode = 'INVERT'
+        col.operator("paint.mask_set", text="Random").mode = 'RANDOM'
 
 
 class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-03 17:43:52 UTC (rev 37142)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-03 19:33:15 UTC (rev 37143)
@@ -873,7 +873,6 @@
                                                break;
                                        }
 
-                                       
                                        /* Paint Masks */
                                        if(mask && smask && stored_mask) {
                                                switch(op) {
@@ -888,12 +887,12 @@
                                                        
stored_mask[stored_offset] += *mask;
                                                        
CLAMP(stored_mask[stored_offset], 0, 1);
                                                        break;
+                                               }
+                                       }
                                }
                        }
                }
        }
-               }
-       }
 
        if(op == APPLY_DISPS) {
                ccgSubSurf_stitchFaces(ccgdm->ss, 0, NULL, 0);

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h  
2011-06-03 17:43:52 UTC (rev 37142)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h  
2011-06-03 19:33:15 UTC (rev 37143)
@@ -146,7 +146,8 @@
 /* For now this is just temporary stuff to test masking */
 typedef enum {
        MASKING_CLEAR,
-       MASKING_FULL,
+       MASKING_FILL,
+       MASKING_INVERT,
        MASKING_RANDOM,
 } MaskSetMode;
 void PAINT_OT_mask_set(struct wmOperatorType *ot);

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-06-03 17:43:52 UTC (rev 37142)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-06-03 19:33:15 UTC (rev 37143)
@@ -24,11 +24,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-static float get_mask_value(MaskSetMode mode)
+static void set_mask_value(MaskSetMode mode, float *m)
 {
-       return (mode == MASKING_CLEAR ? 1 :
-               mode == MASKING_FULL ? 0 :
-               mode == MASKING_RANDOM ? (float)rand() / RAND_MAX : 0);
+       *m = (mode == MASKING_CLEAR ? 1 :
+             mode == MASKING_FILL ? 0 :
+             mode == MASKING_INVERT ? (1 - *m) :
+             mode == MASKING_RANDOM ? (float)rand() / RAND_MAX : 0);
 }
 
 static int paint_mask_set_exec(bContext *C, wmOperator *op)
@@ -63,7 +64,7 @@
 
                        BLI_pbvh_vertex_iter_begin(pbvh, nodes[n], vd, 
PBVH_ITER_UNIQUE) {
                                if(vd.mask)
-                                       *vd.mask = get_mask_value(mode);
+                                       set_mask_value(mode, vd.mask);
                        }
                        BLI_pbvh_vertex_iter_end;
 
@@ -93,7 +94,8 @@
 {
        static EnumPropertyItem mask_items[] = {
                {MASKING_CLEAR, "CLEAR", 0, "Clear", ""},
-               {MASKING_FULL, "FULL", 0, "Full", ""},
+               {MASKING_FILL, "FILL", 0, "Fill", ""},
+               {MASKING_INVERT, "INVERT", 0, "Invert", ""},
                {MASKING_RANDOM, "RANDOM", 0, "Random", ""},
                {0, NULL, 0, NULL, NULL}};
 

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c        
2011-06-03 17:43:52 UTC (rev 37142)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c        
2011-06-03 19:33:15 UTC (rev 37143)
@@ -2827,20 +2827,25 @@
        for(n=0; n<totnode; n++) {
                PBVHVertexIter vd;
                SculptBrushTest test;
+               SculptUndoNode *unode;
+               short (*origno)[3];
 
-               sculpt_undo_push_node(ob, nodes[n]);
+               unode=  sculpt_undo_push_node(ob, nodes[n]);
+               origno= unode->no;
+
                sculpt_brush_test_init(ss, &test);
 
                BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, 
PBVH_ITER_UNIQUE) {
                        /* TODO: should add a mask layer if needed */
                        if(vd.mask) {
                                if(sculpt_brush_test(&test, vd.co)) {
-                                       float fade = tex_strength(ss, brush, 
vd.co, NULL, test.dist)*bstrength;
+                                       float fade = bstrength*tex_strength(ss, 
brush, vd.co, NULL, test.dist)*frontface(brush, ss->cache->frontface_start, 
ss->cache->frontface_range, ss->cache->view_normal, origno[vd.i]);
 
                                        *vd.mask -= fade;
                                        CLAMP(*vd.mask, 0, 1);
-                               
-                                       if(vd.mvert) vd.mvert->flag |= 
ME_VERT_PBVH_UPDATE;
+
+                                       if(vd.mvert)
+                                               vd.mvert->flag |= 
ME_VERT_PBVH_UPDATE;
                                }
                        }
                }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to