Revision: 27538
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27538
Author:   campbellbarton
Date:     2010-03-16 15:39:41 +0100 (Tue, 16 Mar 2010)

Log Message:
-----------
option to lock alpha while projection painting.

Modified Paths:
--------------
    branches/render25/release/scripts/ui/space_view3d_toolbar.py
    branches/render25/source/blender/editors/sculpt_paint/paint_image.c
    branches/render25/source/blender/makesdna/DNA_brush_types.h
    branches/render25/source/blender/makesrna/intern/rna_brush.c

Modified: branches/render25/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/render25/release/scripts/ui/space_view3d_toolbar.py        
2010-03-16 13:46:40 UTC (rev 27537)
+++ branches/render25/release/scripts/ui/space_view3d_toolbar.py        
2010-03-16 14:39:41 UTC (rev 27538)
@@ -592,6 +592,11 @@
 
             col.prop(brush, "blend", text="Blend")
 
+            col = layout.column()
+            col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'))
+            col.prop(brush, "use_alpha")
+            
+
         # Weight Paint Mode #
 
         elif context.weight_paint_object and brush:

Modified: branches/render25/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/render25/source/blender/editors/sculpt_paint/paint_image.c 
2010-03-16 13:46:40 UTC (rev 27537)
+++ branches/render25/source/blender/editors/sculpt_paint/paint_image.c 
2010-03-16 14:39:41 UTC (rev 27538)
@@ -3705,6 +3705,7 @@
        float mask = 1.0f; /* airbrush wont use mask */
        unsigned short mask_short;
        float size_half = ((float)ps->brush->size) * 0.5f;
+       short lock_alpha= ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, 
IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA;
        
        LinkNode *smearPixels = NULL;
        LinkNode *smearPixels_f = NULL;
@@ -3833,6 +3834,12 @@
                                                                break;
                                                        }
                                                }
+
+                                               if(lock_alpha) {
+                                                       if (is_floatbuf)        
projPixel->pixel.f_pt[3]= projPixel->origColor.f[3];
+                                                       else                    
        projPixel->pixel.ch_pt[3]= projPixel->origColor.ch[3];
+                                               }
+
                                                /* done painting */
                                        }
                                }

Modified: branches/render25/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_brush_types.h 2010-03-16 
13:46:40 UTC (rev 27537)
+++ branches/render25/source/blender/makesdna/DNA_brush_types.h 2010-03-16 
14:39:41 UTC (rev 27538)
@@ -86,6 +86,7 @@
 #define BRUSH_SMOOTH_STROKE            2048
 #define BRUSH_PERSISTENT               4096
 #define BRUSH_ACCUMULATE               8192
+#define BRUSH_LOCK_ALPHA               16384
 
 /* Brush.sculpt_tool */
 #define SCULPT_TOOL_DRAW    1

Modified: branches/render25/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_brush.c        
2010-03-16 13:46:40 UTC (rev 27537)
+++ branches/render25/source/blender/makesrna/intern/rna_brush.c        
2010-03-16 14:39:41 UTC (rev 27538)
@@ -279,6 +279,12 @@
        RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
        RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in 
fixed position");
        RNA_def_property_update(prop, 0, "rna_Brush_update"); */
+       
+       /* only for projection paint, TODO, other paint modes */
+       prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 
BRUSH_LOCK_ALPHA);
+       RNA_def_property_ui_text(prop, "Alpha", "When this is disabled, lock 
alpha while painting");
+       RNA_def_property_update(prop, 0, "rna_Brush_update");
 
        prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to