Page MenuHome

Greasepencil issue when deleting brush from active tool (incl crash drawing then)
Confirmed, NormalPublicBUG

Description

System Information
Operating system: windows 10
Graphics card: AMD Radeon RX 5700

Blender Version
Broken: v 2.81a
Worked: with grease pencil

Short description of error
I can't draw anymore, whenever I draw a line the program crash. I appent a set of brushes from here https://cloud.blender.org/p/gallery/5ccfe64353b85e279cf72acd, now even if I delete the brushes and materials it keeps crashing.

Exact steps for others to reproduce the error

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Wed, Feb 5, 10:30 AM
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

I can confirm in this particular file.

This issue seems to be caused by missing brushes [as you already said, you have deleted them -- I assume by going to the Outliner > Blender File view > Brushes, then choose Delete in the context menu?]
Just a couple of observations:

  • when you do this to a brush that is currently used, GPencil will run into errors like this (due to missing gp_settings)
File "/bin/2.82/scripts/startup/bl_ui/space_view3d.py", line 404, in draw_color_selector
ma = gp_settings.material
AttributeError: 'NoneType' object has no attribute 'material'
File "/bin/2.82/scripts/startup/bl_ui/properties_paint_common.py", line 1004, in brush_basic_gpencil_paint_settings
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
TypeError: UILayout.prop(): error with argument 1, "data" -  Function.data does not support a 'None' assignment AnyType type
  • if you delete a currently used brush in sculpt mode for example, this is handled more gracefully... (in that you correctly cannot make a stroke then, you first have to select an existing brush again to continue...)

Cannot reproduce the crash from scratch, but in that file, it also happens due to being able to start painting without a valid brush -- missing gp_settings...

1  gp_get_default_eraser                     gpencil_paint.c   1972 0x39bb9a5 
2  gp_init_drawing_brush                     gpencil_paint.c   2040 0x39bbc6c 
3  gp_session_initdata                       gpencil_paint.c   2198 0x39bc192 
4  gp_session_initpaint                      gpencil_paint.c   2241 0x39bc2ad 
5  gpencil_draw_init                         gpencil_paint.c   2638 0x39bcf49 
6  gpencil_draw_invoke                       gpencil_paint.c   3428 0x39bf193 
7  wm_operator_invoke                        wm_event_system.c 1465 0x320c8ac 
8  wm_handler_operator_call                  wm_event_system.c 2339 0x320e90a 
9  wm_handlers_do_keymap_with_keymap_handler wm_event_system.c 2652 0x320f643 
10 wm_handlers_do_intern                     wm_event_system.c 2789 0x320fc5f 
11 wm_handlers_do                            wm_event_system.c 3051 0x3210a03 
12 wm_event_do_handlers                      wm_event_system.c 3504 0x3211ef6 
13 WM_main                                   wm.c              418  0x320593b 
14 main                                      creator.c         518  0x2f3a166

@Antonio Vazquez (antoniov): I guess there is just some refresh missing when deleting the corresponding brush datablock from the active tool?

Philipp Oeser (lichtwerk) renamed this task from Crashing when draw to Greasepencil issue when deleting brush from active tool (incl crash drawing then).Wed, Feb 5, 10:48 AM
Philipp Oeser (lichtwerk) reopened this task as Confirmed.Wed, Feb 5, 11:34 AM

@Antonio Vazquez (antoniov) : crash is I think there is still something wrong:

  • File > New > 2D Animation
  • Outliner > Blender File > Brushes > delete Pencil
  • you are left with no brush selector in the Tool Settings
  • you can get it back [e.g. by going to Erase tool, then back to Draw tool], BUT
  • template_ID_preview is garbled, seems like brush is not completely unasociated from tool? (you should be presented with a blank selector like in mesh sculpt mode)
  • you are still getting an error then:
File "/bin/2.83/scripts/startup/bl_ui/space_view3d.py", line 404, in draw_color_selector
ma = gp_settings.material
AttributeError: 'NoneType' object has no attribute 'material'

mind checking again?