[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58812] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: User request: when switching to smooth tool with shift-click in

Antony Riakiotakis kalast at gmail.com
Fri Aug 2 01:07:54 CEST 2013


Revision: 58812
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58812
Author:   psy-fi
Date:     2013-08-01 23:07:53 +0000 (Thu, 01 Aug 2013)
Log Message:
-----------
User request: when switching to smooth tool with shift-click in
sculpting, use the original brush size.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-08-01 22:18:01 UTC (rev 58811)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-08-01 23:07:53 UTC (rev 58812)
@@ -306,6 +306,7 @@
 
 	char saved_active_brush_name[MAX_ID_NAME];
 	char saved_mask_brush_tool;
+	int saved_smooth_size; /* smooth tool copies the size of the current tool */
 	int alt_smooth;
 
 	float plane_trim_squared;
@@ -3710,6 +3711,7 @@
 static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, const float mouse[2])
 {
 	StrokeCache *cache = MEM_callocN(sizeof(StrokeCache), "stroke cache");
+	Scene *scene = CTX_data_scene(C);
 	UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
 	Brush *brush = BKE_paint_brush(&sd->paint);
 	ViewContext *vc = paint_stroke_view_context(op->customdata);
@@ -3755,6 +3757,7 @@
 		else {
 			Paint *p = &sd->paint;
 			Brush *br;
+			int size = BKE_brush_size_get(scene, brush);
 		
 			BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2,
 			            sizeof(cache->saved_active_brush_name));
@@ -3763,6 +3766,8 @@
 			if (br) {
 				BKE_paint_brush_set(p, br);
 				brush = br;
+				cache->saved_smooth_size = BKE_brush_size_get(scene, brush);
+				BKE_brush_size_set(scene, brush, size);
 			}
 		}
 	}
@@ -4352,6 +4357,7 @@
 {
 	UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
 	Object *ob = CTX_data_active_object(C);
+	Scene *scene = CTX_data_scene(C);
 	SculptSession *ss = ob->sculpt;
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 
@@ -4375,6 +4381,7 @@
 			}
 			else {
 				Paint *p = &sd->paint;
+				BKE_brush_size_set(scene, ss->cache->brush, ss->cache->saved_smooth_size);
 				brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name);
 				if (brush) {
 					BKE_paint_brush_set(p, brush);




More information about the Bf-blender-cvs mailing list