From 4d50e00914db82b99c7366de8b9136f2abe36e1b Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Mon, 10 Mar 2025 16:28:50 +0100 Subject: [PATCH] Fix #135328: Grease Pencil: Unable to set default eraser Incorrectly changed in 9e8c037375. The Grease Pencil `eraser_brush` property is still accessed and set directly from Python, we cannot remove setting access to the property in favor of the `AssetWeakReference` without first making other changes. For now, this patch re-adds the RNA definitions for the property to make it editable again. Pull Request: https://projects.blender.org/blender/blender/pulls/135743 --- .../blender/makesrna/intern/rna_sculpt_paint.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.cc b/source/blender/makesrna/intern/rna_sculpt_paint.cc index 9694ed03a6d..1505eb56f4b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.cc +++ b/source/blender/makesrna/intern/rna_sculpt_paint.cc @@ -289,6 +289,14 @@ static PointerRNA rna_Paint_eraser_brush_get(PointerRNA *ptr) return RNA_id_pointer_create(&brush->id); } +static void rna_Paint_eraser_brush_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/) +{ + Paint *paint = static_cast(ptr->data); + Brush *brush = static_cast(value.data); + BKE_paint_eraser_brush_set(paint, brush); + BKE_paint_invalidate_overlay_all(); +} + static bool rna_Paint_eraser_brush_poll(PointerRNA *ptr, PointerRNA value) { const Paint *paint = static_cast(ptr->data); @@ -542,10 +550,13 @@ static void rna_def_paint(BlenderRNA *brna) "the last used brush on file load"); prop = RNA_def_property(srna, "eraser_brush", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_pointer_funcs( - prop, "rna_Paint_eraser_brush_get", nullptr, nullptr, "rna_Paint_eraser_brush_poll"); + RNA_def_property_pointer_funcs(prop, + "rna_Paint_eraser_brush_get", + "rna_Paint_eraser_brush_set", + nullptr, + "rna_Paint_eraser_brush_poll"); RNA_def_property_ui_text(prop, "Default Eraser Brush", "Default eraser brush for quickly alternating with the main brush");