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

Antony Riakiotakis kalast at gmail.com
Thu Aug 4 19:15:11 CEST 2011


Revision: 39031
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39031
Author:   psy-fi
Date:     2011-08-04 17:15:10 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
smooth brush
============
-Added uv smooth brush own rna stuff in ToolSettings

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c
    branches/soc-2011-onion/source/blender/blenkernel/intern/scene.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_sculpt_paint.c

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c	2011-08-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -92,8 +92,8 @@
 		id_us_min((ID *)p->brush);
 		id_us_plus((ID *)br);
 		p->brush= br;
+	}
 }
-}
 
 int paint_facesel_test(Object *ob)
 {

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/scene.c	2011-08-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/scene.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -304,6 +304,10 @@
 			free_paint(&sce->toolsettings->sculpt->paint);
 			MEM_freeN(sce->toolsettings->sculpt);
 		}
+		if(sce->toolsettings->uvsmooth) {
+			free_paint(&sce->toolsettings->uvsmooth->paint);
+			MEM_freeN(sce->toolsettings->uvsmooth);
+		}
 		free_paint(&sce->toolsettings->imapaint.paint);
 
 		MEM_freeN(sce->toolsettings);

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-08-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -4505,6 +4505,16 @@
 	return paint_brush(&settings->imapaint.paint);
 }
 
+static Brush *uv_smooth_brush(const bContext *C)
+{
+	Scene *scene= CTX_data_scene(C);
+	ToolSettings *settings= scene->toolsettings;
+
+	if(!settings->uvsmooth)
+		return NULL;
+	return paint_brush(&settings->uvsmooth->paint);
+}
+
 static int image_paint_poll(const bContext *C)
 {
 	Object *obact = CTX_data_active_object(C);
@@ -4534,7 +4544,7 @@
 //	Object *obact = CTX_data_active_object(C);
 	SpaceImage *sima= CTX_wm_space_image(C);
 
-	if(!image_paint_brush(C))
+	if(!uv_smooth_brush(C))
 		return 0;
 
 	if(sima) {
@@ -5082,9 +5092,12 @@
 
 void ED_space_image_uv_smooth_update(wmWindowManager *wm, ToolSettings *settings)
 {
+	if(!settings->uvsmooth){
+		settings->uvsmooth = MEM_callocN(sizeof(*settings->uvsmooth), "UV Smooth paint");
+	}
 	paint_mode_init(
 		wm,
-		&(settings->imapaint.paint),
+		&(settings->uvsmooth->paint),
 		OB_MODE_TEXTURE_PAINT,
 		uv_smooth_brush_poll,
 		brush_drawcursor,

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 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -712,8 +712,8 @@
 
 	WM_keymap_add_item(keymap, "PAINT_OT_uv_smooth_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
 
-	ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
-	ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR|RC_ZOOM, 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);
 
 	/* paint stroke */
 	{

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-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h	2011-08-04 17:15:10 UTC (rev 39031)
@@ -570,6 +570,11 @@
 	Paint paint;
 } Sculpt;
 
+typedef struct UvSmooth {
+	Paint paint;
+} UvSmooth;
+
+
 typedef struct VPaint {
 	Paint paint;
 
@@ -592,6 +597,7 @@
 	VPaint *vpaint;		/* vertex paint */
 	VPaint *wpaint;		/* weight paint */
 	Sculpt *sculpt;
+	UvSmooth *uvsmooth;	/* uv smooth */
 	
 	/* Vertex groups */
 	float vgroup_weight;

Modified: branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c	2011-08-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -1103,6 +1103,10 @@
 	RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
 	RNA_def_property_ui_text(prop, "Image Paint", "");
 
+	prop= RNA_def_property(srna, "uv_smooth", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "uvsmooth");
+	RNA_def_property_ui_text(prop, "UV Smooth", "");
+
 	prop= RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "particle");
 	RNA_def_property_ui_text(prop, "Particle Edit", "");

Modified: branches/soc-2011-onion/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- branches/soc-2011-onion/source/blender/makesrna/intern/rna_sculpt_paint.c	2011-08-04 16:54:26 UTC (rev 39030)
+++ branches/soc-2011-onion/source/blender/makesrna/intern/rna_sculpt_paint.c	2011-08-04 17:15:10 UTC (rev 39031)
@@ -296,6 +296,15 @@
 	RNA_def_struct_ui_text(srna, "Sculpt", "");
 }
 
+static void rna_def_uv_smooth(BlenderRNA  *brna)
+{
+	StructRNA *srna;
+
+	srna= RNA_def_struct(brna, "UvSmooth", "Paint");
+	RNA_def_struct_ui_text(srna, "UV Smoothing", "");
+}
+
+
 static void rna_def_vertex_paint(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -545,6 +554,7 @@
 {
 	rna_def_paint(brna);
 	rna_def_sculpt(brna);
+	rna_def_uv_smooth(brna);
 	rna_def_vertex_paint(brna);
 	rna_def_image_paint(brna);
 	rna_def_particle_edit(brna);




More information about the Bf-blender-cvs mailing list