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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r--source/blender/makesrna/intern/rna_brush.c456
1 files changed, 271 insertions, 185 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 6d5a06d4f81..83d40a3802b 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -31,77 +31,265 @@
#include "DNA_brush_types.h"
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
#include "BLI_math.h"
#include "IMB_imbuf.h"
+
#include "WM_types.h"
+static EnumPropertyItem prop_direction_items[]= {
+ {0, "ADD", 0, "Add", "Add effect of brush"},
+ {BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem brush_sculpt_tool_items[] = {
+ {SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
+ {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
+ {SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
+ {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
+ {SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
+ {SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
+ {SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
+ {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
+ {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
+ {SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
+ {SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
+ {SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
+ {SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
+ {SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
+ {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
+ {SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+
+EnumPropertyItem brush_vertexpaint_tool_items[] = {
+ {0, "MIX", ICON_BRUSH_MIX, "Mix", "Use mix blending mode while painting"},
+ {1, "ADD", ICON_BRUSH_ADD, "Add", "Use add blending mode while painting"},
+ {2, "SUB", ICON_BRUSH_SUBTRACT, "Subtract", "Use subtract blending mode while painting"},
+ {3, "MUL", ICON_BRUSH_MULTIPLY, "Multiply", "Use multiply blending mode while painting"},
+ {4, "BLUR", ICON_BRUSH_BLUR, "Blur", "Blur the color with surrounding values"},
+ {5, "LIGHTEN", ICON_BRUSH_LIGHTEN, "Lighten", "Use lighten blending mode while painting"},
+ {6, "DARKEN", ICON_BRUSH_DARKEN, "Darken", "Use darken blending mode while painting"},
+ {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem brush_imagepaint_tool_items[] = {
+ {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""},
+ {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""},
+ {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""},
+ {PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
#include "MEM_guardedalloc.h"
+#include "DNA_object_types.h"
+
+#include "RNA_access.h"
+
#include "BKE_texture.h"
+#include "BKE_brush.h"
+#include "BKE_icons.h"
+
+#include "BKE_paint.h"
#include "WM_api.h"
+static void rna_Brush_reset_icon(Brush *br, char *type)
+{
+ ID *id = &br->id;
+
+ if(br->flag & BRUSH_CUSTOM_ICON)
+ return;
+
+ if(id->icon_id >= BIFICONID_LAST) {
+ BKE_icon_delete(id);
+ BKE_previewimg_free_id(id);
+ }
+
+ id->icon_id = 0;
+}
+
static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Brush *br= (Brush*)ptr->data;
WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
+ //WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
+}
+
+static void rna_Brush_sculpt_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Brush *br= (Brush*)ptr->data;
+ rna_Brush_reset_icon(br, "sculpt");
+ rna_Brush_update(bmain, scene, ptr);
+}
+
+static void rna_Brush_vertexpaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Brush *br= (Brush*)ptr->data;
+ rna_Brush_reset_icon(br, "vertex_paint");
+ rna_Brush_update(bmain, scene, ptr);
+}
+
+static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Brush *br= (Brush*)ptr->data;
+ rna_Brush_reset_icon(br, "texture_paint");
+ rna_Brush_update(bmain, scene, ptr);
}
-static int rna_Brush_is_sculpt_brush(Brush *me, bContext *C)
+static void rna_Brush_icon_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- int i;
+ Brush *br= (Brush*)ptr->data;
- for (i= 0; i < sd->paint.brush_count; i++) {
- if (strcmp(me->id.name+2, sd->paint.brushes[i]->id.name+2) == 0)
- return 1;
+ if(br->icon_imbuf) {
+ IMB_freeImBuf(br->icon_imbuf);
+ br->icon_imbuf= NULL;
}
- return 0;
+ br->id.icon_id = 0;
+
+ if(br->flag & BRUSH_CUSTOM_ICON) {
+ BKE_previewimg_get(&br->id);
+ BKE_icon_changed(BKE_icon_getid(&br->id));
+ }
+
+ WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
}
-static int rna_Brush_is_vpaint_brush(Brush *me, bContext *C)
+static void rna_Brush_set_size(PointerRNA *ptr, int value)
{
- VPaint *vp = CTX_data_tool_settings(C)->vpaint;
- int i;
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_size(me, value);
+}
- for (i= 0; i < vp->paint.brush_count; i++) {
- if (strcmp(me->id.name+2, vp->paint.brushes[i]->id.name+2) == 0)
- return 1;
- }
+static int rna_Brush_get_size(PointerRNA *ptr)
+{
+ Brush* me = (Brush*)(ptr->data);
+ return brush_size(me);
+}
- return 0;
+static void rna_Brush_set_use_locked_size(PointerRNA *ptr, int value)
+{
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_use_locked_size(me, value);
}
-static int rna_Brush_is_wpaint_brush(Brush *me, bContext *C)
+static int rna_Brush_get_use_locked_size(PointerRNA *ptr)
{
- VPaint *vp = CTX_data_tool_settings(C)->wpaint;
- int i;
+ Brush* me = (Brush*)(ptr->data);
+ return brush_use_locked_size(me);
+}
- for (i= 0; i < vp->paint.brush_count; i++) {
- if (strcmp(me->id.name+2, vp->paint.brushes[i]->id.name+2) == 0)
- return 1;
- }
+static void rna_Brush_set_use_size_pressure(PointerRNA *ptr, int value)
+{
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_use_size_pressure(me, value);
+}
- return 0;
+static int rna_Brush_get_use_size_pressure(PointerRNA *ptr)
+{
+ Brush* me = (Brush*)(ptr->data);
+ return brush_use_size_pressure(me);
}
-static int rna_Brush_is_imapaint_brush(Brush *me, bContext *C)
+static void rna_Brush_set_use_alpha_pressure(PointerRNA *ptr, int value)
{
- ImagePaintSettings *data = &(CTX_data_tool_settings(C)->imapaint);
- int i;
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_use_alpha_pressure(me, value);
+}
- for (i= 0; i < data->paint.brush_count; i++) {
- if (strcmp(me->id.name+2, data->paint.brushes[i]->id.name+2) == 0)
- return 1;
- }
+static int rna_Brush_get_use_alpha_pressure(PointerRNA *ptr)
+{
+ Brush* me = (Brush*)(ptr->data);
+ return brush_use_alpha_pressure(me);
+}
+
+static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
+{
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_unprojected_radius(me, value);
+}
+
+static float rna_Brush_get_unprojected_radius(PointerRNA *ptr)
+{
+ Brush* me = (Brush*)(ptr->data);
+ return brush_unprojected_radius(me);
+}
- return 0;
+static void rna_Brush_set_alpha(PointerRNA *ptr, float value)
+{
+ Brush* me = (Brush*)(ptr->data);
+ brush_set_alpha(me, value);
+}
+
+static float rna_Brush_get_alpha(PointerRNA *ptr)
+{
+ Brush* me = (Brush*)(ptr->data);
+ return brush_alpha(me);
+}
+
+static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ static EnumPropertyItem prop_default_items[]= {
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_flatten_contrast_items[]= {
+ {0, "FLATTEN", 0, "Flatten", "Add effect of brush"},
+ {BRUSH_DIR_IN, "CONTRAST", 0, "Contrast", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_fill_deepen_items[]= {
+ {0, "FILL", 0, "Fill", "Add effect of brush"},
+ {BRUSH_DIR_IN, "DEEPEN", 0, "Deepen", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_scrape_peaks_items[]= {
+ {0, "SCRAPE", 0, "Scrape", "Add effect of brush"},
+ {BRUSH_DIR_IN, "PEAKS", 0, "Peaks", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_pinch_magnify_items[]= {
+ {0, "PINCH", 0, "Pinch", "Add effect of brush"},
+ {BRUSH_DIR_IN, "MAGNIFY", 0, "Magnify", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_inflate_deflate_items[]= {
+ {0, "INFLATE", 0, "Inflate", "Add effect of brush"},
+ {BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL}};
+
+ Brush *me= (Brush*)(ptr->data);
+
+ switch (me->sculpt_tool) {
+ case SCULPT_TOOL_DRAW:
+ case SCULPT_TOOL_CREASE:
+ case SCULPT_TOOL_BLOB:
+ case SCULPT_TOOL_LAYER:
+ case SCULPT_TOOL_CLAY:
+ return prop_direction_items;
+
+ case SCULPT_TOOL_FLATTEN:
+ return prop_flatten_contrast_items;
+
+ case SCULPT_TOOL_FILL:
+ return prop_fill_deepen_items;
+
+ case SCULPT_TOOL_SCRAPE:
+ return prop_scrape_peaks_items;
+
+ case SCULPT_TOOL_PINCH:
+ return prop_pinch_magnify_items;
+
+ case SCULPT_TOOL_INFLATE:
+ return prop_inflate_deflate_items;
+
+ default:
+ return prop_default_items;
+ }
}
#else
@@ -150,26 +338,6 @@ static void rna_def_brush(BlenderRNA *brna)
{IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem brush_sculpt_tool_items[] = {
- {SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
- {SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
- {SCULPT_TOOL_CREASE, "CREASE", 0, "Crease", ""},
- {SCULPT_TOOL_BLOB, "BLOB", 0, "Blob", ""},
- {SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""},
- {SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""},
- {SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""},
- {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", 0, "Snake Hook", ""},
- {SCULPT_TOOL_ROTATE, "ROTATE", 0, "Rotate", ""},
- {SCULPT_TOOL_THUMB, "THUMB", 0, "Thumb", ""},
- {SCULPT_TOOL_NUDGE, "NUDGE", 0, "Nudge", ""},
- {SCULPT_TOOL_LAYER, "LAYER", 0, "Layer", ""},
- {SCULPT_TOOL_FLATTEN, "FLATTEN", 0, "Flatten", ""},
- {SCULPT_TOOL_CLAY, "CLAY", 0, "Clay", ""},
- //{SCULPT_TOOL_CLAY_TUBES, "CLAY_TUBES", 0, "Clay Tubes", ""}, XXX: remove clay tubes from UI
- {SCULPT_TOOL_FILL, "FILL", 0, "Fill", ""},
- {SCULPT_TOOL_SCRAPE, "SCRAPE", 0, "Scrape", ""},
- {0, NULL, 0, NULL, NULL}};
-
static EnumPropertyItem brush_stroke_method_items[] = {
{0, "DOTS", 0, "Dots", ""},
{BRUSH_RESTORE_MESH, "DRAG_DOT", 0, "Drag Dot", ""},
@@ -189,53 +357,6 @@ static void rna_def_brush(BlenderRNA *brna)
{BRUSH_RAKE, "RAKE", 0, "Rake", ""},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem brush_vertexpaint_tool_items[] = {
- {0, "MIX", 0, "Mix", "Use mix blending mode while painting"},
- {1, "ADD", 0, "Add", "Use add blending mode while painting"},
- {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting"},
- {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting"},
- {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"},
- {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"},
- {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting"},
- {0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem brush_imagepaint_tool_items[] = {
- {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
- {PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", ""},
- {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", ""},
- {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_flip_direction_items[]= {
- {0, "ADD", 0, "Add", "Add effect of brush"},
- {BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_flatten_contrast_items[]= {
- {0, "FLATTEN", 0, "Flatten", "Add effect of brush"},
- {BRUSH_DIR_IN, "CONTRAST", 0, "Contrast", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_fill_deepen_items[]= {
- {0, "FILL", 0, "Fill", "Add effect of brush"},
- {BRUSH_DIR_IN, "DEEPEN", 0, "Deepen", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_scrape_peaks_items[]= {
- {0, "SCRAPE", 0, "Scrape", "Add effect of brush"},
- {BRUSH_DIR_IN, "PEAKS", 0, "Peaks", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_pinch_magnify_items[]= {
- {0, "PINCH", 0, "Pinch", "Add effect of brush"},
- {BRUSH_DIR_IN, "MAGNIFY", 0, "Magnify", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
- static const EnumPropertyItem prop_inflate_deflate_items[]= {
- {0, "INFLATE", 0, "Inflate", "Add effect of brush"},
- {BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
-
static EnumPropertyItem brush_sculpt_plane_items[] = {
{SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""},
{SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""},
@@ -244,42 +365,10 @@ static void rna_def_brush(BlenderRNA *brna)
{SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
{0, NULL, 0, NULL, NULL}};
- FunctionRNA *func;
- PropertyRNA *parm;
-
srna= RNA_def_struct(brna, "Brush", "ID");
RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting");
RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
- /* functions */
- func= RNA_def_function(srna, "is_sculpt_brush", "rna_Brush_is_sculpt_brush");
- RNA_def_function_ui_description(func, "Returns true if Brush can be used for sculpting");
- parm= RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_boolean(func, "ret", 0, "", "");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "is_vpaint_brush", "rna_Brush_is_vpaint_brush");
- RNA_def_function_ui_description(func, "Returns true if Brush can be used for vertex painting");
- parm= RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_boolean(func, "ret", 0, "", "");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "is_wpaint_brush", "rna_Brush_is_wpaint_brush");
- RNA_def_function_ui_description(func, "Returns true if Brush can be used for weight painting");
- parm= RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_boolean(func, "ret", 0, "", "");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "is_imapaint_brush", "rna_Brush_is_imapaint_brush");
- RNA_def_function_ui_description(func, "Returns true if Brush can be used for image painting");
- parm= RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_boolean(func, "ret", 0, "", "");
- RNA_def_function_return(func, parm);
-
/* enums */
prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_blend_items);
@@ -289,31 +378,32 @@ static void rna_def_brush(BlenderRNA *brna)
prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_sculpt_tool_items);
RNA_def_property_ui_text(prop, "Sculpt Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
+ RNA_def_property_update(prop, 0, "rna_Brush_sculpt_tool_update");
prop= RNA_def_property(srna, "vertexpaint_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_vertexpaint_tool_items);
RNA_def_property_ui_text(prop, "Vertex/Weight Paint Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
+ RNA_def_property_update(prop, 0, "rna_Brush_vertexpaint_tool_update");
prop= RNA_def_property(srna, "imagepaint_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_imagepaint_tool_items);
RNA_def_property_ui_text(prop, "Image Paint Tool", "");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_imagepaint_tool_update");
prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_flip_direction_items);
+ RNA_def_property_enum_items(prop, prop_direction_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_direction_itemf");
RNA_def_property_ui_text(prop, "Direction", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
-
+
prop= RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, brush_stroke_method_items);
RNA_def_property_ui_text(prop, "Stroke Method", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "texture_angle_source", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, texture_angle_source_items);
RNA_def_property_ui_text(prop, "Texture Angle Source", "");
@@ -325,36 +415,6 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Texture Angle Source", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "flatten_contrast", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_flatten_contrast_items);
- RNA_def_property_ui_text(prop, "Flatten/Contrast", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop= RNA_def_property(srna, "inflate_deflate", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_inflate_deflate_items);
- RNA_def_property_ui_text(prop, "Inflate/Deflate", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop= RNA_def_property(srna, "fill_deepen", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_fill_deepen_items);
- RNA_def_property_ui_text(prop, "Fill/Deepen", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop= RNA_def_property(srna, "scrape_peaks", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_scrape_peaks_items);
- RNA_def_property_ui_text(prop, "Scrape/Peaks", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop= RNA_def_property(srna, "pinch_magnify", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_pinch_magnify_items);
- RNA_def_property_ui_text(prop, "Pinch/Magnify", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
prop= RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
RNA_def_property_ui_text(prop, "Sculpt Plane", "");
@@ -362,15 +422,17 @@ static void rna_def_brush(BlenderRNA *brna)
/* number values */
prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ RNA_def_property_int_funcs(prop, "rna_Brush_get_size", "rna_Brush_set_size", NULL);
RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
RNA_def_property_ui_text(prop, "Size", "Radius of the brush in pixels");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 0, 0);
- RNA_def_property_ui_text(prop, "Surface Size", "Radius of brush in Blender units");
+ RNA_def_property_float_funcs(prop, "rna_Brush_get_unprojected_radius", "rna_Brush_set_unprojected_radius", NULL);
+ RNA_def_property_range(prop, 0.001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
+ RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop= RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
@@ -411,6 +473,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_float_funcs(prop, "rna_Brush_get_alpha", "rna_Brush_set_alpha", NULL);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
@@ -453,7 +516,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Crease Brush Pinch Factor", "How much the crease brush pinches");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "autosmooth_factor", PROP_FLOAT, PROP_FACTOR);
+ prop= RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
RNA_def_property_float_default(prop, 0);
RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -477,8 +540,9 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
+ RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_alpha_pressure", "rna_Brush_set_use_alpha_pressure");
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -489,19 +553,20 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "use_size_pressure", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
+ RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_size_pressure", "rna_Brush_set_use_size_pressure");
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "use_jitter_pressure", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "use_spacing_pressure", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
@@ -569,7 +634,8 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Adaptive Spacing", "Space daubs according to surface orientation instead of screen space");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "lock_brush_size", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_locked_size", "rna_Brush_set_use_locked_size");
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LOCK_SIZE);
RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -579,12 +645,12 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "edge_to_edge", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "restore_mesh", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH);
RNA_def_property_ui_text(prop, "Restore Mesh", "Allows a single dot to be carefully positioned");
RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -606,6 +672,23 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ /* paint mode flags */
+ prop= RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
+ RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
+
+ prop= RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
+ RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
+
+ prop= RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
+ RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
+
+ prop= RNA_def_property(srna, "use_paint_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
+ RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
+
/* texture */
prop= RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BrushTextureSlot");
@@ -625,24 +708,27 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Texture Overlay Alpha", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "add_col", PROP_FLOAT, PROP_COLOR);
+ prop= RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "add_col");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "sub_col", PROP_FLOAT, PROP_COLOR);
+ prop= RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "sub_col");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Subract Color", "Color of cursor when subtracting");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "image_icon", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "image_icon");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image Icon", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop= RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CUSTOM_ICON);
+ RNA_def_property_ui_text(prop, "Custom Icon", "Set the brush icon from an image file");
+ RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
+
+ prop= RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "icon_filepath");
+ RNA_def_property_ui_text(prop, "Brush Icon Filepath", "File path to brush icon");
+ RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
/* clone tool */
prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);