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