Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-05-15 15:10:59 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-05-15 15:10:59 +0400
commite1cb4aade83dbee536e75fb15d64905c918d045d (patch)
treedd0d842890dc1efe7bcbfd26db25c4c072c2caf0 /source/blender
parent417ca7b451d3de168342c78449b54d8474e86125 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index a838a9c26cb..a30566d5b3f 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -248,14 +248,30 @@ static void brush_tool_set(const Brush *brush, size_t tool_offset, int tool)
/* 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)
{