Delete unused code, separate for better diff appearance.
authorAlexander Gavrilov <angavrilov@gmail.com>
Tue, 19 Jan 2016 11:12:22 +0000 (14:12 +0300)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 20 Jan 2016 20:24:37 +0000 (07:24 +1100)
source/blender/editors/sculpt_paint/paint_vertex.c

index 978bc278fcf1bd4235a7d36136b7e4a45f46e3ad..496055bfb47e6d4d0de84c38cc1b268ce2de6504 100644 (file)
@@ -1420,51 +1420,6 @@ static void multipaint_apply_change(MDeformVert *dvert, const int defbase_tot, f
        }
 }
 
-#if 0
-/* multi-paint's initial, potential change is computed here based on the user's stroke */
-static float get_mp_change(MDeformVert *odv, const int defbase_tot, const bool *defbase_sel, float brush_change)
-{
-       float selwsum = 0.0f;
-       unsigned int i;
-       MDeformWeight *dw = odv->dw;
-
-       for (i = odv->totweight; i != 0; i--, dw++) {
-               if (dw->def_nr < defbase_tot) {
-                       if (defbase_sel[dw->def_nr]) {
-                               selwsum += dw->weight;
-                       }
-               }
-       }
-       if (selwsum && selwsum + brush_change > 0) {
-               return (selwsum + brush_change) / selwsum;
-       }
-       return 0.0f;
-}
-
-/* change the weights back to the wv's weights
- * it assumes you already have the correct pointer index */
-static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
-{
-       MDeformWeight *dw = dv->dw;
-       MDeformWeight *dw_prev;
-       unsigned int i;
-       for (i = dv->totweight; i != 0; i--, dw++) {
-               dw_prev = defvert_find_index(dv_prev, dw->def_nr);
-               /* if there was no w when there is a d, then the old weight was 0 */
-               dw->weight = dw_prev ? dw_prev->weight : 0.0f;
-       }
-}
-
-static void clamp_weights(MDeformVert *dvert)
-{
-       MDeformWeight *dw = dvert->dw;
-       unsigned int i;
-       for (i = dvert->totweight; i != 0; i--, dw++) {
-               CLAMP(dw->weight, 0.0f, 1.0f);
-       }
-}
-#endif
-
 /**
  * Variables stored both for 'active' and 'mirror' sides.
  */
@@ -1656,100 +1611,6 @@ static void do_weight_paint_vertex_single(
                        }
                }
        }
-#if 0
-       else {
-               /* use locks and/or multipaint */
-               float oldw;
-               float neww;
-               /* float testw = 0; */ /* UNUSED */
-               float observedChange = 0;
-               float change = 0;
-               float oldChange = 0;
-               int i;
-               MDeformWeight *tdw = NULL, *tdw_prev;
-               MDeformVert dv_copy = {NULL};
-
-               oldw = dw->weight;
-               neww = wpaint_blend(wp, dw->weight, dw_prev->weight, alpha, paintweight,
-                                   wpi->brush_alpha_value, wpi->do_flip, true);
-               
-               /* setup multi-paint */
-               observedChange = neww - oldw;
-               if (observedChange) {
-                       dv_copy.dw = MEM_dupallocN(dv->dw);
-                       dv_copy.flag = dv->flag;
-                       dv_copy.totweight = dv->totweight;
-                       tdw = dw;
-                       tdw_prev = dw_prev;
-                       change = get_mp_change(&wp->wpaint_prev[index], wpi->defbase_tot, wpi->defbase_sel, observedChange);
-                       if (change) {
-                               if (!tdw->weight) {
-                                       i = get_first_selected_nonzero_weight(dv, wpi->defbase_tot, wpi->defbase_sel);
-                                       if (i >= 0) {
-                                               tdw = &(dv->dw[i]);
-                                               tdw_prev = defvert_verify_index(&wp->wpaint_prev[index], tdw->def_nr);
-                                       }
-                                       else {
-                                               change = 0;
-                                       }
-                               }
-                               if (change && tdw_prev->weight && tdw_prev->weight * change) {
-                                       if (tdw->weight != tdw_prev->weight) {
-                                               oldChange = tdw->weight / tdw_prev->weight;
-                                               /* testw = tdw_prev->weight * change; */ /* UNUSED */
-                                               if (observedChange > 0) {
-                                                       if (change > oldChange) {
-                                                               /* reset the weights and use the new change */
-                                                               defvert_reset_to_prev(wp->wpaint_prev + index, dv);
-                                                       }
-                                                       else {
-                                                               /* the old change was more significant, so set
-                                                                * the change to 0 so that it will not do another multi-paint */
-                                                               change = 0;
-                                                       }
-                                               }
-                                               else {
-                                                       if (change < oldChange) {
-                                                               defvert_reset_to_prev(wp->wpaint_prev + index, dv);
-                                                       }
-                                                       else {
-                                                               change = 0;
-                                                       }
-                                               }
-                                       }
-                               }
-                               else {
-                                       change = 0;
-                               }
-                       }
-               }
-               
-               if (apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
-                       defvert_reset_to_prev(&dv_copy, dv);
-                       change = 0;
-                       oldChange = 0;
-               }
-               if (dv_copy.dw) {
-                       MEM_freeN(dv_copy.dw);
-               }
-#if 0
-               /* dv may have been altered greatly */
-               dw = defvert_find_index(dv, vgroup);
-#else
-               dw = NULL; /* UNUSED after assignment, set to NULL to ensure we don't
-                           * use again, we thats needed un-ifdef the line above */
-               (void)dw;  /* quiet warnigns */
-#endif
-
-               /* x mirror painting */
-               if (index_mirr != -1) {
-                       /* copy, not paint again */
-
-                       /* dw_mirr->weight = dw->weight; */  /* TODO, explain the logic in not assigning weight! - campbell */
-                       apply_mp_locks_normalize(me, wpi, index_mirr, dw_mirr, tdw, change, oldChange, oldw, neww);
-               }
-       }
-#endif
 }
 
 static void do_weight_paint_vertex_multi(