diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index b1711817ead..f8ed20430e7 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -235,19 +235,20 @@ static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, c static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode) { - if(!brush_orig || brush_tool(brush_orig, tool_offset) != tool) { + if (!brush_orig || brush_tool(brush_orig, tool_offset) != tool) { Brush *br; /* if the current brush is not using the desired tool, look for one that is */ - br= brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode); + br = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode); /* store the previously-selected brush */ - if(br) - br->toggle_brush= brush_orig; + if (br) + br->toggle_brush = brush_orig; return br; } - else if(brush_orig->toggle_brush && - BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1) { + else if (brush_orig->toggle_brush && + BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1) + { /* if current brush is using the desired tool, try to toggle back to the previously selected brush (if it was set, and if it still exists) */ @@ -258,22 +259,22 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, } static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, - const size_t tool_offset, const int ob_mode, - const char *tool_name, int create_missing, - int toggle) + const size_t tool_offset, const int ob_mode, + const char *tool_name, int create_missing, + int toggle) { struct Brush *brush, *brush_orig = paint_brush(paint); - if(toggle) + if (toggle) brush = brush_tool_toggle(bmain, brush_orig, tool, tool_offset, ob_mode); else brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode); - if(!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) { + if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) { brush = BKE_brush_add(tool_name); brush_tool_set(brush, tool_offset, tool); - brush->ob_mode= ob_mode; - brush->toggle_brush= brush_orig; + brush->ob_mode = ob_mode; + brush->toggle_brush = brush_orig; } if (brush) { @@ -315,30 +316,30 @@ static int brush_select_exec(bContext *C, wmOperator *op) } } - switch(paint_mode) { + switch (paint_mode) { case OB_MODE_SCULPT: - paint= &toolsettings->sculpt->paint; - tool_offset= offsetof(Brush, sculpt_tool); - tool= RNA_enum_get(op->ptr, "sculpt_tool"); + paint = &toolsettings->sculpt->paint; + tool_offset = offsetof(Brush, sculpt_tool); + tool = RNA_enum_get(op->ptr, "sculpt_tool"); RNA_enum_name_from_value(brush_sculpt_tool_items, tool, &tool_name); break; case OB_MODE_VERTEX_PAINT: - paint= &toolsettings->vpaint->paint; - tool_offset= offsetof(Brush, vertexpaint_tool); - tool= RNA_enum_get(op->ptr, "vertex_paint_tool"); + paint = &toolsettings->vpaint->paint; + tool_offset = offsetof(Brush, vertexpaint_tool); + tool = RNA_enum_get(op->ptr, "vertex_paint_tool"); RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name); break; case OB_MODE_WEIGHT_PAINT: - paint= &toolsettings->wpaint->paint; + paint = &toolsettings->wpaint->paint; /* vertexpaint_tool is used for weight paint mode */ - tool_offset= offsetof(Brush, vertexpaint_tool); - tool= RNA_enum_get(op->ptr, "weight_paint_tool"); + tool_offset = offsetof(Brush, vertexpaint_tool); + tool = RNA_enum_get(op->ptr, "weight_paint_tool"); RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name); break; case OB_MODE_TEXTURE_PAINT: - paint= &toolsettings->imapaint.paint; - tool_offset= offsetof(Brush, imagepaint_tool); - tool= RNA_enum_get(op->ptr, "texture_paint_tool"); + paint = &toolsettings->imapaint.paint; + tool_offset = offsetof(Brush, imagepaint_tool); + tool = RNA_enum_get(op->ptr, "texture_paint_tool"); RNA_enum_name_from_value(brush_image_tool_items, tool, &tool_name); break; default: @@ -347,8 +348,8 @@ static int brush_select_exec(bContext *C, wmOperator *op) } return brush_generic_tool_set(bmain, paint, tool, tool_offset, - paint_mode, tool_name, create_missing, - toggle); + paint_mode, tool_name, create_missing, + toggle); } static void PAINT_OT_brush_select(wmOperatorType *ot) @@ -635,12 +636,12 @@ void ED_keymap_paint(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i); /* Clear mask */ - kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0); RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_FLOOD_VALUE); RNA_float_set(kmi->ptr, "value", 0); /* Invert mask */ - kmi= WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_INVERT); /* multires switch */ @@ -665,7 +666,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT); keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0); keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT); - kmi= keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0); + kmi = keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0); RNA_boolean_set(kmi->ptr, "toggle", 1); RNA_boolean_set(kmi->ptr, "create_missing", 1); |