Page MenuHome

Entry `AREA_PLANE` is not a valid property for `map_mode` in class `bpy.types.BrushTextureSlot(TextureSlot)`
Needs Triage, NormalPublic

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.09

Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-26 21:30, hash: rB9b87d3f02962
Worked: Same happens at least as far as 2.91.0. Tested on 2.92.0 as well, same result.

Short description of error
Entry AREA_PLANE is not a valid property for map_mode in class bpy.types.BrushTextureSlot(TextureSlot)

Exact steps for others to reproduce the error

  • Create a new Blender file;
  • Go to the Scripting tab or open the Python console
  • Type the following: bpy.data.brushes[0].texture_slot.map_mode = 'AREA_PLANE'
  • Error is TypeError: bpy_struct: item.attr = val: enum "AREA_PLANE" not found in ('VIEW_PLANE', 'TILED', '3D', 'RANDOM', 'STENCIL'), even though the documentation states that map_mode should be enum in [‘VIEW_PLANE’, ‘AREA_PLANE’, ‘TILED’, ‘3D’, ‘RANDOM’, ‘STENCIL’], default ‘TILED’

Event Timeline

It seems as though the problem is that the EnumProperty map_mode uses rna_enum_brush_texture_slot_map_all_mode_items which is defined as:

static const EnumPropertyItem rna_enum_brush_texture_slot_map_all_mode_items[] = {
    {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
    {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""},
    {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
    {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
    {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
    {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
    {0, NULL, 0, NULL, NULL},
};

but if the active paintmode is not PAINT_MODE_SCULPT then it uses rna_enum_brush_texture_slot_map_texture_mode_items which is defined as:

static const EnumPropertyItem rna_enum_brush_texture_slot_map_texture_mode_items[] = {
    {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
    {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
    {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
    {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
    {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
    {0, NULL, 0, NULL, NULL},
};

(notice AREA_PLANE is not defined). So my take from this is that it is most likely not a bug, but not documented correctly (probably due to the documentation being mostly auto-generated).