[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39511] branches/soc-2011-onion/source/ blender: uv paint brushes

Antony Riakiotakis kalast at gmail.com
Wed Aug 17 23:56:20 CEST 2011


Revision: 39511
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39511
Author:   psy-fi
Date:     2011-08-17 21:56:18 +0000 (Wed, 17 Aug 2011)
Log Message:
-----------
uv paint brushes
=================
-Shortcuts: Use G for grab, S for relax and P for pinch brush. 

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-08-17 21:10:25 UTC (rev 39510)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-08-17 21:56:18 UTC (rev 39511)
@@ -361,6 +361,40 @@
 	ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, "Tool", "");
 }
 
+
+static int brush_uv_tool_set_exec(bContext *C, wmOperator *op)
+{
+	Brush *brush;
+	Scene *scene= CTX_data_scene(C);
+	ToolSettings *ts = scene->toolsettings;
+	ts->uv_paint_tool = RNA_enum_get(op->ptr, "tool");
+	brush = ts->uvpaint->paint.brush;
+	/* To update toolshelf */
+	WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+
+	return OPERATOR_FINISHED;
+}
+
+static void BRUSH_OT_uv_tool_set(wmOperatorType *ot)
+{
+	/* from rna_scene.c */
+	extern EnumPropertyItem uv_paint_tool_items[];
+	/* identifiers */
+	ot->name= "UV Paint Tool Set";
+	ot->description= "Set the uv paint tool";
+	ot->idname= "BRUSH_OT_uv_tool_set";
+
+	/* api callbacks */
+	ot->exec = brush_uv_tool_set_exec;
+	ot->poll = uv_paint_poll;
+
+	/* flags */
+	ot->flag= 0;
+
+	/* props */
+	ot->prop= RNA_def_enum(ot->srna, "tool", uv_paint_tool_items, 0, "Tool", "");
+}
+
 /**************************** registration **********************************/
 
 void ED_operatortypes_paint(void)
@@ -376,6 +410,7 @@
 	WM_operatortype_append(BRUSH_OT_vertex_tool_set);
 	WM_operatortype_append(BRUSH_OT_weight_tool_set);
 	WM_operatortype_append(BRUSH_OT_image_tool_set);
+	WM_operatortype_append(BRUSH_OT_uv_tool_set);
 
 	/* image */
 	WM_operatortype_append(PAINT_OT_texture_paint_toggle);
@@ -719,6 +754,10 @@
 	ed_keymap_paint_brush_size(keymap, "tool_settings.uv_paint.brush.size");
 	ed_keymap_paint_brush_radial_control(keymap, "uv_paint", RC_ZOOM, 0);
 
+	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_tool_set", GKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_PAINT_TOOL_GRAB);
+	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_PAINT_TOOL_RELAX);
+	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_tool_set", PKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_PAINT_TOOL_PINCH);
+
 	/* paint stroke */
 	{
 		wmKeyMap* keymap= paint_stroke_modal_keymap(keyconf);

Modified: branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h	2011-08-17 21:10:25 UTC (rev 39510)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h	2011-08-17 21:56:18 UTC (rev 39511)
@@ -1,5 +1,5 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *




More information about the Bf-blender-cvs mailing list