[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30886] branches/soc-2010-nicolasbishop/ source/blender: == VPaint ==

Nicholas Bishop nicholasbishop at gmail.com
Fri Jul 30 03:27:38 CEST 2010


Revision: 30886
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30886
Author:   nicholasbishop
Date:     2010-07-30 03:27:38 +0200 (Fri, 30 Jul 2010)

Log Message:
-----------
== VPaint ==

* Switched vpaint to use paint/pbvh undo system

TODO:
* Undo for adding/removing color layers

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2010-nicolasbishop/source/blender/editors/util/undo.c

Modified: branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h	2010-07-30 01:13:07 UTC (rev 30885)
+++ branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h	2010-07-30 01:27:38 UTC (rev 30886)
@@ -196,7 +196,7 @@
 
 	/* grid */
 	struct DMGridData **grids;
-	struct DMGridData *grid;
+	struct DMGridData *grid, *elem;
 	int *grid_indices;
 	int totgrid;
 	int gridsize;
@@ -300,6 +300,7 @@
 												   vi.pmask_first_layer]; \
 					} \
 					\
+					vi.elem= vi.grid; \
 					GRIDELEM_INC(vi.grid, 1, vi.gridkey); \
 				} \
 				else { \

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-07-30 01:13:07 UTC (rev 30885)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-07-30 01:27:38 UTC (rev 30886)
@@ -1570,6 +1570,8 @@
 		dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH|CD_MASK_MCOL);
 		ob->paint->pbvh = dm->getPBVH(ob, dm);
 
+		pbvh_undo_push_begin("Vertex paint");
+
 		return 1;
 	}
 	return 0;
@@ -1828,6 +1830,8 @@
 		CustomData *vdata = NULL;
 		CustomData *fdata = NULL;
 
+		pbvh_undo_push_node(nodes[n], PBVH_UNDO_COLOR, ob);
+
 		BLI_pbvh_get_customdata(pbvh, &vdata, &fdata);
 
 		if(BLI_pbvh_uses_grids(pbvh)) {
@@ -2093,6 +2097,8 @@
 {
 	ToolSettings *ts= CTX_data_tool_settings(C);
 
+	pbvh_undo_push_end();
+
 	/* frees prev buffer */
 	copy_vpaint_prev(ts->vpaint, NULL, 0);
 }
@@ -2128,7 +2134,7 @@
 	ot->poll= vertex_paint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag= OPTYPE_BLOCKING;
 
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c	2010-07-30 01:13:07 UTC (rev 30885)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c	2010-07-30 01:27:38 UTC (rev 30886)
@@ -26,8 +26,6 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  *
- * Implements the Sculpt Mode tools
- *
  */
 
 #include "BLI_math.h"
@@ -490,7 +488,7 @@
 				/* only copy for multires here */
 				if(uses_grids) {
 					copy_v4_v4(unode->color[vd.i],
-						   GRIDELEM_COLOR(vd.grid, vd.gridkey)[grids_active_color]);
+						   GRIDELEM_COLOR(vd.elem, vd.gridkey)[grids_active_color]);
 				}
 			}
 

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-07-30 01:13:07 UTC (rev 30885)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-07-30 01:27:38 UTC (rev 30886)
@@ -2844,7 +2844,7 @@
 	ot->exec= sculpt_brush_stroke_exec;
 	ot->poll= sculpt_poll;
 
-	/* flags (sculpt does own undo? (ton) */
+	/* flags */
 	ot->flag= OPTYPE_BLOCKING;
 
 	/* properties */

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/util/undo.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/util/undo.c	2010-07-30 01:13:07 UTC (rev 30885)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/util/undo.c	2010-07-30 01:27:38 UTC (rev 30886)
@@ -145,7 +145,7 @@
 			if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
 				do_glob_undo= 1;
 		}
-		else if(obact && obact->mode & OB_MODE_SCULPT) {
+		else if(obact && obact->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT)) {
 			if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname) && undoname)
 				do_glob_undo= 1;
 		}





More information about the Bf-blender-cvs mailing list