[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30242] branches/soc-2010-jwilkins: * added a 'copy brush' button that makes a new brush as a copy of the current brush

Jason Wilkins Jason.A.Wilkins at gmail.com
Mon Jul 12 22:34:45 CEST 2010


Revision: 30242
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30242
Author:   jwilkins
Date:     2010-07-12 22:34:45 +0200 (Mon, 12 Jul 2010)

Log Message:
-----------
* added a 'copy brush' button that makes a new brush as a copy of the current brush
* removed OTTYPE_REGISTER from some sculpt/paint operators so they don't pop up in the operator panel

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c

Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-07-12 20:17:23 UTC (rev 30241)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-07-12 20:34:45 UTC (rev 30242)
@@ -525,6 +525,8 @@
 
                 row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
 
+            col.operator("brush.copy")
+
         # Particle Mode #
 
         # XXX This needs a check if psys is editable.

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c	2010-07-12 20:17:23 UTC (rev 30241)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c	2010-07-12 20:34:45 UTC (rev 30242)
@@ -73,11 +73,40 @@
 	ot->exec= brush_add_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag= OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "type", brush_type_items, OB_MODE_VERTEX_PAINT, "Type", "Which paint mode to create the brush for.");
 }
 
+/* Brush operators */
+static int brush_copy_exec(bContext *C, wmOperator *op)
+{
+	Paint *paint = paint_get_active(CTX_data_scene(C));
+	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+	Brush *br = paint_brush(paint);
+
+	br = copy_brush(br);
+
+	if (br)
+		paint_brush_set(paint_get_active(CTX_data_scene(C)), br);
+
+	return OPERATOR_FINISHED;
+}
+
+void BRUSH_OT_copy(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Copy Brush";
+	ot->description= "Copy the current brush and create a new one";
+	ot->idname= "BRUSH_OT_copy";
+
+	/* api callbacks */
+	ot->exec= brush_copy_exec;
+	
+	/* flags */
+	ot->flag= OPTYPE_UNDO;
+}
+
 static int vertex_color_set_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene = CTX_data_scene(C);
@@ -109,6 +138,7 @@
 {
 	/* brush */
 	WM_operatortype_append(BRUSH_OT_add);
+	WM_operatortype_append(BRUSH_OT_copy);
 	WM_operatortype_append(BRUSH_OT_curve_preset);
 
 

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-12 20:17:23 UTC (rev 30241)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-12 20:34:45 UTC (rev 30242)
@@ -3671,8 +3671,6 @@
 		{ 0 }
 	};
 
-	ot->flag |= OPTYPE_REGISTER;
-
 	/* identifiers */
 	ot->name= "Sculpt Mode";
 	ot->idname= "SCULPT_OT_brush_stroke";
@@ -3684,7 +3682,7 @@
 	ot->poll= sculpt_poll;
 
 	/* flags (sculpt does own undo? (ton) */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_BLOCKING;
+	ot->flag= OPTYPE_BLOCKING;
 
 	/* properties */
 
@@ -3727,7 +3725,7 @@
 	ot->exec= sculpt_set_persistent_base;
 	ot->poll= sculpt_mode_poll;
 	
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag= 0;//OPTYPE_REGISTER;
 }
 
 /**** Toggle operator for turning sculpt mode on or off ****/
@@ -3804,7 +3802,7 @@
 	ot->exec= sculpt_toggle_mode;
 	ot->poll= ED_operator_object_active;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag= 0;
 }
 
 void ED_operatortypes_sculpt()





More information about the Bf-blender-cvs mailing list