Blender V2.61 - r43446

rna_sculpt_paint.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Campbell Barton
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 
00030 #include "RNA_define.h"
00031 
00032 #include "rna_internal.h"
00033 
00034 #include "DNA_ID.h"
00035 #include "DNA_scene_types.h"
00036 #include "DNA_brush_types.h"
00037 
00038 #include "BKE_paint.h"
00039 
00040 #include "WM_api.h"
00041 #include "WM_types.h"
00042 
00043 static EnumPropertyItem particle_edit_hair_brush_items[] = {
00044     {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
00045     {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
00046     {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
00047     {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
00048     {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
00049     {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
00050     {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
00051     {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
00052     {0, NULL, 0, NULL, NULL}};
00053 
00054 #ifdef RNA_RUNTIME
00055 #include "MEM_guardedalloc.h"
00056 
00057 #include "BKE_context.h"
00058 #include "BKE_pointcache.h"
00059 #include "BKE_particle.h"
00060 #include "BKE_depsgraph.h"
00061 
00062 #include "ED_particle.h"
00063 
00064 static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = {
00065     {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
00066     {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
00067     {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
00068     {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
00069     {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
00070     {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
00071     {0, NULL, 0, NULL, NULL}};
00072 
00073 static EnumPropertyItem particle_edit_cache_brush_items[] = {
00074     {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
00075     {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
00076     {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
00077     {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
00078     {0, NULL, 0, NULL, NULL}};
00079 
00080 static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
00081 {
00082     ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
00083     ParticleBrushData *brush= NULL;
00084 
00085     if(pset->brushtype != PE_BRUSH_NONE)
00086         brush= &pset->brush[pset->brushtype];
00087 
00088     return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
00089 }
00090 
00091 static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
00092 {
00093     return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
00094 }
00095 
00096 static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
00097 {
00098     Object *ob= (scene->basact)? scene->basact->object: NULL;
00099     PTCacheEdit *edit = PE_get_current(scene, ob);
00100 
00101     if(!edit)
00102         return;
00103 
00104     psys_free_path_cache(edit->psys, edit);
00105 }
00106 
00107 static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
00108 {
00109     Object *ob= (scene->basact)? scene->basact->object: NULL;
00110 
00111     if(ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00112 }
00113 static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
00114 {
00115     ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
00116     
00117     /* redraw hair completely if weight brush is/was used */
00118     if((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) {
00119         Object *ob = (pset->scene->basact)? pset->scene->basact->object: NULL;
00120         if(ob) {
00121             DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00122             WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00123         }
00124     }
00125 
00126     pset->brushtype = value;
00127 }
00128 static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr),
00129                                                      PropertyRNA *UNUSED(prop), int *UNUSED(free))
00130 {
00131     Scene *scene= CTX_data_scene(C);
00132     Object *ob= (scene->basact)? scene->basact->object: NULL;
00133 #if 0
00134     PTCacheEdit *edit = PE_get_current(scene, ob);
00135     ParticleSystem *psys= edit ? edit->psys : NULL;
00136 #else
00137     /* use this rather than PE_get_current() - because the editing cache is
00138      * dependant on the cache being updated which can happen after this UI
00139      * draws causing a glitch [#28883] */
00140     ParticleSystem *psys= psys_get_current(ob);
00141 #endif
00142 
00143     if(psys) {
00144         if(psys->flag & PSYS_GLOBAL_HAIR) {
00145             return particle_edit_disconnected_hair_brush_items;
00146         }
00147         else {
00148             return particle_edit_hair_brush_items;
00149         }
00150     }
00151 
00152     return particle_edit_cache_brush_items;
00153 }
00154 
00155 static int rna_ParticleEdit_editable_get(PointerRNA *ptr)
00156 {
00157     ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
00158 
00159     return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
00160 }
00161 static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
00162 {
00163     ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
00164 
00165     if(pset->scene) {
00166         PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
00167 
00168         return (edit && edit->psys);
00169     }
00170     
00171     return 0;
00172 }
00173 
00174 static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
00175 {
00176     Scene *scene= (Scene *)ptr->id.data;
00177     ToolSettings *ts = scene->toolsettings;
00178     Brush *brush= value.id.data;
00179     int mode = 0;
00180 
00181     /* check the origin of the Paint struct to see which paint
00182        mode to select from */
00183 
00184     if(ptr->data == &ts->imapaint)
00185         mode = OB_MODE_TEXTURE_PAINT;
00186     else if(ptr->data == ts->sculpt)
00187         mode = OB_MODE_SCULPT;
00188     else if(ptr->data == ts->vpaint)
00189         mode = OB_MODE_VERTEX_PAINT;
00190     else if(ptr->data == ts->wpaint)
00191         mode = OB_MODE_WEIGHT_PAINT;
00192 
00193     return brush->ob_mode & mode;
00194 }
00195 
00196 static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
00197 {
00198     Object *ob= (scene->basact)? scene->basact->object: NULL;
00199 
00200     if(ob) {
00201         DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00202         WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
00203     }
00204 }
00205 
00206 #else
00207 
00208 static void rna_def_paint(BlenderRNA *brna)
00209 {
00210     StructRNA *srna;
00211     PropertyRNA *prop;
00212 
00213     srna= RNA_def_struct(brna, "Paint", NULL);
00214     RNA_def_struct_ui_text(srna, "Paint", "");
00215 
00216     /* Global Settings */
00217     prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
00218     RNA_def_property_flag(prop, PROP_EDITABLE);
00219     RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
00220     RNA_def_property_ui_text(prop, "Brush", "Active Brush");
00221     RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
00222 
00223     prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
00224     RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
00225     RNA_def_property_ui_text(prop, "Show Brush", "");
00226 
00227     prop= RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
00228     RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE);
00229     RNA_def_property_ui_text(prop, "Show Brush On Surface", "");
00230 
00231     prop= RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
00232     RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
00233     RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view");
00234 }
00235 
00236 static void rna_def_sculpt(BlenderRNA  *brna)
00237 {
00238     StructRNA *srna;
00239     PropertyRNA *prop;
00240 
00241     srna= RNA_def_struct(brna, "Sculpt", "Paint");
00242     RNA_def_struct_ui_text(srna, "Sculpt", "");
00243 
00244     prop= RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
00245     RNA_def_property_int_sdna(prop, NULL, "radial_symm");
00246     RNA_def_property_int_default(prop, 1);
00247     RNA_def_property_range(prop, 1, 64);
00248     RNA_def_property_ui_range(prop, 0, 32, 1, 1);
00249     RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface");
00250 
00251     prop= RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
00252     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);
00253     RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
00254 
00255     prop= RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
00256     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y);
00257     RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
00258 
00259     prop= RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
00260     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z);
00261     RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
00262 
00263     prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
00264     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
00265     RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
00266 
00267     prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
00268     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
00269     RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
00270 
00271     prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
00272     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
00273     RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
00274 
00275     prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
00276     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER);
00277     RNA_def_property_ui_text(prop, "Symmetry Feathering",
00278                              "Reduce the strength of the brush where it overlaps symmetrical daubs");
00279 
00280     prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
00281     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
00282     RNA_def_property_ui_text(prop, "Use OpenMP", "Take advantage of multiple CPU cores to improve sculpting performance");
00283 
00284     prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
00285     RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
00286     RNA_def_property_ui_text(prop, "Use Deform Only",
00287                              "Use only deformation modifiers (temporary disable all "
00288                              "constructive modifiers except multi-resolution)");
00289     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update");
00290 }
00291 
00292 /* use for weight paint too */
00293 static void rna_def_vertex_paint(BlenderRNA *brna)
00294 {
00295     StructRNA *srna;
00296     PropertyRNA *prop;
00297 
00298     srna= RNA_def_struct(brna, "VertexPaint", "Paint");
00299     RNA_def_struct_sdna(srna, "VPaint");
00300     RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
00301 
00302     /* vertex paint only */
00303     prop= RNA_def_property(srna, "use_all_faces", PROP_BOOLEAN, PROP_NONE);
00304     RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA);
00305     RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush");
00306 
00307     prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
00308     RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS);
00309     RNA_def_property_ui_text(prop, "Normals", "Apply the vertex normal before painting");
00310     
00311     prop= RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE);
00312     RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY);
00313     RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse");
00314 
00315     /* weight paint only */
00316     prop= RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
00317     RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_ONLYVGROUP);
00318     RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to verts already apart of the vertex group");
00319 }
00320 
00321 static void rna_def_image_paint(BlenderRNA *brna)
00322 {
00323     StructRNA *srna;
00324     PropertyRNA *prop;
00325     
00326     srna= RNA_def_struct(brna, "ImagePaint", "Paint");
00327     RNA_def_struct_sdna(srna, "ImagePaintSettings");
00328     RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
00329     
00330     /* booleans */
00331     prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE);
00332     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE);
00333     RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes");
00334     
00335     prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
00336     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
00337     RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
00338     
00339     prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
00340     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
00341     RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
00342     
00343     prop= RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
00344     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
00345     RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
00346     
00347     prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
00348     RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
00349     RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
00350     
00351     prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
00352     RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
00353     RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
00354     
00355     prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
00356     RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
00357     RNA_def_property_ui_text(prop, "Clone Map",
00358                              "Use another UV map as clone source, otherwise use the 3D cursor as the source");
00359     
00360     /* integers */
00361     
00362     prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED);
00363     RNA_def_property_ui_range(prop, 0, 8, 0, 0);
00364     RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
00365 
00366     prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
00367     RNA_def_property_range(prop, 0, 90);
00368     RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle");
00369 
00370     prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size",
00371                             "Size to capture the image for re-projecting", 0, 0);
00372     RNA_def_property_range(prop, 512, 16384);
00373 }
00374 
00375 static void rna_def_particle_edit(BlenderRNA *brna)
00376 {
00377     StructRNA *srna;
00378     PropertyRNA *prop;
00379 
00380     static EnumPropertyItem select_mode_items[] = {
00381         {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
00382         {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
00383         {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
00384         {0, NULL, 0, NULL, NULL}};
00385 
00386     static EnumPropertyItem puff_mode[] = {
00387         {0, "ADD", 0, "Add", "Make hairs more puffy"},
00388         {1, "SUB", 0, "Sub", "Make hairs less puffy"},
00389         {0, NULL, 0, NULL, NULL}};
00390 
00391     static EnumPropertyItem length_mode[] = {
00392         {0, "GROW", 0, "Grow", "Make hairs longer"},
00393         {1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
00394         {0, NULL, 0, NULL, NULL}};
00395 
00396     static EnumPropertyItem edit_type_items[]= {
00397         {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
00398         {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
00399         {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
00400         {0, NULL, 0, NULL, NULL}
00401     };
00402 
00403 
00404     /* edit */
00405 
00406     srna= RNA_def_struct(brna, "ParticleEdit", NULL);
00407     RNA_def_struct_sdna(srna, "ParticleEditSettings");
00408     RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
00409 
00410     prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
00411     RNA_def_property_enum_sdna(prop, NULL, "brushtype");
00412     RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
00413     RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
00414     RNA_def_property_ui_text(prop, "Tool", "");
00415 
00416     prop= RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
00417     RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
00418     RNA_def_property_enum_items(prop, select_mode_items);
00419     RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
00420     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
00421 
00422     prop= RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
00423     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
00424     RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
00425 
00426     prop= RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
00427     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
00428     RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
00429 
00430     prop= RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
00431     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
00432     RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
00433 
00434     prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
00435     RNA_def_property_float_sdna(prop, NULL, "emitterdist");
00436     RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
00437     RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");
00438 
00439     prop= RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
00440     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
00441     RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
00442     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
00443 
00444     prop= RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
00445     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
00446     RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
00447 
00448     prop= RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
00449     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
00450     RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
00451     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
00452 
00453     prop= RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
00454     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
00455     RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");
00456 
00457     prop= RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
00458     RNA_def_property_int_sdna(prop, NULL, "totaddkey");
00459     RNA_def_property_range(prop, 2, SHRT_MAX);
00460     RNA_def_property_ui_range(prop, 2, 20, 10, 3);
00461     RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
00462 
00463     prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
00464     RNA_def_property_struct_type(prop, "ParticleBrush");
00465     RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
00466     RNA_def_property_ui_text(prop, "Brush", "");
00467 
00468     prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
00469     RNA_def_property_range(prop, 2, 10);
00470     RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with");
00471     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
00472 
00473     prop= RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
00474     RNA_def_property_range(prop, 2, 100);
00475     RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
00476     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
00477 
00478     prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
00479     RNA_def_property_enum_sdna(prop, NULL, "edittype");
00480     RNA_def_property_enum_items(prop, edit_type_items);
00481     RNA_def_property_ui_text(prop, "Type", "");
00482     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
00483 
00484     prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
00485     RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
00486     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00487     RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
00488 
00489     prop= RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
00490     RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
00491     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00492     RNA_def_property_ui_text(prop, "Hair", "Editing hair");
00493 
00494     prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
00495     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00496     RNA_def_property_ui_text(prop, "Object", "The edited object");
00497 
00498 
00499     /* brush */
00500 
00501     srna= RNA_def_struct(brna, "ParticleBrush", NULL);
00502     RNA_def_struct_sdna(srna, "ParticleBrushData");
00503     RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
00504 
00505     prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
00506     RNA_def_property_range(prop, 1, SHRT_MAX);
00507     RNA_def_property_ui_range(prop, 1, 100, 10, 3);
00508     RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
00509 
00510     prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
00511     RNA_def_property_range(prop, 0.001, 1.0);
00512     RNA_def_property_ui_text(prop, "Strength", "Brush strength");
00513 
00514     prop= RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
00515     RNA_def_property_range(prop, 1, 1000);
00516     RNA_def_property_ui_range(prop, 1, 100, 10, 3);
00517     RNA_def_property_ui_text(prop, "Count", "Particle count");
00518 
00519     prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
00520     RNA_def_property_int_sdna(prop, NULL, "step");
00521     RNA_def_property_range(prop, 1, SHRT_MAX);
00522     RNA_def_property_ui_range(prop, 1, 50, 10, 3);
00523     RNA_def_property_ui_text(prop, "Steps", "Brush steps");
00524 
00525     prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
00526     RNA_def_property_enum_sdna(prop, NULL, "invert");
00527     RNA_def_property_enum_items(prop, puff_mode);
00528     RNA_def_property_ui_text(prop, "Puff Mode", "");
00529 
00530     prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
00531     RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
00532     RNA_def_property_ui_text(prop, "Puff Volume",
00533                              "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
00534 
00535     prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
00536     RNA_def_property_enum_sdna(prop, NULL, "invert");
00537     RNA_def_property_enum_items(prop, length_mode);
00538     RNA_def_property_ui_text(prop, "Length Mode", "");
00539 
00540     /* dummy */
00541     prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
00542     RNA_def_property_struct_type(prop, "CurveMapping");
00543     RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
00544     RNA_def_property_ui_text(prop, "Curve", "");
00545 }
00546 
00547 void RNA_def_sculpt_paint(BlenderRNA *brna)
00548 {
00549     rna_def_paint(brna);
00550     rna_def_sculpt(brna);
00551     rna_def_vertex_paint(brna);
00552     rna_def_image_paint(brna);
00553     rna_def_particle_edit(brna);
00554 }
00555 
00556 #endif
00557