[Bf-blender-cvs] [ec23aff] soc-2016-pbvh-painting: Added PBVH & drawing to vertex paint. Now free'ing when vertex/weight paint is toggled off.

Nathan Vollmer noreply at git.blender.org
Wed May 25 00:04:26 CEST 2016


Commit: ec23aff35918a4cd039e1732ad9092f4252124b4
Author: Nathan Vollmer
Date:   Tue May 24 16:04:22 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBec23aff35918a4cd039e1732ad9092f4252124b4

Added PBVH & drawing to vertex paint. Now free'ing when vertex/weight paint is toggled off.

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

M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index cb779d8..d264336 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2587,7 +2587,7 @@ static void mesh_build_data(
 	ob->lastDataMask = dataMask;
 	ob->lastNeedMapping = need_mapping;
 
-	if (ob->mode & (OB_MODE_SCULPT | OB_MODE_WEIGHT_PAINT) && ob->sculpt) {
+	if (ob->mode & (OB_MODE_SCULPT | OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT) && ob->sculpt) {
 		/* create PBVH immediately (would be created on the fly too,
 		 * but this avoids waiting on first stroke) */
 
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 8bd3b8d..cfc9b34 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1771,6 +1771,8 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e');
 		ED_mesh_mirror_topo_table(NULL, NULL, 'e');
 
+		BKE_sculptsession_free(ob);
+
 		paint_cursor_delete_textures();
 	}
 	else {
@@ -1786,6 +1788,12 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		/* weight paint specific */
 		ED_mesh_mirror_spatial_table(ob, NULL, NULL, NULL, 's');
 		ED_vgroup_sync_from_pose(ob);
+
+		/* Create vertex/weight paint mode session data */
+		if (ob->sculpt)
+			BKE_sculptsession_free(ob);
+
+		vertex_paint_init_session(scene, ob);
 	}
 	
 	/* Weightpaint works by overriding colors in mesh,
@@ -1797,12 +1805,6 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 
 	WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
 
-	/* Create vertex/weight paint mode session data */
-	if (ob->sculpt)
-		BKE_sculptsession_free(ob);
-
-	vertex_paint_init_session(scene, ob);
-
 	return OPERATOR_FINISHED;
 }
 
@@ -2544,6 +2546,8 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 			BKE_mesh_flush_select_from_polys(me);
 		}
 
+		BKE_sculptsession_free(ob);
+
 		paint_cursor_delete_textures();
 	}
 	else {
@@ -2559,6 +2563,12 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		paint_cursor_start(C, vertex_paint_poll);
 
 		BKE_paint_init(scene, ePaintVertex, PAINT_CURSOR_VERTEX_PAINT);
+
+		/* Create vertex/weight paint mode session data */
+		if (ob->sculpt)
+			BKE_sculptsession_free(ob);
+
+		vertex_paint_init_session(scene, ob);
 	}
 	
 	/* update modifier stack for mapping requirements */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c173156..1700ba5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5420,6 +5420,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
 	ot->exec = sculpt_mode_toggle_exec;
 	ot->poll = ED_operator_object_active_editable_mesh;
 	
+	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }




More information about the Bf-blender-cvs mailing list