[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56815] trunk/blender/source/blender/ editors/sculpt_paint/paint_ops.c: Fix #35364: sculpting - D shortcut inconsistency

Sergey Sharybin sergey.vfx at gmail.com
Wed May 15 13:11:00 CEST 2013


Revision: 56815
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56815
Author:   nazgul
Date:     2013-05-15 11:10:59 +0000 (Wed, 15 May 2013)
Log Message:
-----------
Fix #35364: sculpting - D shortcut inconsistency

Switching to tool will cycle via all brushes with given type
only in case current brush tool matches requested one.

This means, when user requests brush with different type,
first brush of that tool will be activated. But further
toggling to the same tool will cycle via all acceptable
brushes.

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

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-05-15 09:57:17 UTC (rev 56814)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-05-15 11:10:59 UTC (rev 56815)
@@ -248,14 +248,30 @@
 /* generic functions for setting the active brush based on the tool */
 static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode)
 {
-	Brush *brush;
+	Brush *brush, *first_brush;
 
 	if (!brush_orig && !(brush_orig = bmain->brush.first)) {
 		return NULL;
 	}
 
+	if (brush_tool(brush_orig, tool_offset) != tool) {
+		/* If current brush's tool is different from what we need,
+		 * start cycling from the beginning of the list.
+		 * Such logic will activate the same exact brush not relating from
+		 * which tool user requests other tool.
+		 */
+		first_brush = bmain->brush.first;
+	}
+	else {
+		/* If user wants to switch to brush with the same  tool as
+		 * currently active brush do a cycling via all possible
+		 * brushes with requested tool.
+		 */
+		first_brush = brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
+	}
+
 	/* get the next brush with the active tool */
-	for (brush = brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
+	for (brush = first_brush;
 	     brush != brush_orig;
 	     brush = brush->id.next ? brush->id.next : bmain->brush.first)
 	{




More information about the Bf-blender-cvs mailing list