diff options
author | Ivan Perevala <ivpe> | 2020-10-27 09:35:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-27 09:38:29 +0300 |
commit | eebe274312864fdab98ba189494a88ce4dc31632 (patch) | |
tree | c4b92ae501b38802dac67e07e8dd82847c47f5cf /source/blender/makesrna | |
parent | 4d15f4ac5b81d8b6e970731ea9f5106700dd3fe9 (diff) |
RNA: remove duplicate of Brush.tex_paint_map_mode
Use Brush.map_mode instead.
Ref D9290
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 6f227ec210c..736edc61d74 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -79,6 +79,27 @@ static const EnumPropertyItem sculpt_stroke_method_items[] = { {0, NULL, 0, NULL, NULL}, }; +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}, +}; + +#ifdef RNA_RUNTIME +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}, +}; +#endif + /* clang-format off */ const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""}, @@ -1015,6 +1036,28 @@ static void rna_GPencilBrush_pin_mode_update(bContext *C, PointerRNA *ptr) } } +static const EnumPropertyItem *rna_BrushTextureSlot_map_mode_itemf(bContext *C, + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) +{ + + if (C == NULL) { + return rna_enum_brush_texture_slot_map_all_mode_items; + } + +# define rna_enum_brush_texture_slot_map_sculpt_mode_items \ + rna_enum_brush_texture_slot_map_all_mode_items; + + const ePaintMode mode = BKE_paintmode_get_active_from_context(C); + if (mode == PAINT_MODE_SCULPT) { + return rna_enum_brush_texture_slot_map_sculpt_mode_items; + } + return rna_enum_brush_texture_slot_map_texture_mode_items; + +# undef rna_enum_brush_texture_slot_map_sculpt_mode_items +} + #else static void rna_def_brush_texture_slot(BlenderRNA *brna) @@ -1022,25 +1065,6 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem prop_map_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}, - }; - - static const EnumPropertyItem prop_tex_paint_map_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}, - }; - static const EnumPropertyItem prop_mask_paint_map_mode_items[] = { {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, @@ -1069,14 +1093,8 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); - RNA_def_property_enum_items(prop, prop_map_mode_items); - RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); - - prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); - RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items); + RNA_def_property_enum_items(prop, rna_enum_brush_texture_slot_map_all_mode_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_BrushTextureSlot_map_mode_itemf"); RNA_def_property_ui_text(prop, "Mode", ""); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); |