[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39277] branches/soc-2011-onion/source/ blender: Revision: 30886
Jason Wilkins
Jason.A.Wilkins at gmail.com
Thu Aug 11 00:22:18 CEST 2011
Revision: 39277
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39277
Author: jwilkins
Date: 2011-08-10 22:22:17 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Revision: 30886
Author: nicholasbishop
Date: 8:27:38 PM, Thursday, July 29, 2010
Message:
== VPaint ==
* Switched vpaint to use paint/pbvh undo system
TODO:
* Undo for adding/removing color layers
----
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/util/undo.c
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/pbvh_undo.c
branches/soc-2011-onion/source/blender/editors/util/undo.c
Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h 2011-08-10 21:51:03 UTC (rev 39276)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h 2011-08-10 22:22:17 UTC (rev 39277)
@@ -205,7 +205,7 @@
/* grid */
struct DMGridData **grids;
- struct DMGridData *grid;
+ struct DMGridData *grid, *elem;
int *grid_indices;
int totgrid;
int gridsize;
@@ -308,7 +308,7 @@
vi.gridkey)[vi.pmask_active_layer - \
vi.pmask_first_layer]; \
} \
- \
+ vi.elem= vi.grid; \
GRIDELEM_INC(vi.grid, 1, vi.gridkey); \
} \
else { \
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c 2011-08-10 21:51:03 UTC (rev 39276)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c 2011-08-10 22:22:17 UTC (rev 39277)
@@ -1924,6 +1924,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)) {
@@ -2318,6 +2320,8 @@
/* frees prev buffer */
copy_vpaint_prev(vp, NULL, 0);
+ pbvh_undo_push_end();
+
paint_tex_done(C);
free_mode_data(paint_stroke_mode_data(stroke));
@@ -2383,6 +2387,8 @@
paint_tex_init(C);
+ pbvh_undo_push_begin("Vertex paint");
+
paint_bspace_init(
C,
stroke,
@@ -2581,9 +2587,7 @@
ot->cancel= vpaint_stroke_cancel;
/* flags */
- /* XXX: registration is taking too long
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; */
- ot->flag= OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag= OPTYPE_BLOCKING;
/* properties */
paint_stroke_def_properties(ot, 1, 1, 1, "Blur");
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/pbvh_undo.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/pbvh_undo.c 2011-08-10 21:51:03 UTC (rev 39276)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/pbvh_undo.c 2011-08-10 22:22:17 UTC (rev 39277)
@@ -384,7 +384,7 @@
struct CustomData *vdata, *fdata;
struct MFace *mface;
- int totface, *face_indices;
+ int *face_indices;
struct GridKey *gridkey;
int uses_grids, totgrid, *grid_indices;
@@ -434,7 +434,7 @@
totbytes += bytes;
}
- else {
+ else if (!uses_grids || ob->paint->modifiers_active) {
/* regular mesh */
int bytes= sizeof(int) * allvert;
@@ -506,7 +506,7 @@
gridelem_active_offset(fdata, gridkey, CD_MCOL);
}
else {
- int bytes= sizeof(int) * (unode->totface);
+ int bytes;
BLI_pbvh_node_get_faces(
pbvh,
@@ -514,16 +514,16 @@
&mface,
&face_indices,
NULL,
- &totface);
+ &(unode->totface));
- unode->totface= totface;
+ bytes= sizeof(int) * (unode->totface);
unode->face_indices=
MEM_mapallocN(bytes, "PBVHUndoNode.face_indices");
totbytes += bytes;
- totcol= 4 * totface;
+ totcol= 4 * (unode->totface);
}
bytes= 4 * sizeof(float) * totcol;
@@ -580,19 +580,20 @@
unode->color[vd.i];
float *src=
- GRIDELEM_COLOR(vd.grid, vd.gridkey)[grids_active_color];
+ GRIDELEM_COLOR(vd.elem, vd.gridkey)[grids_active_color];
copy_v4_v4(dst, src);
}
}
- if (vd.vert_indices)
+ if (vd.vert_indices) {
unode->vert_indices[vd.i]= vd.vert_indices[vd.i];
- if (ob->paint->modifiers_active) {
- copy_v3_v3(
- unode->orig_co[vd.i],
- paint_mesh_orig_co(ob, unode->vert_indices[vd.i]));
+ if (ob->paint->modifiers_active) {
+ copy_v3_v3(
+ unode->orig_co[vd.i],
+ paint_mesh_orig_co(ob, unode->vert_indices[vd.i]));
+ }
}
}
BLI_pbvh_vertex_iter_end;
@@ -607,7 +608,7 @@
int active= CustomData_get_active_layer_index(fdata, CD_MCOL);
- for (i= 0; i < totface; ++i) {
+ for (i= 0; i < (unode->totface); ++i) {
int face_index= face_indices[i];
MFace *f= mface + face_index;
int S= (f->v4) ? 4 : 3;
Modified: branches/soc-2011-onion/source/blender/editors/util/undo.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/util/undo.c 2011-08-10 21:51:03 UTC (rev 39276)
+++ branches/soc-2011-onion/source/blender/editors/util/undo.c 2011-08-10 22:22:17 UTC (rev 39277)
@@ -159,7 +159,7 @@
if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, 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))
do_glob_undo= 1;
}
More information about the Bf-blender-cvs
mailing list