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 07:31:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-05 07:31:25 +0300
commit8b31f6fb2169e7163767e382adbef13587305aca (patch)
tree23609feb5da08a39f8009eb4390f69e6205fc2b1 /source/blender/blenkernel/intern/brush.c
parent8fcc04edce53c5b3b01bf392e1667878ebcce0ef (diff)
Paint: add BKE_paint_ensure to initialize toolsettings
Each mode had its own logic for initializing paint structs, move to a single function. Also remove "BKE_brush_get_gpencil_paint", entering grease pencil mode is responsible for ensuring the data is created.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r--source/blender/blenkernel/intern/brush.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 94ff7f3f2e5..286ba5f7902 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -193,7 +193,7 @@ void BKE_brush_init_gpencil_settings(Brush *brush)
Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name)
{
Brush *brush;
- Paint *paint = BKE_brush_get_gpencil_paint(ts);
+ Paint *paint = &ts->gp_paint->paint;
brush = BKE_brush_add(bmain, name, OB_MODE_GPENCIL_PAINT);
BKE_paint_brush_set(paint, brush);
@@ -208,16 +208,6 @@ Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name)
return brush;
}
-Paint *BKE_brush_get_gpencil_paint(ToolSettings *ts)
-{
- /* alloc paint session */
- if (ts->gp_paint == NULL) {
- ts->gp_paint = MEM_callocN(sizeof(GpPaint), "GpPaint");
- }
-
- return &ts->gp_paint->paint;
-}
-
/* grease pencil cumapping->preset */
typedef enum eGPCurveMappingPreset {
GPCURVE_PRESET_PENCIL = 0,
@@ -273,7 +263,7 @@ void BKE_brush_gpencil_presets(bContext *C)
#define SMOOTH_STROKE_FACTOR 0.9f
ToolSettings *ts = CTX_data_tool_settings(C);
- Paint *paint = BKE_brush_get_gpencil_paint(ts);
+ Paint *paint = &ts->gp_paint->paint;
Main *bmain = CTX_data_main(C);
Brush *brush, *deft;