Vertex Paint: use brush front-face setting
authorCampbell Barton <ideasman42@gmail.com>
Fri, 6 Oct 2017 07:57:37 +0000 (18:57 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 6 Oct 2017 07:57:37 +0000 (18:57 +1100)
Follow sculpt mode more closely by using the brush front-face option.

release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_sculpt_paint.c

index d795e09e435f0ae3382ee2a6152cc7f7963d8a06..62e88e47e2052ae45d25d49ad1c72a099bed42ab 100644 (file)
@@ -1080,10 +1080,8 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 
             # use_frontface
             col.separator()
 
             # use_frontface
             col.separator()
-            row = col.row()
-            row.prop(brush, "use_frontface", text="Front Faces Only")
-
-            col.row().prop(brush, "use_projected", expand=True)
+            col.prop(brush, "use_frontface", text="Front Faces Only")
+            col.prop(brush, "use_projected")
 
             # direction
             col.separator()
 
             # direction
             col.separator()
@@ -1133,13 +1131,15 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
+            col.separator()
             col.prop(brush, "vertex_tool", text="Blend")
 
             if brush.vertex_tool != 'SMEAR':
                 col.prop(brush, "use_accumulate")
                 col.separator()
 
             col.prop(brush, "vertex_tool", text="Blend")
 
             if brush.vertex_tool != 'SMEAR':
                 col.prop(brush, "use_accumulate")
                 col.separator()
 
-            col.row().prop(brush, "use_projected")
+            col.prop(brush, "use_frontface", text="Front Faces Only")
+            col.prop(brush, "use_projected")
 
             col = layout.column()
             col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
 
             col = layout.column()
             col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
@@ -1166,17 +1166,16 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
-            # XXX - TODO
-            # row = col.row(align=True)
-            # row.prop(brush, "jitter", slider=True)
-            # row.prop(brush, "use_pressure_jitter", toggle=True, text="")
             col.separator()
             col.prop(brush, "vertex_tool", text="Blend")
             col.separator()
             col.prop(brush, "vertex_tool", text="Blend")
-
-            col.prop(brush, "use_accumulate")
             col.prop(brush, "use_alpha")
 
             col.prop(brush, "use_alpha")
 
-            col.row().prop("use_projected")
+            if brush.vertex_tool != 'SMEAR':
+                col.prop(brush, "use_accumulate")
+                col.separator()
+
+            col.prop(brush, "use_frontface", text="Front Faces Only")
+            col.prop(brush, "use_projected")
 
             col.separator()
             col.template_ID(settings, "palette", new="palette.new")
 
             col.separator()
             col.template_ID(settings, "palette", new="palette.new")
@@ -1769,8 +1768,7 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
 
         col = layout.column()
         col.label("Falloff:")
 
         col = layout.column()
         col.label("Falloff:")
-        row = col.row()
-        row.prop(wpaint, "use_backface_culling")
+
         row = col.row()
         row.prop(wpaint, "use_normal_falloff")
         sub = row.row()
         row = col.row()
         row.prop(wpaint, "use_normal_falloff")
         sub = row.row()
@@ -1811,8 +1809,6 @@ class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
         col = layout.column()
         col.label("Falloff:")
         row = col.row()
         col = layout.column()
         col.label("Falloff:")
         row = col.row()
-        row.prop(vpaint, "use_backface_culling")
-        row = col.row()
         row.prop(vpaint, "use_normal_falloff")
         sub = row.row()
         sub.active = (vpaint.use_normal_falloff)
         row.prop(vpaint, "use_normal_falloff")
         sub = row.row()
         sub.active = (vpaint.use_normal_falloff)
index 7c54277639aee88bab5aff55e42b40d0897b1493..1487b75a4d62b40e78bc5b4f33cfbc8c3ebbd918 100644 (file)
@@ -143,7 +143,7 @@ static float view_angle_limits_apply_falloff(
 
 static bool vwpaint_use_normal(const VPaint *vp)
 {
 
 static bool vwpaint_use_normal(const VPaint *vp)
 {
-       return ((vp->flag & VP_FLAG_PROJECT_BACKFACE) == 0) ||
+       return ((vp->paint.brush->flag & BRUSH_FRONTFACE) != 0) ||
               ((vp->flag & VP_FLAG_PROJECT_FLAT) == 0);
 }
 
               ((vp->flag & VP_FLAG_PROJECT_FLAT) == 0);
 }
 
@@ -1556,7 +1556,7 @@ static void do_wpaint_brush_blur_task_cb_ex(
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                                       if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                                       if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
@@ -1632,7 +1632,7 @@ static void do_wpaint_brush_smear_task_cb_ex(
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                                       if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                                       if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
@@ -1733,7 +1733,7 @@ static void do_wpaint_brush_draw_task_cb_ex(
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                               if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                               if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength)))
@@ -2530,7 +2530,7 @@ static void do_vpaint_brush_draw_task_cb_ex(
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                               if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                               if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
@@ -2616,7 +2616,7 @@ static void do_vpaint_brush_blur_task_cb_ex(
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                float brush_strength = cache->bstrength;
                                const float angle_cos = (use_normal && vd.no) ?
                                        dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                               if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                               if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                     (angle_cos > 0.0f)) &&
                                    ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                     view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
@@ -2731,7 +2731,7 @@ static void do_vpaint_brush_smear_task_cb_ex(
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
                                        float brush_strength = cache->bstrength;
                                        const float angle_cos = (use_normal && vd.no) ?
                                                dot_vf3vs3(ss->cache->sculpt_normal_symm, vd.no) : 1.0f;
-                                       if (((data->vp->flag & VP_FLAG_PROJECT_BACKFACE) ||
+                                       if (((brush->flag & BRUSH_FRONTFACE) == 0 ||
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
                                             (angle_cos > 0.0f)) &&
                                            ((data->vp->flag & VP_FLAG_PROJECT_FLAT) ||
                                             view_angle_limits_apply_falloff(&data->vpd->normal_angle_precalc, angle_cos, &brush_strength)))
index 830c584529c174a41bc1efd39bde793886cb5569..acd712843deb4a011a036d026c1bf312d58890fd 100644 (file)
@@ -1125,7 +1125,6 @@ typedef struct VPaint {
 
 /* VPaint.flag */
 enum {
 
 /* VPaint.flag */
 enum {
-       VP_FLAG_PROJECT_BACKFACE    = (1 << 0),
        /* TODO */
        // VP_FLAG_PROJECT_XRAY        = (1 << 1),
        VP_FLAG_PROJECT_FLAT        = (1 << 3),
        /* TODO */
        // VP_FLAG_PROJECT_XRAY        = (1 << 1),
        VP_FLAG_PROJECT_FLAT        = (1 << 3),
index 6bd4aefed7a6e85c56aa80c59b30a56a30bbed4d..b12fece82d1384450396c1871aedfcba0b3f7203 100644 (file)
@@ -671,11 +671,6 @@ static void rna_def_vertex_paint(BlenderRNA *brna)
        RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
        RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
 
        RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
        RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
 
-       prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", VP_FLAG_PROJECT_BACKFACE);
-       RNA_def_property_ui_text(prop, "Cull", "Ignore vertices pointing away from the view (faster)");
-       RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
        prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", VP_FLAG_PROJECT_FLAT);
        RNA_def_property_ui_text(prop, "Normals", "Paint most on faces pointing towards the view");
        prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", VP_FLAG_PROJECT_FLAT);
        RNA_def_property_ui_text(prop, "Normals", "Paint most on faces pointing towards the view");