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:
authorCampbell Barton <ideasman42@gmail.com>2018-11-03 07:44:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-03 07:55:45 +0300
commit13c3c9b22fd8453d4418577efbc2ccb93209e92e (patch)
treecb332a7ed0e9022db2d189cd11bd983e33248468 /source/blender/blenkernel/intern/paint_toolslots.c
parenta18927463c18eec24c74ce8c0b3c261ff5ace889 (diff)
Cleanup: move brush query into utility function
Diffstat (limited to 'source/blender/blenkernel/intern/paint_toolslots.c')
-rw-r--r--source/blender/blenkernel/intern/paint_toolslots.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/paint_toolslots.c b/source/blender/blenkernel/intern/paint_toolslots.c
index bdafe217276..19c461d1777 100644
--- a/source/blender/blenkernel/intern/paint_toolslots.c
+++ b/source/blender/blenkernel/intern/paint_toolslots.c
@@ -93,23 +93,10 @@ void BKE_paint_toolslots_init_from_main(struct Main *bmain)
void BKE_paint_toolslots_brush_update_ex(Scene *scene, Paint *paint, Brush *brush)
{
- ToolSettings *ts = scene->toolsettings;
- int slot_index;
- if (paint == &ts->imapaint.paint) {
- slot_index = brush->imagepaint_tool;
- }
- else if (paint == &ts->sculpt->paint) {
- slot_index = brush->sculpt_tool;
- }
- else if (paint == &ts->vpaint->paint) {
- slot_index = brush->vertexpaint_tool;
- }
- else if (paint == &ts->wpaint->paint) {
- slot_index = brush->vertexpaint_tool;
- }
- else if (paint == &ts->gp_paint->paint) {
- slot_index = brush->gpencil_tool;
- }
+ uint tool_offset = 0;
+ bool ok = BKE_paint_brush_tool_info(scene, paint, &tool_offset, NULL);
+ BLI_assert(ok);
+ int slot_index = *(char *)POINTER_OFFSET(brush, tool_offset);
BKE_paint_toolslots_len_ensure(paint, slot_index + 1);
PaintToolSlot *tslot = &paint->tool_slots[slot_index];
id_us_plus(&brush->id);