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-05 08:18:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-05 08:18:43 +0300
commit1b928c2d9a4b4b4a57046176912e0ae6d77f9a1d (patch)
treec19777cbf0b7108f7440a62eea228355488d29b9 /source/blender/makesrna/intern/rna_sculpt_paint.c
parent56917bcf731c6d3568d920a6ccbec524c25aaea1 (diff)
Paint: add tool offset & mode to runtime data
It was getting too impractical to call BKE_paint_brush_tool_info which needed to lookup the scene pointers. Now each store tool offset and brush mode in 'Paint.runtime'
Diffstat (limited to 'source/blender/makesrna/intern/rna_sculpt_paint.c')
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index d3ff9d94a23..a66f1cc01ce 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -272,22 +272,16 @@ static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr))
static bool rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
{
- Scene *scene = (Scene *)ptr->id.data;
const Paint *paint = ptr->data;
Brush *brush = value.id.data;
- eObjectMode ob_mode = 0;
- uint brush_tool_offset = 0;
-
- /* check the origin of the Paint struct to see which paint
- * mode to select from */
-
- bool ok = BKE_paint_brush_tool_info(scene, paint, &brush_tool_offset, &ob_mode);
- BLI_assert(ok);
+ const uint tool_offset = paint->runtime.tool_offset;
+ const eObjectMode ob_mode = paint->runtime.ob_mode;
+ BLI_assert(tool_offset && ob_mode);
if (brush->ob_mode & ob_mode) {
if (paint->brush) {
- const char *tool_a = (const char *)POINTER_OFFSET(paint->brush, brush_tool_offset);
- const char *tool_b = (const char *)POINTER_OFFSET(brush, brush_tool_offset);
+ const char *tool_a = (const char *)POINTER_OFFSET(paint->brush, tool_offset);
+ const char *tool_b = (const char *)POINTER_OFFSET(brush, tool_offset);
if (*tool_a == *tool_b) {
return true;
}
@@ -443,11 +437,11 @@ static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr))
static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
Paint *paint = ptr->data;
Brush *br = paint->brush;
BKE_paint_invalidate_overlay_all();
- BKE_paint_toolslots_brush_update(scene, paint);
+ /* Needed because we're not calling 'BKE_paint_brush_set' which handles this. */
+ BKE_paint_toolslots_brush_update(paint);
WM_main_add_notifier(NC_BRUSH | NA_SELECTED, br);
}