Minor optimization for paint systems, initialize the paint curve before
the stroke and skip checking for initialization each time we request the curve value.
This commit is contained in:
@@ -951,7 +951,6 @@ float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len)
|
||||
if (p >= len) return 0;
|
||||
else p = p / len;
|
||||
|
||||
curvemapping_initialize(br->curve);
|
||||
strength = curvemapping_evaluateF(br->curve, 0, p);
|
||||
|
||||
CLAMP(strength, 0.0f, 1.0f);
|
||||
@@ -967,7 +966,6 @@ float BKE_brush_curve_strength(Brush *br, float p, const float len)
|
||||
else
|
||||
p = p / len;
|
||||
|
||||
curvemapping_initialize(br->curve);
|
||||
return curvemapping_evaluateF(br->curve, 0, p);
|
||||
}
|
||||
|
||||
|
||||
@@ -4279,9 +4279,6 @@ void *paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], int m
|
||||
return ps;
|
||||
}
|
||||
|
||||
/* needed so multiple threads don't try to initialize the brush at once (can leak memory) */
|
||||
curvemapping_initialize(ps->brush->curve);
|
||||
|
||||
paint_brush_init_tex(ps->brush);
|
||||
|
||||
ps->source = PROJ_SRC_VIEW;
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_colortools.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
@@ -477,6 +478,9 @@ PaintStroke *paint_stroke_new(bContext *C,
|
||||
stroke->redraw = redraw;
|
||||
stroke->done = done;
|
||||
stroke->event_type = event_type; /* for modal, return event */
|
||||
|
||||
/* initialize here to avoid initialization conflict with threaded strokes */
|
||||
curvemapping_initialize(br->curve);
|
||||
|
||||
BKE_paint_set_overlay_override(br->overlay_flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user