[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39037] branches/soc-2011-onion/source/ blender/editors/sculpt_paint: smooth brush

Antony Riakiotakis kalast at gmail.com
Fri Aug 5 00:15:45 CEST 2011


Revision: 39037
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39037
Author:   psy-fi
Date:     2011-08-04 22:15:43 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
smooth brush
============
-moved operator to its own file. If I try plugging this into the new API, I'll have lots of stuff to understand and try, so I may try to do a custom operator just like texture paint works right now.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c

Added Paths:
-----------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt	2011-08-04 21:41:41 UTC (rev 39036)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt	2011-08-04 22:15:43 UTC (rev 39037)
@@ -53,6 +53,7 @@
 	paint_hide.c
 	paint_meshcache.c
 	paint_texcache.c
+	paint_uv.c
 	paint_brushlib.cpp
 	sculpt.c
 	sculpt_undo.c

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h	2011-08-04 21:41:41 UTC (rev 39036)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h	2011-08-04 22:15:43 UTC (rev 39037)
@@ -256,6 +256,7 @@
 
 /* uv smoothing */
 int uv_smooth_poll(struct bContext *C);
+void PAINT_OT_uv_smooth_stroke(struct wmOperatorType *ot);
 
 /* paint_utils.c */
 void projectf(struct bglMats *mats, const float v[3], float p[2]);

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-04 21:41:41 UTC (rev 39036)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-08-04 22:15:43 UTC (rev 39037)
@@ -359,30 +359,6 @@
 	ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, "Tool", "");
 }
 
-static int uv_smooth_stroke_exec(bContext *C, wmOperator *op)
-{
-	printf("little ducks\n");
-	return OPERATOR_FINISHED;
-}
-
-static void PAINT_OT_uv_smooth_stroke(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Smooth UVs";
-	ot->description= "Smooth UVs using a brush";
-	ot->idname= "PAINT_OT_uv_smooth_stroke";
-
-	/* api callbacks */
-	ot->exec= uv_smooth_stroke_exec;
-	ot->modal=paint_stroke_modal;
-	ot->poll= uv_smooth_poll;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER;//|OPTYPE_UNDO;
-
-	/* props */
-}
-
 /**************************** registration **********************************/
 
 void ED_operatortypes_paint(void)
@@ -713,7 +689,7 @@
 	WM_keymap_add_item(keymap, "PAINT_OT_uv_smooth_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
 
 	ed_keymap_paint_brush_size(keymap, "tool_settings.uv_smooth.brush.size");
-	ed_keymap_paint_brush_radial_control(keymap, "uv_smooth", RC_COLOR|RC_ZOOM, 0);
+	ed_keymap_paint_brush_radial_control(keymap, "uv_smooth", RC_ZOOM, 0);
 
 	/* paint stroke */
 	{

Added: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	                        (rev 0)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	2011-08-04 22:15:43 UTC (rev 39037)
@@ -0,0 +1,148 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software  Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Antony Riakiotakis
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * UV Brush tools (currently smoothing only)
+ *
+ */
+
+/** \file blender/editors/sculpt_paint/paint_uv.c
+ *  \ingroup edsculpt
+ */
+
+
+#include "paint_stroke.h"
+
+#include "MEM_guardedalloc.h"
+
+#include <stdlib.h>
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_brush_types.h"
+
+#include "BKE_brush.h"
+#include "BKE_context.h"
+#include "BKE_paint.h"
+#include "BKE_main.h"
+
+#include "ED_sculpt.h"
+#include "ED_screen.h"
+#include "UI_resources.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "paint_intern.h"
+#include "sculpt_intern.h"
+
+#include <string.h>
+//#include <stdio.h>
+#include <stddef.h>
+
+
+static int uv_smooth_stroke_test_start(const bContext *C, struct PaintStroke *stroke)
+{
+	/* Always succeed */
+	return 1;
+}
+
+static void uv_smooth_stroke_start(const bContext *C, struct PaintStroke *stroke)
+{
+
+}
+
+static void uv_smooth_stroke_update_step(const bContext *C, struct PaintStroke *stroke)
+{
+
+}
+
+static void uv_smooth_stroke_apply(const struct bContext *C, struct PaintStroke *stroke)
+{
+	printf("little ducks\n");
+}
+
+static void uv_smooth_stroke_done(const struct bContext *C, struct PaintStroke *stroke)
+{
+
+}
+
+static int uv_smooth_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	paint_stroke_new(
+		C,
+		op,
+		NULL,
+		NULL,
+		NULL,
+		NULL,
+		uv_smooth_stroke_test_start,
+		uv_smooth_stroke_start,
+		paint_cursor,
+		uv_smooth_stroke_update_step,
+		NULL,
+		paint_init_params,
+		paint_update_params,
+		NULL,
+		uv_smooth_stroke_apply,
+		uv_smooth_stroke_done,
+		event->type);
+
+	return paint_stroke_invoke(C, op, event);
+}
+
+static int uv_smooth_stroke_exec(bContext *C, wmOperator *op)
+{
+	printf("little ducks\n");
+	return OPERATOR_FINISHED;
+}
+
+void PAINT_OT_uv_smooth_stroke(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Smooth UVs";
+	ot->description = "Smooth UVs using a brush";
+	ot->idname = "PAINT_OT_uv_smooth_stroke";
+
+	/* api callbacks */
+	ot->invoke = uv_smooth_stroke_invoke;
+	ot->exec = uv_smooth_stroke_exec;
+	ot->modal = paint_stroke_modal;
+	ot->poll = uv_smooth_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	paint_stroke_def_properties(ot, 0, 0, 0, NULL);
+	/* props */
+}


Property changes on: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
___________________________________________________________________
Added: svn:eol-style
   + native




More information about the Bf-blender-cvs mailing list