[Bf-blender-cvs] [cc8c064f110] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Wed Sep 27 18:53:10 CEST 2017


Commit: cc8c064f11060dc7157d49282f769d49d30b9439
Author: Campbell Barton
Date:   Thu Sep 28 03:05:46 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBcc8c064f11060dc7157d49282f769d49d30b9439

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_paint.h
index 3f4941f222e,88693600653..cf4542e4824
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@@ -211,11 -244,11 +246,12 @@@ typedef struct SculptSession 
  
  void BKE_sculptsession_free(struct Object *ob);
  void BKE_sculptsession_free_deformMats(struct SculptSession *ss);
+ void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss);
  void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder);
  void BKE_sculptsession_bm_to_me_for_render(struct Object *object);
 -void BKE_sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob,
 -                                     bool need_pmap, bool need_mask);
 +void BKE_sculpt_update_mesh_elements(
 +        const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Sculpt *sd, struct Object *ob,
 +        bool need_pmap, bool need_mask);
  struct MultiresModifierData *BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob);
  int BKE_sculpt_mask_layers_ensure(struct Object *ob,
                                    struct MultiresModifierData *mmd);
diff --cc source/blender/blenkernel/BKE_pbvh.h
index 905eb677612,cc84be6e2c1..8412127c701
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@@ -30,9 -30,9 +30,10 @@@
  #include "BLI_ghash.h"
  #include "BLI_utildefines.h"
  
 +struct Gwn_Batch;
  struct CCGElem;
  struct CCGKey;
+ struct CCGDerivedMesh;
  struct CustomData;
  struct DMFlagMat;
  struct MPoly;
@@@ -119,9 -119,7 +120,10 @@@ void BKE_pbvh_raycast_project_ray_root
  void BKE_pbvh_node_draw(PBVHNode *node, void *data);
  void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
                     int (*setMaterial)(int matnr, void *attribs), bool wireframe, bool fast);
