[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29663] branches/soc-2010-nicolasbishop/ source/blender/editors/sculpt_paint: Added undo pushes for the mask_set operator.

Nicholas Bishop nicholasbishop at gmail.com
Thu Jun 24 02:53:11 CEST 2010


Revision: 29663
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29663
Author:   nicholasbishop
Date:     2010-06-24 02:53:11 +0200 (Thu, 24 Jun 2010)

Log Message:
-----------
Added undo pushes for the mask_set operator. Also removed a bunch of old crufty declarations in sculpt_intern.h.

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt_intern.h

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c	2010-06-23 23:29:35 UTC (rev 29662)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c	2010-06-24 00:53:11 UTC (rev 29663)
@@ -30,6 +30,7 @@
 #include "ED_mesh.h"
 #include "ED_sculpt.h"
 #include "paint_intern.h"
+#include "sculpt_intern.h"
 
 static void set_mask_value(MaskSetMode mode, float *m)
 {
@@ -46,11 +47,13 @@
 	Object *ob;
 	DerivedMesh *dm;
 	struct MultiresModifierData *mmd;
+	SculptSession *ss;
 	Mesh *me;
 	PBVH *pbvh;
 
 	scene = CTX_data_scene(C);
 	ob = CTX_data_active_object(C);
+	ss = ob->sculpt;
 	me = get_mesh(ob);
 	mmd = paint_multires_active(scene, ob);
 
@@ -62,9 +65,14 @@
 		int n, totnode;
 
 		BLI_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
+
+		sculpt_undo_push_begin(ss, "Paint mask fill");
+
 		for(n=0; n<totnode; n++) {
 			PBVHVertexIter vd;
 
+			sculpt_undo_push_node(ss, nodes[n]);
+
 			BLI_pbvh_vertex_iter_begin(pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 				if(vd.mask_active)
 					set_mask_value(mode, vd.mask_active);
@@ -77,6 +85,9 @@
 		if(mmd)
 			multires_mark_as_modified(ob);
 		BLI_pbvh_update(pbvh, PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw, NULL);
+
+		sculpt_undo_push_end(ss);
+
 		WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 	}
 	
@@ -90,9 +101,8 @@
 	return ob && get_mesh(ob) && ob->sculpt;
 }
 
-/* Temporary operator to test masking; simply fills up a mask for the
-   entire object, setting each point to either 0, 1, or a random value
-*/
+/* fills up a mask for the entire object, setting each vertex to
+   either 0, 1, or a random value */
 void PAINT_OT_mask_set(wmOperatorType *ot)
 {
 	static EnumPropertyItem mask_items[] = {

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-06-23 23:29:35 UTC (rev 29662)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-06-24 00:53:11 UTC (rev 29663)
@@ -453,7 +453,7 @@
 	return NULL;
 }
 
-static SculptUndoNode *sculpt_undo_push_node(SculptSession *ss, PBVHNode *node)
+SculptUndoNode *sculpt_undo_push_node(SculptSession *ss, PBVHNode *node)
 {
 	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
 	Object *ob= ss->ob;
@@ -524,13 +524,13 @@
 	return unode;
 }
 
-static void sculpt_undo_push_begin(SculptSession *ss, char *name)
+void sculpt_undo_push_begin(SculptSession *ss, char *name)
 {
 	undo_paint_push_begin(UNDO_PAINT_MESH, name,
 		sculpt_undo_restore, sculpt_undo_free);
 }
 
-static void sculpt_undo_push_end(SculptSession *ss)
+void sculpt_undo_push_end(SculptSession *ss)
 {
 	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
 	SculptUndoNode *unode;

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt_intern.h	2010-06-23 23:29:35 UTC (rev 29662)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt_intern.h	2010-06-24 00:53:11 UTC (rev 29663)
@@ -34,41 +34,20 @@
 #include "DNA_vec_types.h"
 
 struct bContext;
-struct Brush;
 struct KeyBlock;
-struct Mesh;
-struct MultiresModifierData;
 struct Object;
 struct Scene;
-struct Sculpt;
-struct SculptStroke;
+struct PBVHNode;
+struct SculptUndoNode;
 
-/* Interface */
-void sculptmode_selectbrush_menu(void);
-void sculptmode_draw_mesh(int);
-void sculpt_paint_brush(char clear);
-void sculpt_stroke_draw(struct SculptStroke *);
-void sculpt_radialcontrol_start(int mode);
-struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct Object *ob);
-
-struct Brush *sculptmode_brush(void);
-//void do_symmetrical_brush_actions(struct Sculpt *sd, struct wmOperator *wm, struct BrushAction *a, short *, short *);
-
-void sculpt(Sculpt *sd);
-
 int sculpt_poll(struct bContext *C);
 void sculpt_update_mesh_elements(struct Scene *scene, struct Object *ob, int need_fmap);
 void sculpt_key_to_mesh(struct KeyBlock *kb, struct Object *ob);
 void sculpt_mesh_to_key(struct Object *ob, struct KeyBlock *kb);
 
-/* Stroke */
-struct SculptStroke *sculpt_stroke_new(const int max);
-void sculpt_stroke_free(struct SculptStroke *);
-void sculpt_stroke_add_point(struct SculptStroke *, const short x, const short y);
-void sculpt_stroke_apply(struct Sculpt *sd, struct SculptStroke *);
-void sculpt_stroke_apply_all(struct Sculpt *sd, struct SculptStroke *);
+/* Undo */
+void sculpt_undo_push_begin(struct SculptSession *ss, char *name);
+void sculpt_undo_push_end(struct SculptSession *ss);
+struct SculptUndoNode *sculpt_undo_push_node(struct SculptSession *ss, struct PBVHNode *node);
 
-/* Partial Mesh Visibility */
-void sculptmode_pmv(int mode);
-
 #endif





More information about the Bf-blender-cvs mailing list