- draw mesh wire faded into the 3D view background color when in particle mode, the...
[blender.git] / source / blender / makesrna / intern / rna_sculpt_paint.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * Contributor(s): Campbell Barton
21  *
22  * ***** END GPL LICENSE BLOCK *****
23  */
24
25 #include <stdlib.h>
26
27 #include "RNA_define.h"
28 #include "RNA_types.h"
29
30 #include "rna_internal.h"
31
32 #include "DNA_ID.h"
33 #include "DNA_scene_types.h"
34
35 #include "BKE_paint.h"
36
37 #include "WM_types.h"
38
39 static EnumPropertyItem particle_edit_hair_brush_items[] = {
40         {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush."},
41         {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs."},
42         {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs."},
43         {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs."},
44         {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter."},
45         {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up."},
46         {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs."},
47         {0, NULL, 0, NULL, NULL}};
48
49 #ifdef RNA_RUNTIME
50
51 #include "BKE_context.h"
52 #include "BKE_pointcache.h"
53 #include "BKE_particle.h"
54 #include "BKE_depsgraph.h"
55
56 #include "ED_particle.h"
57
58 static EnumPropertyItem particle_edit_cache_brush_items[] = {
59         {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush."},
60         {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths."},
61         {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths."},
62         {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter."},
63         {0, NULL, 0, NULL, NULL}};
64
65 static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
66 {
67         ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
68         ParticleBrushData *brush= NULL;;
69
70         if(pset->brushtype != PE_BRUSH_NONE)
71                 brush= &pset->brush[pset->brushtype];
72
73         return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
74 }
75
76 static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
77 {
78         return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
79 }
80
81 static void rna_Paint_brushes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
82 {
83         Paint *p= (Paint*)ptr->data;
84         rna_iterator_array_begin(iter, (void*)p->brushes, sizeof(Brush*), p->brush_count, 0, NULL);
85 }
86
87 static int rna_Paint_brushes_length(PointerRNA *ptr)
88 {
89         Paint *p= (Paint*)ptr->data;
90
91         return p->brush_count;
92 }
93
94 static PointerRNA rna_Paint_active_brush_get(PointerRNA *ptr)
95 {
96         return rna_pointer_inherit_refine(ptr, &RNA_Brush, paint_brush(ptr->data));
97 }
98
99 static void rna_Paint_active_brush_set(PointerRNA *ptr, PointerRNA value)
100 {
101         paint_brush_set(ptr->data, value.data);
102 }
103
104 static void rna_ParticleEdit_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
105 {
106         Object *ob= (scene->basact)? scene->basact->object: NULL;
107         PTCacheEdit *edit = PE_get_current(scene, ob);
108
109         if(!edit)
110                 return;
111
112         psys_free_path_cache(edit->psys, edit);
113 }
114
115 static void rna_ParticleEdit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
116 {
117         Object *ob= (scene->basact)? scene->basact->object: NULL;
118
119         if(ob) DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
120 }
121
122 static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *ptr, int *free)
123 {
124         Scene *scene= CTX_data_scene(C);
125         Object *ob= (scene->basact)? scene->basact->object: NULL;
126         PTCacheEdit *edit = PE_get_current(scene, ob);
127         
128         if(edit && edit->psys)
129                 return particle_edit_hair_brush_items;
130
131         return particle_edit_cache_brush_items;
132 }
133
134 static int rna_ParticleEdit_editable_get(PointerRNA *ptr)
135 {
136         ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
137
138         return (pset->object && PE_get_current(pset->scene, pset->object));
139 }
140 static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
141 {
142         ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
143
144         PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
145
146         return (edit && edit->psys);
147 }
148
149 static void rna_Paint_active_brush_index_set(PointerRNA *ptr, int value)
150 {
151         Paint *p= ptr->data;
152         CLAMP(value, 0, p->brush_count-1);
153         p->active_brush_index= value;
154 }
155
156 static void rna_Paint_active_brush_index_range(PointerRNA *ptr, int *min, int *max)
157 {
158         Paint *p= ptr->data;
159         *min= 0;
160         *max= MAX2(p->brush_count-1, 0);
161 }
162
163 static void rna_Paint_active_brush_name_get(PointerRNA *ptr, char *value)
164 {
165         Paint *p= ptr->data;
166         Brush *br = paint_brush(p);
167         
168         BLI_strncpy(value, br->id.name+2, sizeof(br->id.name-2));
169 }
170
171
172 static int rna_Paint_active_brush_name_length(PointerRNA *ptr)
173 {
174         Paint *p= ptr->data;
175         Brush *br = paint_brush(p);
176         return strlen(br->id.name+2);
177 }
178
179 static void rna_Paint_active_brush_name_set(PointerRNA *ptr, const char *value)
180 {
181         Paint *p= ptr->data;
182         Brush *br;
183         int i;
184         
185         for(i = 0; i < p->brush_count; ++i) {
186                 br = p->brushes[i];
187         
188                 if (strcmp(br->id.name+2, value)==0) {
189                         paint_brush_set(p, br);
190                         return;
191                 }
192         }
193 }
194
195 #else
196
197 static void rna_def_paint(BlenderRNA *brna)
198 {
199         StructRNA *srna;
200         PropertyRNA *prop;
201
202         srna= RNA_def_struct(brna, "Paint", NULL);
203         RNA_def_struct_ui_text(srna, "Paint", "");
204
205         prop= RNA_def_property(srna, "brushes", PROP_COLLECTION, PROP_NONE);
206         RNA_def_property_struct_type(prop, "Brush");
207         RNA_def_property_collection_funcs(prop, "rna_Paint_brushes_begin",
208                                           "rna_iterator_array_next",
209                                           "rna_iterator_array_end",
210                                           "rna_iterator_array_dereference_get", 
211                                           "rna_Paint_brushes_length", 0, 0);
212         RNA_def_property_ui_text(prop, "Brushes", "Brushes selected for this paint mode.");
213
214         prop= RNA_def_property(srna, "active_brush_index", PROP_INT, PROP_NONE);
215         RNA_def_property_int_funcs(prop, NULL, "rna_Paint_active_brush_index_set", "rna_Paint_active_brush_index_range");
216         RNA_def_property_range(prop, 0, INT_MAX);
217         RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
218         
219         prop= RNA_def_property(srna, "active_brush_name", PROP_STRING, PROP_NONE);
220         RNA_def_property_string_funcs(prop, "rna_Paint_active_brush_name_get", "rna_Paint_active_brush_name_length", "rna_Paint_active_brush_name_set");
221         RNA_def_property_string_maxlength(prop, sizeof(((ID*)NULL)->name)-2);
222         RNA_def_property_ui_text(prop, "Active Brush Name", "");
223         RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
224
225         /* Fake property to get active brush directly, rather than integer index */
226         prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
227         RNA_def_property_struct_type(prop, "Brush");
228         RNA_def_property_pointer_funcs(prop, "rna_Paint_active_brush_get", "rna_Paint_active_brush_set", NULL);
229         RNA_def_property_flag(prop, PROP_EDITABLE);
230         RNA_def_property_ui_text(prop, "Brush", "Active paint brush.");
231         RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
232
233         prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
234         RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
235         RNA_def_property_ui_text(prop, "Show Brush", "");
236
237         prop= RNA_def_property(srna, "fast_navigate", PROP_BOOLEAN, PROP_NONE);
238         RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
239         RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view.");
240 }
241
242 static void rna_def_sculpt(BlenderRNA  *brna)
243 {
244         StructRNA *srna;
245         PropertyRNA *prop;
246
247         srna= RNA_def_struct(brna, "Sculpt", "Paint");
248         RNA_def_struct_ui_text(srna, "Sculpt", "");
249         
250         prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE);
251         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);
252         RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis.");
253
254         prop= RNA_def_property(srna, "symmetry_y", PROP_BOOLEAN, PROP_NONE);
255         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y);
256         RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis.");
257
258         prop= RNA_def_property(srna, "symmetry_z", PROP_BOOLEAN, PROP_NONE);
259         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z);
260         RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis.");
261
262         prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
263         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
264         RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices.");
265
266         prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
267         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
268         RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices.");
269
270         prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
271         RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
272         RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices.");
273 }
274
275 static void rna_def_vertex_paint(BlenderRNA *brna)
276 {
277         StructRNA *srna;
278         PropertyRNA *prop;
279         static EnumPropertyItem brush_mode_items[] = {
280                 {0, "MIX", 0, "Mix", "Use mix blending mode while painting."},
281                 {1, "ADD", 0, "Add", "Use add blending mode while painting."},
282                 {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting."},
283                 {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting."},
284                 {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"},
285                 {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting."},
286                 {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."},
287                 {0, NULL, 0, NULL, NULL}};
288         
289         srna= RNA_def_struct(brna, "VertexPaint", "Paint");
290         RNA_def_struct_sdna(srna, "VPaint");
291         RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode.");
292     
293         prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
294         RNA_def_property_enum_items(prop, brush_mode_items);
295         RNA_def_property_ui_text(prop, "Brush Mode", "Mode in which color is painted.");
296         
297         prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE);
298         RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA);
299         RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush.");
300                 
301         prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE);
302         RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS);
303         RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting.");
304         
305         prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE);
306         RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY);
307         RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse.");
308 }
309
310 static void rna_def_image_paint(BlenderRNA *brna)
311 {
312         StructRNA *srna;
313         PropertyRNA *prop;
314
315         static EnumPropertyItem tool_items[] = {
316                 {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
317                 {PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", ""},
318                 {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", ""},
319                 {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""},
320                 {0, NULL, 0, NULL, NULL}};
321         
322         srna= RNA_def_struct(brna, "ImagePaint", "Paint");
323         RNA_def_struct_sdna(srna, "ImagePaintSettings");
324         RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode.");
325  
326         prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
327         RNA_def_property_enum_items(prop, tool_items);
328         RNA_def_property_ui_text(prop, "Tool", "");
329
330         /* booleans */
331
332         prop= RNA_def_property(srna, "show_brush_draw", PROP_BOOLEAN, PROP_NONE);
333         RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL);
334         RNA_def_property_ui_text(prop, "Show Brush Draw", "Enables brush shape while drawing.");
335
336         prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
337         RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL_DRAWING);
338         RNA_def_property_ui_text(prop, "Show Brush", "Enables brush shape while not drawing.");
339                 
340         prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE);
341         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE);
342         RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes.");
343         
344         prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
345         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
346         RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
347         
348         prop= RNA_def_property(srna, "use_backface_cull", PROP_BOOLEAN, PROP_NONE);
349         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
350         RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
351         
352         prop= RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
353         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
354         RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
355         
356         prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
357         RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
358         RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons");
359         
360         prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
361         RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
362         RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
363         
364         prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
365         RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
366         RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source");
367         
368         /* integers */
369         
370         prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED);
371         RNA_def_property_ui_range(prop, 0, 8, 0, 0);
372         RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower).");
373
374         prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
375         RNA_def_property_range(prop, 0, 90);
376         RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view acording to this angle.");
377 }
378
379 static void rna_def_particle_edit(BlenderRNA *brna)
380 {
381         StructRNA *srna;
382         PropertyRNA *prop;
383
384         static EnumPropertyItem select_mode_items[] = {
385                 {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
386                 {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
387                 {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
388                 {0, NULL, 0, NULL, NULL}};
389
390         static EnumPropertyItem puff_mode[] = {
391                 {0, "ADD", 0, "Add", "Make hairs more puffy."},
392                 {1, "SUB", 0, "Sub", "Make hairs less puffy."},
393                 {0, NULL, 0, NULL, NULL}};
394
395         static EnumPropertyItem length_mode[] = {
396                 {0, "GROW", 0, "Grow", "Make hairs longer."},
397                 {1, "SHRINK", 0, "Shrink", "Make hairs shorter."},
398                 {0, NULL, 0, NULL, NULL}};
399
400         static EnumPropertyItem edit_type_items[]= {
401                 {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
402                 {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
403                 {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
404                 {0, NULL, 0, NULL, NULL}
405         };
406
407
408         /* edit */
409
410         srna= RNA_def_struct(brna, "ParticleEdit", NULL);
411         RNA_def_struct_sdna(srna, "ParticleEditSettings");
412         RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode.");
413
414         prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
415         RNA_def_property_enum_sdna(prop, NULL, "brushtype");
416         RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
417         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ParticleEdit_tool_itemf");
418         RNA_def_property_ui_text(prop, "Tool", "");
419
420         prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE);
421         RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
422         RNA_def_property_enum_items(prop, select_mode_items);
423         RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode.");
424         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
425
426         prop= RNA_def_property(srna, "keep_lengths", PROP_BOOLEAN, PROP_NONE);
427         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
428         RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant.");
429
430         prop= RNA_def_property(srna, "keep_root", PROP_BOOLEAN, PROP_NONE);
431         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
432         RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified.");
433
434         prop= RNA_def_property(srna, "emitter_deflect", PROP_BOOLEAN, PROP_NONE);
435         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
436         RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter.");
437
438         prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
439         RNA_def_property_float_sdna(prop, NULL, "emitterdist");
440         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
441         RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter.");
442
443         prop= RNA_def_property(srna, "fade_time", PROP_BOOLEAN, PROP_NONE);
444         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
445         RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame.");
446         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
447
448         prop= RNA_def_property(srna, "auto_velocity", PROP_BOOLEAN, PROP_NONE);
449         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
450         RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically.");
451
452         prop= RNA_def_property(srna, "draw_particles", PROP_BOOLEAN, PROP_NONE);
453         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
454         RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles.");
455         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
456
457         prop= RNA_def_property(srna, "add_interpolate", PROP_BOOLEAN, PROP_NONE);
458         RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
459         RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones.");
460
461         prop= RNA_def_property(srna, "add_keys", PROP_INT, PROP_NONE);
462         RNA_def_property_int_sdna(prop, NULL, "totaddkey");
463         RNA_def_property_range(prop, 2, INT_MAX);
464         RNA_def_property_ui_range(prop, 2, 20, 10, 3);
465         RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with.");
466
467         prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
468         RNA_def_property_struct_type(prop, "ParticleBrush");
469         RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL);
470         RNA_def_property_ui_text(prop, "Brush", "");
471
472         prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
473         RNA_def_property_range(prop, 2, 10);
474         RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with.");
475         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
476
477         prop= RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
478         RNA_def_property_range(prop, 2, 100);
479         RNA_def_property_ui_text(prop, "Frames", "How many frames to fade.");
480         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
481
482         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
483         RNA_def_property_enum_sdna(prop, NULL, "edittype");
484         RNA_def_property_enum_items(prop, edit_type_items);
485         RNA_def_property_ui_text(prop, "Type", "");
486         RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
487
488         prop= RNA_def_property(srna, "editable", PROP_BOOLEAN, PROP_NONE);
489         RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
490         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
491         RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
492
493         prop= RNA_def_property(srna, "hair", PROP_BOOLEAN, PROP_NONE);
494         RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
495         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
496         RNA_def_property_ui_text(prop, "Hair", "Editing hair");
497
498         prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
499         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
500         RNA_def_property_ui_text(prop, "Object", "The edited object");
501
502
503         /* brush */
504
505         srna= RNA_def_struct(brna, "ParticleBrush", NULL);
506         RNA_def_struct_sdna(srna, "ParticleBrushData");
507         RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush.");
508
509         prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
510         RNA_def_property_range(prop, 1, INT_MAX);
511         RNA_def_property_ui_range(prop, 1, 100, 10, 3);
512         RNA_def_property_ui_text(prop, "Size", "Brush size.");
513
514         prop= RNA_def_property(srna, "strength", PROP_INT, PROP_NONE);
515         RNA_def_property_range(prop, 1, INT_MAX);
516         RNA_def_property_ui_range(prop, 1, 100, 10, 3);
517         RNA_def_property_ui_text(prop, "Strength", "Brush strength.");
518
519         prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
520         RNA_def_property_int_sdna(prop, NULL, "step");
521         RNA_def_property_range(prop, 1, INT_MAX);
522         RNA_def_property_ui_range(prop, 1, 50, 10, 3);
523         RNA_def_property_ui_text(prop, "Steps", "Brush steps.");
524
525         prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
526         RNA_def_property_enum_sdna(prop, NULL, "invert");
527         RNA_def_property_enum_items(prop, puff_mode);
528         RNA_def_property_ui_text(prop, "Puff Mode", "");
529
530         prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
531         RNA_def_property_enum_sdna(prop, NULL, "invert");
532         RNA_def_property_enum_items(prop, length_mode);
533         RNA_def_property_ui_text(prop, "Length Mode", "");
534
535         /* dummy */
536         prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
537         RNA_def_property_struct_type(prop, "CurveMapping");
538         RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL);
539         RNA_def_property_ui_text(prop, "Curve", "");
540 }
541
542 void RNA_def_sculpt_paint(BlenderRNA *brna)
543 {
544         rna_def_paint(brna);
545         rna_def_sculpt(brna);
546         rna_def_vertex_paint(brna);
547         rna_def_image_paint(brna);
548         rna_def_particle_edit(brna);
549 }
550
551 #endif
552