+ void BKE_pbvh_draw_BB(PBVH *bvh);
 +void BKE_pbvh_draw_cb(
 +        PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast,
 +        void (*draw_fn)(void *user_data, struct Gwn_Batch *batch), void *user_data);
  
  /* PBVH Access */
  typedef enum {
diff --cc source/blender/blenkernel/intern/paint.c
index 81b26f13a9f,25ea6ad079f..db13c23aa5f
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@@ -878,9 -898,10 +902,10 @@@ void BKE_sculpt_update_mesh_elements
  
  	ss->kb = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL;
  
 -	dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 +	dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
  
- 	if (mmd) {
+ 	/* VWPaint require mesh info for loop lookup, so require sculpt mode here */
+ 	if (mmd && ob->mode & OB_MODE_SCULPT) {
  		ss->multires = mmd;
  		ss->totvert = dm->getNumVerts(dm);
  		ss->totpoly = dm->getNumPolys(dm);
diff --cc source/blender/blenkernel/intern/pbvh.c
index ef2eaf8405b,4b154d3301c..a90a5e2a10b
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@@ -1157,10 -1161,9 +1162,10 @@@ static void pbvh_update_draw_buffers(PB
  	}
  }
  
- static void pbvh_draw_BB(PBVH *bvh)
+ void BKE_pbvh_draw_BB(PBVH *bvh)
  {
 -	GPU_pbvh_BB_draw_init();
 +	unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
 +	immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
  
  	for (int a = 0; a < bvh->totnode; a++) {
  		PBVHNode *node = &bvh->nodes[a];
@@@ -1844,70 -1870,9 +1854,70 @@@ void BKE_pbvh_draw(PBVH *bvh, float (*p
  	}
  
  	if (G.debug_value == 14)
- 		pbvh_draw_BB(bvh);
+ 		BKE_pbvh_draw_BB(bvh);
  }
  
 +struct PBVHNodeDrawCallbackData {
 +
 +	void (*draw_fn)(void *user_data, Gwn_Batch *batch);
 +	void *user_data;
 +	bool fast;
 +};
 +
 +static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
 +{
 +	struct PBVHNodeDrawCallbackData *data = data_v;
 +
 +	if (!(node->flag & PBVH_FullyHidden)) {
 +		Gwn_Batch *triangles = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast);
 +		if (triangles != NULL) {
 +			data->draw_fn(data->user_data, triangles);
 +		}
 +	}
 +}
 +
 +/**
 + * Version of #BKE_pbvh_draw that runs a callback.
 + */
 +void BKE_pbvh_draw_cb(
 +        PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast,
 +        void (*draw_fn)(void *user_data, Gwn_Batch *batch), void *user_data)
 +{
 +	struct PBVHNodeDrawCallbackData draw_data = {
 +		.fast = fast,
 +		.draw_fn = draw_fn,
 +		.user_data = user_data,
 +	};
 +	PBVHNode **nodes;
 +	int totnode;
 +
 +	for (int a = 0; a < bvh->totnode; a++)
 +		pbvh_node_check_diffuse_changed(bvh, &bvh->nodes[a]);
 +
 +	BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
 +	                       &nodes, &totnode);
 +
 +	pbvh_update_normals(bvh, nodes, totnode, fnors);
 +	pbvh_update_draw_buffers(bvh, nodes, totnode);
 +
 +	if (nodes) MEM_freeN(nodes);
 +
 +	if (planes) {
 +		BKE_pbvh_search_callback(
 +		        bvh, BKE_pbvh_node_planes_contain_AABB,
 +		        planes, pbvh_node_draw_cb, &draw_data);
 +	}
 +	else {
 +		BKE_pbvh_search_callback(
 +		        bvh, NULL,
 +		        NULL, pbvh_node_draw_cb, &draw_data);
 +	}
 +#if 0
 +	if (G.debug_value == 14)
 +		pbvh_draw_BB(bvh);
 +#endif
 +}
 +
  void BKE_pbvh_grids_update(PBVH *bvh, CCGElem **grids, void **gridfaces,
                             DMFlagMat *flagmats, BLI_bitmap **grid_hidden)
  {
diff --cc source/blender/blenloader/intern/readfile.c
index 70715bb5909,3b7662be2b2..a421abd852d
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -6127,19 -6001,8 +6127,9 @@@ static void direct_link_scene(FileData 
  		sce->toolsettings->imapaint.paintcursor = NULL;
  		sce->toolsettings->particle.paintcursor = NULL;
  		sce->toolsettings->particle.scene = NULL;
 +		sce->toolsettings->particle.scene_layer = NULL;
  		sce->toolsettings->particle.object = NULL;
  		sce->toolsettings->gp_sculpt.paintcursor = NULL;
- 
- 		/* in rare cases this is needed, see [#33806] */
- 		if (sce->toolsettings->vpaint) {
- 			sce->toolsettings->vpaint->vpaint_prev = NULL;
- 			sce->toolsettings->vpaint->tot = 0;
- 		}
- 		if (sce->toolsettings->wpaint) {
- 			sce->toolsettings->wpaint->wpaint_prev = NULL;
- 			sce->toolsettings->wpaint->tot = 0;
- 		}
  		
  		/* relink grease pencil drawing brushes */
  		link_list(fd, &sce->toolsettings->gp_brushes);
diff --cc source/blender/editors/sculpt_paint/paint_vertex.c
index 2da808b3a78,a88b834d601..0a82ac88403
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@@ -65,9 -66,8 +65,10 @@@
  #include "BKE_paint.h"
  #include "BKE_report.h"
  #include "BKE_colortools.h"
+ #include "BKE_subsurf.h"
  
 +#include "DEG_depsgraph.h"
 +
  #include "WM_api.h"
  #include "WM_types.h"
  
@@@ -449,9 -448,9 +449,9 @@@ bool ED_wpaint_fill(Object *ob, float p
  		}
  	}
  
- 	copy_wpaint_prev(wp, NULL, 0);
+ 	wpaint_prev_destroy(&wpp);
  
 -	DAG_id_tag_update(&me->id, 0);
 +	DEG_id_tag_update(&me->id, 0);
  
  	return true;
  }
@@@ -2231,170 -2891,39 +2892,39 @@@ static void wpaint_stroke_update_step(b
  	wpi.brush_alpha_value =  brush_alpha_value;
  	/* *** done setting up WeightPaintInfo *** */
  
+ 	wpaint_do_symmetrical_brush_actions(C, ob, wp, sd, wpd, &wpi);
  
+ 	swap_m4m4(vc->rv3d->persmat, mat);
  
- 	swap_m4m4(wpd->vc.rv3d->persmat, mat);
- 
- 	use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
- 	use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
- 	use_depth = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
- 
- 	/* which faces are involved */
- 	if (use_depth) {
- 		char editflag_prev = me->editflag;
- 
- 		/* Ugly hack, to avoid drawing vertex index when getting the face index buffer - campbell */
- 		me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
- 		if (use_vert_sel) {
- 			/* Ugly x2, we need this so hidden faces don't draw */
- 			me->editflag |= ME_EDIT_PAINT_FACE_SEL;
- 		}
- 		totindex = sample_backbuf_area(&eval_ctx, vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
- 		me->editflag = editflag_prev;
- 
- 		if (use_face_sel && me->totpoly) {
- 			MPoly *mpoly = me->mpoly;
- 			for (index = 0; index < totindex; index++) {
- 				if (indexar[index] && indexar[index] <= me->totpoly) {
- 					MPoly *mp = &mpoly[indexar[index] - 1];
- 
- 					if ((mp->flag & ME_FACE_SEL) == 0) {
- 						indexar[index] = 0;
- 					}
- 				}
- 			}
- 		}
- 	}
- 	else {
- 		indexar = NULL;
- 	}
- 
- 	/* incase we have modifiers */
- 	ED_vpaint_proj_handle_update(C, wpd->vp_handle, vc->ar, mval);
- 
- 	/* make sure each vertex gets treated only once */
- 	/* and calculate filter weight */
- 	paintweight = BKE_brush_weight_get(scene, brush);
- 
- 	if (use_depth) {
- 		for (index = 0; index < totindex; index++) {
- 			if (indexar[index] && indexar[index] <= me->totpoly) {
- 				MPoly *mpoly = me->mpoly + (indexar[index] - 1);
- 				MLoop *ml = me->mloop + mpoly->loopstart;
- 				int i;
+ 	/* calculate pivot for rotation around seletion if needed */
+ 	/* also needed for "View Selected" on last stroke */
+ 	paint_last_stroke_update(scene, vc->ar, mval);
  
- 				if (use_vert_sel) {
- 					for (i = 0; i < mpoly->totloop; i++, ml++) {
- 						me->dvert[ml->v].flag = (me->mvert[ml->v].flag & SELECT);
- 					}
- 				}
- 				else {
- 					for (i = 0; i < mpoly->totloop; i++, ml++) {
- 						me->dvert[ml->v].flag = 1;
- 					}
- 				}
- 			}
- 		}
- 	}
- 	else {
- 		const unsigned int totvert = me->totvert;
- 		unsigned int       i;
 -	DAG_id_tag_update(ob->data, 0);
++	DEG_id_tag_update(ob->data, 0);
+ 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ 	swap_m4m4(wpd->vc.rv3d->persmat, mat);
  
- 		/* in the case of face selection we need to flush */
- 		if (use_vert_sel || use_face_sel) {
- 			for (i = 0; i < totvert; i++) {
- 				me->dvert[i].flag = me->mvert[i].flag & SELECT;
- 			}
- 		}
- 		else {
- 			for (i = 0; i < totvert; i++) {
- 				me->dvert[i].flag = SELECT;
- 			}
+ 	rcti r;
+ 	if (sculpt_get_redraw_rect(vc->ar, CTX_wm_region_view3d(C), ob, &r)) {
+ 		if (ss->cache) {
+ 			ss->cache->current_r = r;
  		}
- 	}
  
- 	/* accumulate means we refer to the previous,
- 	 * which is either the last update, or

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list