diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index d119be66916..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"); @@ -2968,6 +2986,12 @@ static void rna_def_brush(BlenderRNA *brna) "Apply the maximum grab strength to the active vertex instead of the cursor location"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_grab_silhouette", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_GRAB_SILHOUETTE); + RNA_def_property_ui_text( + prop, "Grab Silhouette", "Grabs trying to automask the silhouette of the object"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_paint_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sampling_flag", BRUSH_PAINT_ANTIALIASING); RNA_def_property_ui_text(prop, "Anti-Aliasing", "Smooths the edges of the strokes"); |