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:
-rw-r--r--release/scripts/ui/space_view3d_toolbar.py10
-rw-r--r--source/blender/editors/interface/interface_icons.c47
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
-rw-r--r--source/blender/editors/render/render_preview.c86
-rw-r--r--source/blender/makesdna/DNA_brush_types.h38
-rw-r--r--source/blender/makesrna/RNA_enum_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c172
7 files changed, 151 insertions, 210 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py
index 9d3c26891af..98acd3988f1 100644
--- a/release/scripts/ui/space_view3d_toolbar.py
+++ b/release/scripts/ui/space_view3d_toolbar.py
@@ -1107,16 +1107,14 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel):
else:
col.prop(brush, "add_col", text="Color")
- col.separator()
-
col = layout.column()
col.label(text="Icon:")
row = col.row(align=True)
- row.prop(brush, "icon", text="")
-
- row = col.row(align=True)
- row.prop(brush, "icon_filepath", text="")
+ row.prop(brush, "use_custom_icon")
+ if brush.use_custom_icon:
+ row = col.row(align=True)
+ row.prop(brush, "icon_filepath", text="")
# ********** default tools for weightpaint ****************
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 8db5724cf20..02586a86d1e 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -44,9 +44,13 @@
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
+#include "DNA_brush_types.h"
+#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_brush_types.h"
+
+#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -1009,6 +1013,43 @@ void ui_id_icon_render(bContext *C, ID *id, int preview)
}
}
+static int ui_id_brush_get_icon(bContext *C, ID *id, int preview)
+{
+ Brush *br = (Brush*)id;
+
+ if(br->flag & BRUSH_CUSTOM_ICON) {
+ BKE_icon_getid(id);
+ ui_id_icon_render(C, id, preview);
+ }
+ else if(!id->icon_id) {
+ /* no icon found, reset it */
+
+ /* this is not nice, should probably make
+ brushes be strictly in one paint mode only
+ to avoid this kind of thing */
+ Object *ob = CTX_data_active_object(C);
+ EnumPropertyItem *items;
+ int tool;
+
+ if(ob->mode & OB_MODE_SCULPT) {
+ items = brush_sculpt_tool_items;
+ tool = br->sculpt_tool;
+ }
+ else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) {
+ items = brush_vertexpaint_tool_items;
+ tool = br->vertexpaint_tool;
+ }
+ else {
+ items = brush_imagepaint_tool_items;
+ tool = br->imagepaint_tool;
+ }
+
+ RNA_enum_icon_from_value(items, tool, &id->icon_id);
+ }
+
+ return id->icon_id;
+}
+
int ui_id_icon_get(bContext *C, ID *id, int preview)
{
int iconid= 0;
@@ -1016,12 +1057,14 @@ int ui_id_icon_get(bContext *C, ID *id, int preview)
/* icon */
switch(GS(id->name))
{
+ case ID_BR:
+ iconid= ui_id_brush_get_icon(C, id, preview);
+ break;
case ID_MA: /* fall through */
case ID_TE: /* fall through */
case ID_IM: /* fall through */
case ID_WO: /* fall through */
case ID_LA: /* fall through */
- case ID_BR: /* fall through */
iconid= BKE_icon_getid(id);
/* checks if not exists, or changed */
ui_id_icon_render(C, id, preview);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d2860adbf50..b457bf42ed1 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -747,11 +747,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect)
{
int w, h, x, y, size;
-
- /* only display previews for actual preview images .. ? */
- if (icon < BIFICONID_LAST)
- return;
-
+
w = rect->xmax - rect->xmin;
h = rect->ymax - rect->ymin;
size = MIN2(w, h);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 2342d73768e..4bb1f630dad 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -104,83 +104,13 @@ static int qtest() {return 0;}
ImBuf* get_brush_icon(Brush *brush)
{
- void *icon_data[]= {
- 0,
-
- &datatoc_blob_png,
- &datatoc_clay_png,
- &datatoc_crease_png,
- &datatoc_draw_png,
- &datatoc_fill_png,
- &datatoc_flatten_png,
- &datatoc_grab_png,
- &datatoc_inflate_png,
- &datatoc_layer_png,
- &datatoc_nudge_png,
- &datatoc_pinch_png,
- &datatoc_scrape_png,
- &datatoc_smooth_png,
- &datatoc_snake_hook_png,
- &datatoc_thumb_png,
- &datatoc_twist_png,
-
- &datatoc_add_png,
- &datatoc_blur_png,
- &datatoc_clone_png,
- &datatoc_darken_png,
- &datatoc_lighten_png,
- &datatoc_mix_png,
- &datatoc_multiply_png,
- &datatoc_smear_png,
- &datatoc_soften_png,
- &datatoc_subtract_png,
- &datatoc_texdraw_png,
- &datatoc_vertexdraw_png,
- };
-
- size_t icon_size[]= {
- 0,
-
- datatoc_blob_png_size,
- datatoc_clay_png_size,
- datatoc_crease_png_size,
- datatoc_draw_png_size,
- datatoc_fill_png_size,
- datatoc_flatten_png_size,
- datatoc_grab_png_size,
- datatoc_inflate_png_size,
- datatoc_layer_png_size,
- datatoc_nudge_png_size,
- datatoc_pinch_png_size,
- datatoc_scrape_png_size,
- datatoc_smooth_png_size,
- datatoc_snake_hook_png_size,
- datatoc_thumb_png_size,
- datatoc_twist_png_size,
-
- datatoc_add_png_size,
- datatoc_blur_png_size,
- datatoc_clone_png_size,
- datatoc_darken_png_size,
- datatoc_lighten_png_size,
- datatoc_mix_png_size,
- datatoc_multiply_png_size,
- datatoc_smear_png_size,
- datatoc_soften_png_size,
- datatoc_subtract_png_size,
- datatoc_texdraw_png_size,
- datatoc_vertexdraw_png_size,
- };
-
static const int flags = IB_rect|IB_multilayer|IB_metadata;
- static const int default_icon = BRUSH_ICON_SCULPTDRAW;
-
char path[240];
char *folder;
if (!(brush->icon_imbuf)) {
- if (brush->icon==BRUSH_ICON_FILE) {
+ if (brush->flag & BRUSH_CUSTOM_ICON) {
if (brush->icon_filepath[0]) {
// first use the path directly to try and load the file
@@ -202,21 +132,13 @@ ImBuf* get_brush_icon(Brush *brush)
brush->icon_imbuf= IMB_loadiffname(path, flags);
}
}
-
- // if all else fails use a default image
- if (!(brush->icon_imbuf))
- brush->icon_imbuf= IMB_ibImageFromMemory(icon_data[default_icon], icon_size[default_icon], flags);
- }
- else {
- if (!(brush->icon_imbuf))
- brush->icon_imbuf= IMB_ibImageFromMemory(icon_data[brush->icon], icon_size[brush->icon], flags);
}
-
- BKE_icon_changed(BKE_icon_getid(&(brush->id)));
}
if (!(brush->icon_imbuf))
- printf("get_brush_icon: unable to resolve brush icon imbuf\n");
+ brush->id.icon_id = 0;
+ else
+ BKE_icon_changed(BKE_icon_getid(&(brush->id)));
return brush->icon_imbuf;
}
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 4a174d6471a..dc7d105a8de 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -55,8 +55,6 @@ typedef struct Brush {
struct MTex mtex;
struct ImBuf *icon_imbuf;
- char icon;
- char pad2[7];
PreviewImage *preview;
char icon_filepath[240];
@@ -126,6 +124,7 @@ typedef struct Brush {
#define BRUSH_RANDOM_ROTATION (1<<25)
#define BRUSH_PLANE_TRIM (1<<26)
#define BRUSH_FRONTFACE (1<<27)
+#define BRUSH_CUSTOM_ICON (1<<28)
/* Brush.sculpt_tool */
#define SCULPT_TOOL_DRAW 1
@@ -147,41 +146,6 @@ typedef struct Brush {
#define SCULPT_TOOL_BLOB 17
#define SCULPT_TOOL_CLAY_TUBES 18
-/* Internal Icons */
-#define BRUSH_ICON_FILE 0
-
-#define BRUSH_ICON_BLOB 1
-#define BRUSH_ICON_CLAY 2
-#define BRUSH_ICON_CREASE 3
-#define BRUSH_ICON_SCULPTDRAW 4
-#define BRUSH_ICON_FILL 5
-#define BRUSH_ICON_FLATTEN 6
-#define BRUSH_ICON_GRAB 7
-#define BRUSH_ICON_INFLATE 8
-#define BRUSH_ICON_LAYER 9
-#define BRUSH_ICON_NUDGE 10
-#define BRUSH_ICON_PINCH 11
-#define BRUSH_ICON_SCRAPE 12
-#define BRUSH_ICON_SMOOTH 13
-#define BRUSH_ICON_SNAKE_HOOK 14
-#define BRUSH_ICON_THUMB 15
-#define BRUSH_ICON_TWIST 16
-
-#define BRUSH_ICON_ADD 17
-#define BRUSH_ICON_BLUR 18
-#define BRUSH_ICON_CLONE 19
-#define BRUSH_ICON_DARKEN 20
-#define BRUSH_ICON_LIGHTEN 21
-#define BRUSH_ICON_MIX 22
-#define BRUSH_ICON_MULTIPLY 23
-#define BRUSH_ICON_SMEAR 24
-#define BRUSH_ICON_SOFTEN 25
-#define BRUSH_ICON_SUBTRACT 26
-#define BRUSH_ICON_TEXDRAW 27
-#define BRUSH_ICON_VERTEXDRAW 28
-
-#define BRUSH_ICON_COUNT 29
-
/* ImagePaintSettings.tool */
#define PAINT_TOOL_DRAW 0
#define PAINT_TOOL_SOFTEN 1
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index bb0a1ba2c52..65870d54c11 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -66,6 +66,8 @@ extern EnumPropertyItem event_type_items[];
extern EnumPropertyItem operator_return_items[];
extern EnumPropertyItem brush_sculpt_tool_items[];
+extern EnumPropertyItem brush_vertexpaint_tool_items[];
+extern EnumPropertyItem brush_imagepaint_tool_items[];
extern EnumPropertyItem texture_type_items[];
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 44bca3b2324..e970c79989e 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -36,19 +36,77 @@
#include "IMB_imbuf.h"
+
#include "WM_types.h"
+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;
@@ -56,6 +114,27 @@ static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr)
//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 *br, bContext *C)
{
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -91,12 +170,17 @@ static void rna_Brush_icon_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Brush *br= (Brush*)ptr->data;
- if (br->icon_imbuf) {
+ if(br->icon_imbuf) {
IMB_freeImBuf(br->icon_imbuf);
br->icon_imbuf= NULL;
}
- BKE_icon_changed(BKE_icon_getid(&(br->id)));
+ 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);
}
@@ -219,25 +303,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_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}};
-
static EnumPropertyItem brush_stroke_method_items[] = {
{0, "DOTS", 0, "Dots", ""},
{BRUSH_RESTORE_MESH, "DRAG_DOT", 0, "Drag Dot", ""},
@@ -257,23 +322,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", 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}};
-
- static 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}};
-
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"},
@@ -312,38 +360,6 @@ static void rna_def_brush(BlenderRNA *brna)
{SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem brush_icon_items[] = {
- {BRUSH_ICON_FILE, "FILE", 0, "Use An Image File", ""},
- {BRUSH_ICON_BLOB, "BLOB", 0, "Blob", ""},
- {BRUSH_ICON_CREASE, "CREASE", 0, "Crease", ""},
- {BRUSH_ICON_CLAY, "CLAY", 0, "Clay", ""},
- {BRUSH_ICON_SCULPTDRAW, "SCULPTDRAW", 0, "Sculpt Draw", ""},
- {BRUSH_ICON_FILL, "FILL", 0, "Fill", ""},
- {BRUSH_ICON_FLATTEN, "FLATTEN", 0, "Flatten", ""},
- {BRUSH_ICON_GRAB, "GRAB", 0, "Grab", ""},
- {BRUSH_ICON_INFLATE, "INFLATE", 0, "Inflate", ""},
- {BRUSH_ICON_LAYER, "LAYER", 0, "Layer", ""},
- {BRUSH_ICON_NUDGE, "NUDGE", 0, "Nudge", ""},
- {BRUSH_ICON_PINCH, "PINCH", 0, "Pinch", ""},
- {BRUSH_ICON_TWIST, "TWIST", 0, "Twist", ""},
- {BRUSH_ICON_SCRAPE, "SCRAPE", 0, "Scrape", ""},
- {BRUSH_ICON_SMOOTH, "SMOOTH", 0, "Smooth", ""},
- {BRUSH_ICON_SNAKE_HOOK, "SNAKE_HOOK", 0, "Snake Hook", ""},
- {BRUSH_ICON_THUMB, "THUMB", 0, "Thumb", ""},
- {BRUSH_ICON_ADD, "ADD", 0, "Add", ""},
- {BRUSH_ICON_BLUR, "BLUR", 0, "Blur", ""},
- {BRUSH_ICON_CLONE, "CLONE", 0, "Clone", ""},
- {BRUSH_ICON_DARKEN, "DARKEN", 0, "Darken", ""},
- {BRUSH_ICON_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
- {BRUSH_ICON_MIX, "MIX", 0, "Mix", ""},
- {BRUSH_ICON_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
- {BRUSH_ICON_SMEAR, "SMEAR", 0, "Smear", ""},
- {BRUSH_ICON_SOFTEN, "SOFTEN", 0, "Soften", ""},
- {BRUSH_ICON_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
- {BRUSH_ICON_TEXDRAW, "TEXDRAW", 0, "Texture Draw", ""},
- {BRUSH_ICON_VERTEXDRAW, "VERTEXDRAW", 0, "Vertex Draw", ""},
- {0, NULL, 0, NULL, NULL}};
-
FunctionRNA *func;
PropertyRNA *parm;
@@ -389,17 +405,17 @@ 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");
@@ -407,11 +423,6 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Direction", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop= RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_icon_items);
- RNA_def_property_ui_text(prop, "Brush Icon", "");
- RNA_def_property_update(prop, 0, "rna_Brush_icon_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);
@@ -748,6 +759,11 @@ static void rna_def_brush(BlenderRNA *brna)
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, "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");