diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-07-26 06:35:43 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-07-26 06:35:43 +0400 |
commit | 5b1231849cd2f87af24d13b6631199ba28e100e6 (patch) | |
tree | 4c49be4fd703942c5ad59617ac1764b6b5880fa8 /source/blender/makesrna/intern/rna_brush.c | |
parent | a27de17349f7f341e07ff2521156a444b59ba3b9 (diff) |
* Factored out some duplicated code from rna_brush into paint.c, added a new function that checks whether a brush is used by that paint struct
* Fixed an improperly initialized variable in BKE_previewing_free_id
* Added an RNA access function to get the icon associated with a value
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 2226a37b0ff..44bca3b2324 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -45,6 +45,7 @@ #include "BKE_texture.h" #include "BKE_brush.h" #include "BKE_icons.h" +#include "BKE_paint.h" #include "WM_api.h" @@ -55,43 +56,22 @@ static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr) //WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); } -static int rna_Brush_is_sculpt_brush(Brush *me, bContext *C) +static int rna_Brush_is_sculpt_brush(Brush *br, bContext *C) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; - int i; - - 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; - } - - return 0; + return paint_has_brush(&sd->paint, br); } -static int rna_Brush_is_vpaint_brush(Brush *me, bContext *C) +static int rna_Brush_is_vpaint_brush(Brush *br, bContext *C) { VPaint *vp = CTX_data_tool_settings(C)->vpaint; - int i; - - 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; - } - - return 0; + return paint_has_brush(&vp->paint, br); } -static int rna_Brush_is_wpaint_brush(Brush *me, bContext *C) +static int rna_Brush_is_wpaint_brush(Brush *br, bContext *C) { VPaint *vp = CTX_data_tool_settings(C)->wpaint; - int i; - - 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; - } - - return 0; + return paint_has_brush(&vp->paint, br); } static int rna_Brush_is_imapaint_brush(Brush *me, bContext *C) |