Fix T59396 Grease pencil brush crash
authorAntonioya <blendergit@gmail.com>
Sat, 15 Dec 2018 08:54:31 +0000 (09:54 +0100)
committerAntonioya <blendergit@gmail.com>
Sat, 15 Dec 2018 08:54:31 +0000 (09:54 +0100)
The problem was the brush was not initializated because some code was missing (marked as ToDo)

release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/editors/sculpt_paint/paint_ops.c

index 68d334dfaea341662d8296b6cdc2f003e0a61f82..eeb00fe09f8b083c09b8dfdd32f72d372c9093ea 100644 (file)
@@ -1485,12 +1485,13 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
 
         col = row.column()
         brush = context.active_gpencil_brush
-        gp_settings = brush.gpencil_settings
 
         sub = col.column(align=True)
         sub.operator("gpencil.brush_presets_create", icon='HELP', text="")
 
         if brush is not None:
+            gp_settings = brush.gpencil_settings
+
             # XXX: Items in "sub" currently show up beside the brush selector in a separate column
             if brush.gpencil_tool == 'ERASE':
                 sub.prop(gp_settings, "use_default_eraser", text="")
index ed40a22bd78e763cb1a525e794ea328d2b29661e..80911cf202fefbbdb6a395270da0862d65ab2b24 100644 (file)
@@ -124,7 +124,8 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_paint_brush_set(paint, br);
 
-       /* TODO init grease pencil specific data */
+       /* init grease pencil specific data */
+       BKE_brush_init_gpencil_settings(br);
 
        return OPERATOR_FINISHED;
 }