Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 Oct 2017 07:59:06 +0000 (12:59 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 Oct 2017 07:59:06 +0000 (12:59 +0500)
Notes:

- Changes in paint_vertex.c were simple to merge, mainly related on passing
  evaluation context.

- Conflicts in EditDM and drawmesh.c are solved using code from blender2.8
  branch. Those areas are deprecated and not to be used in final release.

  However, it's possible that some reference code from master is lost, so
  keep attention when adding alpha support for vertex painting.

15 files changed:
1  2 
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_gesture.c

Simple merge
index 9775c136586ed658e5b5bf10ff106ba539ca9375,4dd218114f64de3e93bf11e84ed6476c0c759402..1df6030bb108f947bf160ef13db342ec19bf7b4d
@@@ -1035,11 -1128,9 +1133,11 @@@ static int wpaint_mode_toggle_exec(bCon
                if (ob->sculpt) {
                        BKE_sculptsession_free(ob);
                }
 -              vertex_paint_init_session(scene, ob);
 +              vertex_paint_init_session(&eval_ctx, scene, ob);
        }
  
-       
 +      BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
++
        /* Weightpaint works by overriding colors in mesh,
         * so need to make sure we recalc on enter and
         * exit (exit needs doing regardless because we
@@@ -1228,8 -1319,7 +1326,8 @@@ static bool wpaint_stroke_test_start(bC
        int defbase_tot, defbase_tot_sel;
        bool *defbase_sel;
        SculptSession *ss = ob->sculpt;
-       VPaint *vd = CTX_data_tool_settings(C)->wpaint;
+       VPaint *vp = CTX_data_tool_settings(C)->wpaint;
 +      EvaluationContext eval_ctx;
  
        float mat[4][4], imat[4][4];
  
        copy_m3_m4(wpd->wpimat, imat);
  
        /* If not previously created, create vertex/weight paint mode session data */
 -      vertex_paint_init_session(scene, ob);
 +      vertex_paint_init_session(&eval_ctx, scene, ob);
-       vwpaint_update_cache_invariants(C, vd, ss, op, mouse);
+       vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
        vertex_paint_init_session_data(ts, ob);
  
-       if (ss->mode.wpaint.previous_weight != NULL) {
-               copy_vn_fl(ss->mode.wpaint.previous_weight, me->totvert, -1.0f);
+       if (ob->sculpt->mode.wpaint.dvert_prev != NULL) {
+               MDeformVert *dv = ob->sculpt->mode.wpaint.dvert_prev;
+               for (int i = 0; i < me->totvert; i++, dv++) {
+                       /* Use to show this isn't initialized, never apply to the mesh data. */
+                       dv->flag = 1;
+               }
        }
  
        return true;
@@@ -2084,16 -2251,14 +2267,16 @@@ static int vpaint_mode_toggle_exec(bCon
                        }
                        BKE_sculptsession_free(ob);
                }
 -              vertex_paint_init_session(scene, ob);
 +              vertex_paint_init_session(&eval_ctx, scene, ob);
        }
  
 +      BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
 +
        /* update modifier stack for mapping requirements */
 -      DAG_id_tag_update(&me->id, 0);
 +      DEG_id_tag_update(&me->id, 0);
-       
        WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
-       
        return OPERATOR_FINISHED;
  }
  
index 30d62d5a64e91fabb4d7e6bb94081b032dbe106d,9483a12aa6a1931ca68c69893caf680f714ef3e8..ef86f3c773d84db23cc65de961995aa3da1cef2f
@@@ -698,8 -692,9 +697,9 @@@ static int paint_weight_gradient_modal(
                        BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert);
                        wpaint_prev_destroy(&vert_cache->wpp);
                }
+               MEM_freeN(vert_cache);
  
 -              DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +              DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
        }
        else if (ret & OPERATOR_FINISHED) {