Page MenuHome

Multiple warnings accessing brush data. current value '0' matches no enum in 'Brush'
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows 10
Graphics card: Radeon RX 580

Blender Version
Broken: 2.79, 2.91.0
Worked: I don't have any older versions than 2.79 installed.

Short description of error

Most of the brushes show a warning if you attempt to access either their direction or gpencil_weight_tool attributes.

'WARN (bpy.rna): C:\b\buildbot-worker-windows\windows_lts_283\blender.git\source\blender\python\intern\bpy_rna.c:1479 pyrna_enum_to_py: current value '0' matches no enum in 'Brush', 'Add', 'direction''

I've attached a text file containing all the warnings I've been able to pinpoint in brushes.

Exact steps for others to reproduce the error
Open scripting window and type:

D.brushes['Add'].direction

Event Timeline

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.EditedDec 1 2020, 2:05 PM
Germano Cavalcante (mano-wii) triaged this task as Low priority.
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

Thanks for the report, I can confirm.

I don't know if an empty enum list should be allowed on the RNA.
But if not, this would solve the problem:

diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 736edc61d74..b85c39c51ca 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -787,6 +787,7 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
   ePaintMode mode = BKE_paintmode_get_active_from_context(C);
 
   static const EnumPropertyItem prop_default_items[] = {
+      {0, "NONE", 0, NULL, NULL},
       {0, NULL, 0, NULL, NULL},
   };

We already have generic DummyRNA_DEFAULT_items...