Page MenuHome

Proposed Fix for T98904. Grease Pencil brushes - it breaks after you delete a brush in sculpt mode
ClosedPublic

Authored by Antonio Vazquez (antoniov) on Jun 16 2022, 10:58 AM.

Details

Summary

Now the brushes are created and assigned the right type depending of the actual tool.

The fix is not only for Sculpt but for all modes (Draw, Sculpt, Vertex Paint and Weight Paint).

Diff Detail

Repository
rB Blender

Event Timeline

Antonio Vazquez (antoniov) requested review of this revision.Jun 16 2022, 10:58 AM
Antonio Vazquez (antoniov) created this revision.
Antonio Vazquez (antoniov) retitled this revision from Fix for T98904 to Proposed Fix for T98904. Grease Pencil brushes - it breaks after you delete a brush in sculpt mode.
Antonio Vazquez (antoniov) edited the summary of this revision. (Show Details)

Although it fix the problem (I can re-create the brush). I still get a lot of warnings in the console until I re-create a new brush:

Traceback (most recent call last):
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d_toolbar.py", line 1928, in draw
    brush_basic_gpencil_sculpt_settings(layout, context, brush)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/properties_paint_common.py", line 1319, in brush_basic_gpencil_sculpt_settings
    gp_settings = brush.gpencil_settings
AttributeError: 'NoneType' object has no attribute 'gpencil_settings'
Traceback (most recent call last):
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 31, in draw
    self.draw_tool_settings(context)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 57, in draw_tool_settings
    is_valid_context = draw_fn(context, layout, tool)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 398, in SCULPT_GPENCIL
    brush_basic_gpencil_sculpt_settings(layout, context, brush, compact=True)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/properties_paint_common.py", line 1319, in brush_basic_gpencil_sculpt_settings
    gp_settings = brush.gpencil_settings
AttributeError: 'NoneType' object has no attribute 'gpencil_settings'
  • Fix console warnings

@dflelinto Try now... I had created the patch with a wrong python script version.

Antonio, can you test it by launching Blender from a terminal and looking at the warnings? Because I'm still getting them here:

Traceback (most recent call last):
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 31, in draw
    self.draw_tool_settings(context)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 109, in draw_tool_settings
    tool = brush.gpencil_sculpt_tool
AttributeError: 'NoneType' object has no attribute 'gpencil_sculpt_tool'
Traceback (most recent call last):
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 31, in draw
    self.draw_tool_settings(context)
  File "/home/dfelinto/src/blender/build_linux_lite/bin/3.3/scripts/startup/bl_ui/space_view3d.py", line 109, in draw_tool_settings
    tool = brush.gpencil_sculpt_tool
AttributeError: 'NoneType' object has no attribute 'gpencil_sculpt_tool'
  • Fix more console warnings

No warnings left :)

This revision is now accepted and ready to land.Jun 16 2022, 4:20 PM