Fix T73580: Gpencil crash when try to draw without eraser brush available

This commit is contained in:
Antonio Vazquez 2020-02-05 11:08:15 +01:00
parent 93a46f7d08
commit db0121a009
Notes: blender-bot 2023-02-13 23:34:12 +01:00
Referenced by issue #73580, Greasepencil issue when deleting brush from active tool (incl crash drawing then)
2 changed files with 5 additions and 0 deletions

View File

@ -996,6 +996,8 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False):
gp_settings = brush.gpencil_settings
tool = context.workspace.tools.from_space_view3d_mode(context.mode, create=False)
if gp_settings is None:
return
# Brush details
if brush.gpencil_tool == 'ERASE':

View File

@ -1963,6 +1963,9 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
Paint *paint = &ts->gp_paint->paint;
Brush *brush_old = paint->brush;
for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->gpencil_settings == NULL) {
continue;
}
if ((brush->ob_mode == OB_MODE_PAINT_GPENCIL) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
/* save first eraser to use later if no default */
if (brush_dft == NULL) {