Blender  V2.59
rna_brush.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_brush.c 37031 2011-05-31 02:14:25Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008), Juho Veps�l�inen
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <stdlib.h>
00031 #include <assert.h>
00032 
00033 #include "RNA_define.h"
00034 
00035 #include "rna_internal.h"
00036 
00037 #include "DNA_brush_types.h"
00038 #include "DNA_texture_types.h"
00039 #include "DNA_scene_types.h"
00040 #include "DNA_object_types.h"
00041 
00042 #include "BLI_math.h"
00043 
00044 #include "IMB_imbuf.h"
00045 
00046 #include "WM_types.h"
00047 
00048 static EnumPropertyItem prop_direction_items[]= {
00049         {0, "ADD", 0, "Add", "Add effect of brush"},
00050         {BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
00051         {0, NULL, 0, NULL, NULL}};
00052 
00053 EnumPropertyItem brush_sculpt_tool_items[] = {
00054         {SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
00055         {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
00056         {SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
00057         {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
00058         {SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
00059         {SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
00060         {SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
00061         {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
00062         {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
00063         {SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
00064         {SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
00065         {SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
00066         {SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
00067         {SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
00068         {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
00069         {SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
00070         {0, NULL, 0, NULL, NULL}};
00071 
00072 
00073 EnumPropertyItem brush_vertex_tool_items[] = {
00074         {0, "MIX", ICON_BRUSH_MIX, "Mix", "Use mix blending mode while painting"},
00075         {1, "ADD", ICON_BRUSH_ADD, "Add", "Use add blending mode while painting"},
00076         {2, "SUB", ICON_BRUSH_SUBTRACT, "Subtract", "Use subtract blending mode while painting"},
00077         {3, "MUL", ICON_BRUSH_MULTIPLY, "Multiply", "Use multiply blending mode while painting"},
00078         {4, "BLUR", ICON_BRUSH_BLUR, "Blur", "Blur the color with surrounding values"},
00079         {5, "LIGHTEN", ICON_BRUSH_LIGHTEN, "Lighten", "Use lighten blending mode while painting"},
00080         {6, "DARKEN", ICON_BRUSH_DARKEN, "Darken", "Use darken blending mode while painting"},
00081         {0, NULL, 0, NULL, NULL}};
00082         
00083 EnumPropertyItem brush_image_tool_items[] = {
00084         {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""},
00085         {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""},
00086         {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""},
00087         {PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
00088         {0, NULL, 0, NULL, NULL}};
00089 
00090 #ifdef RNA_RUNTIME
00091 
00092 #include "MEM_guardedalloc.h"
00093 
00094 #include "DNA_object_types.h"
00095 
00096 #include "RNA_access.h"
00097 
00098 #include "BKE_texture.h"
00099 #include "BKE_brush.h"
00100 #include "BKE_icons.h"
00101 #include "BKE_paint.h"
00102 
00103 #include "WM_api.h"
00104 
00105 static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type))
00106 {
00107         ID *id = &br->id;
00108 
00109         if(br->flag & BRUSH_CUSTOM_ICON)
00110                 return;
00111 
00112         if(id->icon_id >= BIFICONID_LAST) {
00113                 BKE_icon_delete(id);
00114                 BKE_previewimg_free_id(id);
00115         }
00116 
00117         id->icon_id = 0;
00118 }
00119 
00120 static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00121 {
00122         Brush *br= (Brush*)ptr->data;
00123         WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
00124         //WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
00125 }
00126 
00127 static void rna_Brush_sculpt_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00128 {
00129         Brush *br= (Brush*)ptr->data;
00130         rna_Brush_reset_icon(br, "sculpt");
00131         rna_Brush_update(bmain, scene, ptr);
00132 }
00133  
00134 static void rna_Brush_vertex_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00135 {
00136         Brush *br= (Brush*)ptr->data;
00137         rna_Brush_reset_icon(br, "vertex_paint");
00138         rna_Brush_update(bmain, scene, ptr);
00139 }
00140  
00141 static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00142 {
00143         Brush *br= (Brush*)ptr->data;
00144         rna_Brush_reset_icon(br, "image_paint");
00145         rna_Brush_update(bmain, scene, ptr);
00146 }
00147 
00148 static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00149 {
00150         Brush *br= (Brush*)ptr->data;
00151 
00152         if(br->icon_imbuf) {
00153                 IMB_freeImBuf(br->icon_imbuf);
00154                 br->icon_imbuf= NULL;
00155         }
00156 
00157         br->id.icon_id = 0;
00158 
00159         if(br->flag & BRUSH_CUSTOM_ICON) {
00160                 BKE_previewimg_get(&br->id);
00161                 BKE_icon_changed(BKE_icon_getid(&br->id));
00162         }
00163 
00164         WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
00165 }
00166 
00167 static void rna_Brush_set_size(PointerRNA *ptr, int value)
00168 {
00169         Brush* me = (Brush*)(ptr->data);
00170 
00171         float size= (float)brush_size(me);
00172         float unprojected_radius;
00173 
00174         // paranoia: previous checks should make sure we don't divide by zero
00175         assert(size != 0);
00176 
00177         // set unprojected radius, so it remains consistent with size
00178         unprojected_radius= (float)(brush_unprojected_radius(me) * value / size);
00179         brush_set_unprojected_radius(me, unprojected_radius);
00180 
00181         brush_set_size(me, value);
00182 }
00183 
00184 static int rna_Brush_get_size(PointerRNA *ptr)
00185 {
00186         Brush* me = (Brush*)(ptr->data);
00187         return brush_size(me);
00188 }
00189 
00190 static void rna_Brush_set_use_locked_size(PointerRNA *ptr, int value)
00191 {
00192         Brush* me = (Brush*)(ptr->data);
00193         brush_set_use_locked_size(me, value);
00194 }
00195 
00196 static int rna_Brush_get_use_locked_size(PointerRNA *ptr)
00197 {
00198         Brush* me = (Brush*)(ptr->data);
00199         return brush_use_locked_size(me);
00200 }
00201 
00202 static void rna_Brush_set_use_size_pressure(PointerRNA *ptr, int value)
00203 {
00204         Brush* me = (Brush*)(ptr->data);
00205         brush_set_use_size_pressure(me, value);
00206 }
00207 
00208 static int rna_Brush_get_use_size_pressure(PointerRNA *ptr)
00209 {
00210         Brush* me = (Brush*)(ptr->data);
00211         return brush_use_size_pressure(me);
00212 }
00213 
00214 static void rna_Brush_set_use_alpha_pressure(PointerRNA *ptr, int value)
00215 {
00216         Brush* me = (Brush*)(ptr->data);
00217         brush_set_use_alpha_pressure(me, value);
00218 }
00219 
00220 static int rna_Brush_get_use_alpha_pressure(PointerRNA *ptr)
00221 {
00222         Brush* me = (Brush*)(ptr->data);
00223         return brush_use_alpha_pressure(me);
00224 }
00225 
00226 static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
00227 {
00228         Brush* me = (Brush*)(ptr->data);
00229 
00230         float unprojected_radius= brush_unprojected_radius(me);
00231         int size;
00232 
00233         // paranoia: previous checks should make sure we don't divide by zero
00234         assert(unprojected_radius != 0.0f);
00235 
00236         // set size, so that it is consistent with unprojected_radius
00237         size= (int)((float)brush_size(me) * value / unprojected_radius);
00238         brush_set_size(me, size);
00239 
00240         brush_set_unprojected_radius(me, value);
00241 }
00242 
00243 static float rna_Brush_get_unprojected_radius(PointerRNA *ptr)
00244 {
00245         Brush* me = (Brush*)(ptr->data);
00246         return brush_unprojected_radius(me);
00247 }
00248 
00249 static void rna_Brush_set_alpha(PointerRNA *ptr, float value)
00250 {
00251         Brush* me = (Brush*)(ptr->data);
00252         brush_set_alpha(me, value);
00253 }
00254 
00255 static float rna_Brush_get_alpha(PointerRNA *ptr)
00256 {
00257         Brush* me = (Brush*)(ptr->data);
00258         return brush_alpha(me);
00259 }
00260 
00261 static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00262 {
00263         static EnumPropertyItem prop_default_items[]= {
00264                 {0, NULL, 0, NULL, NULL}};
00265 
00266         static EnumPropertyItem prop_flatten_contrast_items[]= {
00267                 {0, "FLATTEN", 0, "Flatten", "Add effect of brush"},
00268                 {BRUSH_DIR_IN, "CONTRAST", 0, "Contrast", "Subtract effect of brush"},
00269                 {0, NULL, 0, NULL, NULL}};
00270 
00271         static EnumPropertyItem prop_fill_deepen_items[]= {
00272                 {0, "FILL", 0, "Fill", "Add effect of brush"},
00273                 {BRUSH_DIR_IN, "DEEPEN", 0, "Deepen", "Subtract effect of brush"},
00274                 {0, NULL, 0, NULL, NULL}};
00275 
00276         static EnumPropertyItem prop_scrape_peaks_items[]= {
00277                 {0, "SCRAPE", 0, "Scrape", "Add effect of brush"},
00278                 {BRUSH_DIR_IN, "PEAKS", 0, "Peaks", "Subtract effect of brush"},
00279                 {0, NULL, 0, NULL, NULL}};
00280 
00281         static EnumPropertyItem prop_pinch_magnify_items[]= {
00282                 {0, "PINCH", 0, "Pinch", "Add effect of brush"},
00283                 {BRUSH_DIR_IN, "MAGNIFY", 0, "Magnify", "Subtract effect of brush"},
00284                 {0, NULL, 0, NULL, NULL}};
00285 
00286         static EnumPropertyItem prop_inflate_deflate_items[]= {
00287                 {0, "INFLATE", 0, "Inflate", "Add effect of brush"},
00288                 {BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"},
00289                 {0, NULL, 0, NULL, NULL}};
00290 
00291         Brush *me= (Brush*)(ptr->data);
00292 
00293         switch (me->sculpt_tool) {
00294                 case SCULPT_TOOL_DRAW:
00295                 case SCULPT_TOOL_CREASE:
00296                 case SCULPT_TOOL_BLOB:
00297                 case SCULPT_TOOL_LAYER:
00298                 case SCULPT_TOOL_CLAY:
00299                         return prop_direction_items;
00300 
00301                 case SCULPT_TOOL_FLATTEN:
00302                         return prop_flatten_contrast_items;
00303 
00304                 case SCULPT_TOOL_FILL:
00305                         return prop_fill_deepen_items;
00306 
00307                 case SCULPT_TOOL_SCRAPE:
00308                         return prop_scrape_peaks_items;
00309 
00310                 case SCULPT_TOOL_PINCH:
00311                         return prop_pinch_magnify_items;
00312 
00313                 case SCULPT_TOOL_INFLATE:
00314                         return prop_inflate_deflate_items;
00315 
00316                 default:
00317                         return prop_default_items;
00318         }
00319 }
00320 
00321 #else
00322 
00323 static void rna_def_brush_texture_slot(BlenderRNA *brna)
00324 {
00325         StructRNA *srna;
00326         PropertyRNA *prop;
00327 
00328         static EnumPropertyItem prop_map_mode_items[] = {
00329                 {MTEX_MAP_MODE_FIXED, "FIXED", 0, "Fixed", ""},
00330                 {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
00331                 {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
00332                 {0, NULL, 0, NULL, NULL}};
00333 
00334         srna= RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
00335         RNA_def_struct_sdna(srna, "MTex");
00336         RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock");
00337 
00338         prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
00339         RNA_def_property_float_sdna(prop, NULL, "rot");
00340         RNA_def_property_range(prop, 0, M_PI*2);
00341         RNA_def_property_ui_text(prop, "Angle", "Defines brush texture rotation");
00342         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00343 
00344         prop= RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE);
00345         RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
00346         RNA_def_property_enum_items(prop, prop_map_mode_items);
00347         RNA_def_property_ui_text(prop, "Mode", "");
00348         RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
00349 }
00350 
00351 static void rna_def_brush(BlenderRNA *brna)
00352 {
00353         StructRNA *srna;
00354         PropertyRNA *prop;
00355         
00356         static EnumPropertyItem prop_blend_items[] = {
00357                 {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting"},
00358                 {IMB_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting"},
00359                 {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use subtract blending mode while painting"},
00360                 {IMB_BLEND_MUL, "MUL", 0, "Multiply", "Use multiply blending mode while painting"},
00361                 {IMB_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"},
00362                 {IMB_BLEND_DARKEN, "DARKEN", 0, "Darken", "Use darken blending mode while painting"},
00363                 {IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting"},
00364                 {IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"},
00365                 {0, NULL, 0, NULL, NULL}};
00366         
00367         static EnumPropertyItem brush_stroke_method_items[] = {
00368                 {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
00369                 {BRUSH_RESTORE_MESH, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
00370                 {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
00371                 {BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"},
00372                 {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
00373                 {0, NULL, 0, NULL, NULL}};
00374 
00375         static EnumPropertyItem texture_angle_source_items[] = {
00376                 {0, "USER", 0, "User", "Rotate the brush texture by given angle"},
00377                 {BRUSH_RAKE, "RAKE", 0, "Rake", "Rotate the brush texture to match the stroke direction"},
00378                 {BRUSH_RANDOM_ROTATION, "RANDOM", 0, "Random", "Rotate the brush texture at random"},
00379                 {0, NULL, 0, NULL, NULL}};
00380 
00381         static EnumPropertyItem texture_angle_source_no_random_items[] = {
00382                 {0, "USER", 0, "User", "Rotate the brush texture by given angle"},
00383                 {BRUSH_RAKE, "RAKE", 0, "Rake", "Rotate the brush texture to match the stroke direction"},
00384                 {0, NULL, 0, NULL, NULL}};
00385 
00386         static EnumPropertyItem brush_sculpt_plane_items[] = {
00387                 {SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""},
00388                 {SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""},
00389                 {SCULPT_DISP_DIR_X, "X", 0, "X Plane", ""},
00390                 {SCULPT_DISP_DIR_Y, "Y", 0, "Y Plane", ""},
00391                 {SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
00392                 {0, NULL, 0, NULL, NULL}};
00393 
00394         srna= RNA_def_struct(brna, "Brush", "ID");
00395         RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting");
00396         RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
00397 
00398         /* enums */
00399         prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
00400         RNA_def_property_enum_items(prop, prop_blend_items);
00401         RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode");
00402         RNA_def_property_update(prop, 0, "rna_Brush_update");
00403 
00404         prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
00405         RNA_def_property_enum_items(prop, brush_sculpt_tool_items);
00406         RNA_def_property_ui_text(prop, "Sculpt Tool", "");
00407         RNA_def_property_update(prop, 0, "rna_Brush_sculpt_tool_update");
00408 
00409         prop= RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
00410         RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool");
00411         RNA_def_property_enum_items(prop, brush_vertex_tool_items);
00412         RNA_def_property_ui_text(prop, "Vertex/Weight Paint Tool", "");
00413         RNA_def_property_update(prop, 0, "rna_Brush_vertex_tool_update");
00414         
00415         prop= RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
00416         RNA_def_property_enum_sdna(prop, NULL, "imagepaint_tool");
00417         RNA_def_property_enum_items(prop, brush_image_tool_items);
00418         RNA_def_property_ui_text(prop, "Image Paint Tool", "");
00419         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_imagepaint_tool_update");
00420 
00421         prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
00422         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00423         RNA_def_property_enum_items(prop, prop_direction_items);
00424         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_direction_itemf");
00425         RNA_def_property_ui_text(prop, "Direction", "");
00426         RNA_def_property_update(prop, 0, "rna_Brush_update");
00427 
00428         prop= RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
00429         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00430         RNA_def_property_enum_items(prop, brush_stroke_method_items);
00431         RNA_def_property_ui_text(prop, "Stroke Method", "");
00432         RNA_def_property_update(prop, 0, "rna_Brush_update");
00433 
00434         prop= RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
00435         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00436         RNA_def_property_enum_items(prop, texture_angle_source_items);
00437         RNA_def_property_ui_text(prop, "Texture Angle Source", "");
00438         RNA_def_property_update(prop, 0, "rna_Brush_update");
00439 
00440         prop= RNA_def_property(srna, "texture_angle_source_no_random", PROP_ENUM, PROP_NONE);
00441         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00442         RNA_def_property_enum_items(prop, texture_angle_source_no_random_items);
00443         RNA_def_property_ui_text(prop, "Texture Angle Source", "");
00444         RNA_def_property_update(prop, 0, "rna_Brush_update");
00445 
00446         prop= RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
00447         RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
00448         RNA_def_property_ui_text(prop, "Sculpt Plane", "");
00449         RNA_def_property_update(prop, 0, "rna_Brush_update");
00450         
00451         /* number values */
00452         prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
00453         RNA_def_property_int_funcs(prop, "rna_Brush_get_size", "rna_Brush_set_size", NULL);
00454         RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
00455         RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
00456         RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
00457         RNA_def_property_update(prop, 0, "rna_Brush_update");
00458         
00459         prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
00460         RNA_def_property_float_funcs(prop, "rna_Brush_get_unprojected_radius", "rna_Brush_set_unprojected_radius", NULL);
00461         RNA_def_property_range(prop, 0.001, FLT_MAX);
00462         RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
00463         RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
00464         RNA_def_property_update(prop, 0, "rna_Brush_update");
00465 
00466         prop= RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
00467         RNA_def_property_float_sdna(prop, NULL, "jitter");
00468         RNA_def_property_range(prop, 0.0f, 1.0f);
00469         RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting");
00470         RNA_def_property_update(prop, 0, "rna_Brush_update");
00471 
00472         prop= RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);
00473         RNA_def_property_int_sdna(prop, NULL, "spacing");
00474         RNA_def_property_range(prop, 1, 1000);
00475         RNA_def_property_ui_range(prop, 1, 500, 5, 0);
00476         RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
00477         RNA_def_property_update(prop, 0, "rna_Brush_update");
00478 
00479         prop= RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_DISTANCE);
00480         RNA_def_property_range(prop, 10, 200);
00481         RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
00482         RNA_def_property_update(prop, 0, "rna_Brush_update");
00483 
00484         prop= RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_FACTOR);
00485         RNA_def_property_range(prop, 0.5, 0.99);
00486         RNA_def_property_ui_text(prop, "Smooth Stroke Factor", "Higher values give a smoother stroke");
00487         RNA_def_property_update(prop, 0, "rna_Brush_update");
00488         
00489         prop= RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
00490         RNA_def_property_float_sdna(prop, NULL, "rate");
00491         RNA_def_property_range(prop, 0.0001f , 10000.0f);
00492         RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
00493         RNA_def_property_ui_text(prop, "Rate", "Interval between paints for Airbrush");
00494         RNA_def_property_update(prop, 0, "rna_Brush_update");
00495         
00496         prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
00497         RNA_def_property_range(prop, 0.0, 1.0);
00498         RNA_def_property_float_sdna(prop, NULL, "rgb");
00499         RNA_def_property_ui_text(prop, "Color", "");
00500         RNA_def_property_update(prop, 0, "rna_Brush_update");
00501         
00502         prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
00503         RNA_def_property_float_sdna(prop, NULL, "alpha");
00504         RNA_def_property_float_funcs(prop, "rna_Brush_get_alpha", "rna_Brush_set_alpha", NULL);
00505         RNA_def_property_float_default(prop, 0.5f);
00506         RNA_def_property_range(prop, 0.0f, 10.0f);
00507         RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
00508         RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
00509         RNA_def_property_update(prop, 0, "rna_Brush_update");
00510 
00511         prop= RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
00512         RNA_def_property_float_sdna(prop, NULL, "plane_offset");
00513         RNA_def_property_float_default(prop, 0);
00514         RNA_def_property_range(prop, -2.0f, 2.0f);
00515         RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 0.001);
00516         RNA_def_property_ui_text(prop, "Plane Offset", "Adjusts plane on which the brush acts towards or away from the object surface");
00517         RNA_def_property_update(prop, 0, "rna_Brush_update");
00518 
00519         prop= RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
00520         RNA_def_property_float_sdna(prop, NULL, "plane_trim");
00521         RNA_def_property_float_default(prop, 0.5f);
00522         RNA_def_property_range(prop, 0, 1.0f);
00523         RNA_def_property_ui_text(prop, "Plane Trim", "If a vertex is further from offset plane than this then it is not affected");
00524         RNA_def_property_update(prop, 0, "rna_Brush_update");
00525 
00526         prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
00527         RNA_def_property_float_sdna(prop, NULL, "height");
00528         RNA_def_property_float_default(prop, 0.5f);
00529         RNA_def_property_range(prop, 0, 1.0f);
00530         RNA_def_property_ui_text(prop, "Brush Height", "Affectable height of brush (layer height for layer tool, i.e.)");
00531         RNA_def_property_update(prop, 0, "rna_Brush_update");
00532 
00533         prop= RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
00534         RNA_def_property_float_sdna(prop, NULL, "texture_sample_bias");
00535         RNA_def_property_float_default(prop, 0);
00536         RNA_def_property_range(prop, -1, 1);
00537         RNA_def_property_ui_text(prop, "Texture Sample Bias", "Value added to texture samples");
00538         RNA_def_property_update(prop, 0, "rna_Brush_update");
00539 
00540         prop= RNA_def_property(srna, "normal_weight", PROP_FLOAT, PROP_FACTOR);
00541         RNA_def_property_float_sdna(prop, NULL, "normal_weight");
00542         RNA_def_property_float_default(prop, 0);
00543         RNA_def_property_range(prop, 0.0f, 1.0f);
00544         RNA_def_property_ui_text(prop, "Normal Weight", "How much grab will pull vertexes out of surface during a grab");
00545         RNA_def_property_update(prop, 0, "rna_Brush_update");
00546 
00547         prop= RNA_def_property(srna, "crease_pinch_factor", PROP_FLOAT, PROP_FACTOR);
00548         RNA_def_property_float_sdna(prop, NULL, "crease_pinch_factor");
00549         RNA_def_property_float_default(prop, 2.0f/3.0f);
00550         RNA_def_property_range(prop, 0.0f, 1.0f);
00551         RNA_def_property_ui_text(prop, "Crease Brush Pinch Factor", "How much the crease brush pinches");
00552         RNA_def_property_update(prop, 0, "rna_Brush_update");
00553 
00554         prop= RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
00555         RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
00556         RNA_def_property_float_default(prop, 0);
00557         RNA_def_property_range(prop, 0.0f, 1.0f);
00558         RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
00559         RNA_def_property_ui_text(prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
00560         RNA_def_property_update(prop, 0, "rna_Brush_update");
00561 
00562         /* flag */
00563         prop= RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
00564         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
00565         RNA_def_property_ui_text(prop, "Airbrush", "Keep applying paint effect while holding mouse (spray)");
00566         RNA_def_property_update(prop, 0, "rna_Brush_update");
00567         
00568         prop= RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
00569         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
00570         RNA_def_property_ui_text(prop, "Original Normal", "When locked keep using normal of surface where stroke was initiated");
00571         RNA_def_property_update(prop, 0, "rna_Brush_update");
00572         
00573         prop= RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
00574         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS);
00575         RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting");
00576         RNA_def_property_update(prop, 0, "rna_Brush_update");
00577         
00578         prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
00579         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
00580         RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_alpha_pressure", "rna_Brush_set_use_alpha_pressure");
00581         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00582         RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
00583         RNA_def_property_update(prop, 0, "rna_Brush_update");
00584         
00585         prop= RNA_def_property(srna, "use_offset_pressure", PROP_BOOLEAN, PROP_NONE);
00586         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_OFFSET_PRESSURE);
00587         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00588         RNA_def_property_ui_text(prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
00589         RNA_def_property_update(prop, 0, "rna_Brush_update");
00590 
00591         prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
00592         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
00593         RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_size_pressure", "rna_Brush_set_use_size_pressure");
00594         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00595         RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
00596         RNA_def_property_update(prop, 0, "rna_Brush_update");
00597         
00598         prop= RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
00599         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
00600         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00601         RNA_def_property_ui_text(prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter");
00602         RNA_def_property_update(prop, 0, "rna_Brush_update");
00603 
00604         prop= RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
00605         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
00606         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00607         RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
00608         RNA_def_property_update(prop, 0, "rna_Brush_update");
00609 
00610         prop= RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
00611         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERSE_SMOOTH_PRESSURE);
00612         RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
00613         RNA_def_property_ui_text(prop, "Inverse Smooth Pressure", "Lighter pressure causes more smoothing to be applied");
00614         RNA_def_property_update(prop, 0, "rna_Brush_update");
00615         
00616         prop= RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
00617         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RAKE);
00618         RNA_def_property_ui_text(prop, "Rake", "Rotate the brush texture to match the stroke direction");
00619         RNA_def_property_update(prop, 0, "rna_Brush_update");
00620 
00621         prop= RNA_def_property(srna, "use_random_rotation", PROP_BOOLEAN, PROP_NONE);
00622         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RANDOM_ROTATION);
00623         RNA_def_property_ui_text(prop, "Random Rotation", "Rotate the brush texture at random");
00624         RNA_def_property_update(prop, 0, "rna_Brush_update");
00625 
00626         prop= RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
00627         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PLANE_TRIM);
00628         RNA_def_property_ui_text(prop, "Use Plane Trim", "Enable Plane Trim");
00629         RNA_def_property_update(prop, 0, "rna_Brush_update");
00630 
00631         prop= RNA_def_property(srna, "use_frontface", PROP_BOOLEAN, PROP_NONE);
00632         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE);
00633         RNA_def_property_ui_text(prop, "Use Front-Face", "Brush only affects vertexes that face the viewer");
00634         RNA_def_property_update(prop, 0, "rna_Brush_update");
00635 
00636         prop= RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
00637         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
00638         RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location");
00639         RNA_def_property_update(prop, 0, "rna_Brush_update");
00640 
00641         prop= RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
00642         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE);
00643         RNA_def_property_ui_text(prop, "Space", "Limit brush application to the distance specified by spacing");
00644         RNA_def_property_update(prop, 0, "rna_Brush_update");
00645 
00646         prop= RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
00647         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
00648         RNA_def_property_ui_text(prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path");
00649         RNA_def_property_update(prop, 0, "rna_Brush_update");
00650 
00651         prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
00652         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
00653         RNA_def_property_ui_text(prop, "Persistent", "Sculpts on a persistent layer of the mesh");
00654         RNA_def_property_update(prop, 0, "rna_Brush_update");
00655 
00656         prop= RNA_def_property(srna, "use_accumulate", PROP_BOOLEAN, PROP_NONE);
00657         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ACCUMULATE);
00658         RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke dabs on top of each other");
00659         RNA_def_property_update(prop, 0, "rna_Brush_update");
00660         
00661         prop= RNA_def_property(srna, "use_space_atten", PROP_BOOLEAN, PROP_NONE);
00662         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
00663         RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment", "Automatically adjusts strength to give consistent results for different spacings");
00664         RNA_def_property_update(prop, 0, "rna_Brush_update");
00665 
00666         /* adaptive space is not implemented yet */
00667         prop= RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
00668         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ADAPTIVE_SPACE);
00669         RNA_def_property_ui_text(prop, "Adaptive Spacing", "Space daubs according to surface orientation instead of screen space");
00670         RNA_def_property_update(prop, 0, "rna_Brush_update");
00671 
00672         prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
00673         RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_locked_size", "rna_Brush_set_use_locked_size");
00674         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LOCK_SIZE);
00675         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");
00676         RNA_def_property_update(prop, 0, "rna_Brush_update");
00677 
00678         prop= RNA_def_property(srna, "use_texture_overlay", PROP_BOOLEAN, PROP_NONE);
00679         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TEXTURE_OVERLAY);
00680         RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
00681         RNA_def_property_update(prop, 0, "rna_Brush_update");
00682 
00683         prop= RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
00684         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
00685         RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
00686         RNA_def_property_update(prop, 0, "rna_Brush_update");
00687 
00688         prop= RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
00689         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH);
00690         RNA_def_property_ui_text(prop, "Restore Mesh", "Allows a single dot to be carefully positioned");
00691         RNA_def_property_update(prop, 0, "rna_Brush_update");
00692 
00693         prop= RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
00694         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
00695         RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position");
00696         RNA_def_property_update(prop, 0, "rna_Brush_update");
00697         
00698         /* only for projection paint, TODO, other paint modes */
00699         prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
00700         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_LOCK_ALPHA);
00701         RNA_def_property_ui_text(prop, "Alpha", "When this is disabled, lock alpha while painting");
00702         RNA_def_property_update(prop, 0, "rna_Brush_update");
00703 
00704         prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
00705         RNA_def_property_flag(prop, PROP_NEVER_NULL);
00706         RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
00707         RNA_def_property_update(prop, 0, "rna_Brush_update");
00708 
00709         /* paint mode flags */
00710         prop= RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
00711         RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
00712         RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
00713 
00714         prop= RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
00715         RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
00716         RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
00717 
00718         prop= RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
00719         RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
00720         RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");    
00721 
00722         prop= RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
00723         RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
00724         RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");  
00725 
00726         /* texture */
00727         prop= RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
00728         RNA_def_property_struct_type(prop, "BrushTextureSlot");
00729         RNA_def_property_pointer_sdna(prop, NULL, "mtex");
00730         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00731         RNA_def_property_ui_text(prop, "Texture Slot", "");
00732         
00733         prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
00734         RNA_def_property_pointer_sdna(prop, NULL, "mtex.tex");
00735         RNA_def_property_flag(prop, PROP_EDITABLE);
00736         RNA_def_property_ui_text(prop, "Texture", "");
00737         RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_update");
00738 
00739         prop= RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
00740         RNA_def_property_int_sdna(prop, NULL, "texture_overlay_alpha");
00741         RNA_def_property_range(prop, 1, 100);
00742         RNA_def_property_ui_text(prop, "Texture Overlay Alpha", "");
00743         RNA_def_property_update(prop, 0, "rna_Brush_update");
00744 
00745         prop= RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
00746         RNA_def_property_float_sdna(prop, NULL, "add_col");
00747         RNA_def_property_array(prop, 3);
00748         RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
00749         RNA_def_property_update(prop, 0, "rna_Brush_update");
00750 
00751         prop= RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
00752         RNA_def_property_float_sdna(prop, NULL, "sub_col");
00753         RNA_def_property_array(prop, 3);
00754         RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting");
00755         RNA_def_property_update(prop, 0, "rna_Brush_update");
00756 
00757         prop= RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
00758         RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CUSTOM_ICON);
00759         RNA_def_property_ui_text(prop, "Custom Icon", "Set the brush icon from an image file");
00760         RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
00761 
00762         prop= RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
00763         RNA_def_property_string_sdna(prop, NULL, "icon_filepath");
00764         RNA_def_property_ui_text(prop, "Brush Icon Filepath", "File path to brush icon");
00765         RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
00766 
00767         /* clone tool */
00768         prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
00769         RNA_def_property_pointer_sdna(prop, NULL, "clone.image");
00770         RNA_def_property_flag(prop, PROP_EDITABLE);
00771         RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool");
00772         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
00773         
00774         prop= RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_NONE);
00775         RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
00776         RNA_def_property_range(prop, 0.0f, 1.0f);
00777         RNA_def_property_ui_text(prop, "Clone Alpha", "Opacity of clone image display");
00778         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
00779 
00780         prop= RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
00781         RNA_def_property_float_sdna(prop, NULL, "clone.offset");
00782         RNA_def_property_ui_text(prop, "Clone Offset", "");
00783         RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3);
00784         RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
00785 }
00786 
00787 
00788 /* A brush stroke is a list of changes to the brush that
00789  * can occur during a stroke
00790  *
00791  *  o 3D location of the brush
00792  *  o 2D mouse location
00793  *  o Tablet pressure
00794  *  o Direction flip
00795  *  o Tool switch
00796  *  o Time
00797  */
00798 static void rna_def_operator_stroke_element(BlenderRNA *brna)
00799 {
00800         StructRNA *srna;
00801         PropertyRNA *prop;
00802 
00803         srna= RNA_def_struct(brna, "OperatorStrokeElement", "PropertyGroup");
00804         RNA_def_struct_ui_text(srna, "Operator Stroke Element", "");
00805 
00806         prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
00807         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00808         RNA_def_property_array(prop, 3);
00809         RNA_def_property_ui_text(prop, "Location", "");
00810 
00811         prop= RNA_def_property(srna, "mouse", PROP_FLOAT, PROP_XYZ);
00812         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00813         RNA_def_property_array(prop, 2);
00814         RNA_def_property_ui_text(prop, "Mouse", "");
00815 
00816         prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
00817         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00818         RNA_def_property_range(prop, 0.0f, 1.0f);
00819         RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure");
00820 
00821         prop= RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE);
00822         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00823         RNA_def_property_ui_text(prop, "Flip", "");
00824 
00825         // used in uv painting
00826         prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
00827         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00828         RNA_def_property_ui_text(prop, "Time", "");
00829         
00830         /* used for Grease Pencil sketching sessions */
00831         prop= RNA_def_property(srna, "is_start", PROP_BOOLEAN, PROP_NONE);
00832         RNA_def_property_flag(prop, PROP_IDPROPERTY);
00833         RNA_def_property_ui_text(prop, "Is Stroke Start", "");
00834 
00835         /* XXX: Tool (this will be for pressing a modifier key for a different brush,
00836                         e.g. switching to a Smooth brush in the middle of the stroke */
00837 
00838         // XXX: i don't think blender currently supports the ability to properly do a remappable modifier in the middle of a stroke
00839 }
00840 
00841 void RNA_def_brush(BlenderRNA *brna)
00842 {
00843         rna_def_brush(brna);
00844         rna_def_brush_texture_slot(brna);
00845         rna_def_operator_stroke_element(brna);
00846 }
00847 
00848 #endif