Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Perevala <ivpe>2020-10-27 09:35:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-27 09:38:29 +0300
commiteebe274312864fdab98ba189494a88ce4dc31632 (patch)
treec4b92ae501b38802dac67e07e8dd82847c47f5cf
parent4d15f4ac5b81d8b6e970731ea9f5106700dd3fe9 (diff)
RNA: remove duplicate of Brush.tex_paint_map_mode
Use Brush.map_mode instead. Ref D9290
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py5
-rw-r--r--source/blender/makesrna/intern/rna_brush.c72
2 files changed, 46 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 01454f8ee05..63ccbd2ae05 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1024,10 +1024,7 @@ def brush_texture_settings(layout, brush, sculpt):
layout.use_property_decorate = False
# map_mode
- if sculpt:
- layout.prop(tex_slot, "map_mode", text="Mapping")
- else:
- layout.prop(tex_slot, "tex_paint_map_mode", text="Mapping")
+ layout.prop(tex_slot, "map_mode", text="Mapping")
layout.separator()
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");