2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Campbell Barton
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_sculpt_paint.c
30 #include "RNA_define.h"
32 #include "rna_internal.h"
35 #include "DNA_scene_types.h"
36 #include "DNA_brush_types.h"
37 #include "DNA_screen_types.h"
38 #include "DNA_space_types.h"
40 #include "BKE_paint.h"
41 #include "BKE_material.h"
48 #include "BLI_utildefines.h"
51 static EnumPropertyItem particle_edit_hair_brush_items[] = {
52 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
53 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
54 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
55 {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
56 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
57 {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
58 {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
59 {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
60 {0, NULL, 0, NULL, NULL}
63 EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
64 {GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"},
65 {GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"},
66 { GP_EDITBRUSH_TYPE_STRENGTH, "STRENGTH", 0, "Strength", "Adjust color strength of strokes" },
67 { GP_EDITBRUSH_TYPE_GRAB, "GRAB", 0, "Grab", "Translate the set of points initially within the brush circle" },
68 {GP_EDITBRUSH_TYPE_PUSH, "PUSH", 0, "Push", "Move points out of the way, as if combing them"},
69 {GP_EDITBRUSH_TYPE_TWIST, "TWIST", 0, "Twist", "Rotate points around the midpoint of the brush"},
70 {GP_EDITBRUSH_TYPE_PINCH, "PINCH", 0, "Pinch", "Pull points towards the midpoint of the brush"},
71 {GP_EDITBRUSH_TYPE_RANDOMIZE, "RANDOMIZE", 0, "Randomize", "Introduce jitter/randomness into strokes"},
72 //{GP_EDITBRUSH_TYPE_SUBDIVIDE, "SUBDIVIDE", 0, "Subdivide", "Increase point density for higher resolution strokes when zoomed in"},
73 //{GP_EDITBRUSH_TYPE_SIMPLIFY, "SIMPLIFY", 0, "Simplify", "Reduce density of stroke points"},
74 {GP_EDITBRUSH_TYPE_CLONE, "CLONE", 0, "Clone", "Paste copies of the strokes stored on the clipboard"},
75 { 0, NULL, 0, NULL, NULL }
78 EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
79 {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""},
80 {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""},
82 {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""},
83 {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""},
85 {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""},
86 {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""},
87 {0, NULL, 0, NULL, NULL},
91 #include "MEM_guardedalloc.h"
93 #include "BKE_context.h"
94 #include "BKE_DerivedMesh.h"
95 #include "BKE_pointcache.h"
96 #include "BKE_particle.h"
97 #include "BKE_depsgraph.h"
100 #include "GPU_buffers.h"
102 #include "ED_particle.h"
104 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
106 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
109 static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = {
110 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
111 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
112 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
113 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
114 {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
115 {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
116 {0, NULL, 0, NULL, NULL}
119 static EnumPropertyItem particle_edit_cache_brush_items[] = {
120 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
121 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
122 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
123 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
124 {0, NULL, 0, NULL, NULL}
127 static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
129 ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
130 ParticleBrushData *brush = NULL;
132 if (pset->brushtype != PE_BRUSH_NONE)
133 brush = &pset->brush[pset->brushtype];
135 return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
138 static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
140 return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
143 static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
145 Object *ob = (scene->basact) ? scene->basact->object : NULL;
146 PTCacheEdit *edit = PE_get_current(scene, ob);
151 psys_free_path_cache(edit->psys, edit);
154 static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
156 Object *ob = (scene->basact) ? scene->basact->object : NULL;
158 if (ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
160 static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
162 ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
164 /* redraw hair completely if weight brush is/was used */
165 if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) {
166 Object *ob = (pset->scene->basact) ? pset->scene->basact->object : NULL;
168 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
169 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
173 pset->brushtype = value;
175 static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr),
176 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
178 Scene *scene = CTX_data_scene(C);
179 Object *ob = (scene->basact) ? scene->basact->object : NULL;
181 PTCacheEdit *edit = PE_get_current(scene, ob);
182 ParticleSystem *psys = edit ? edit->psys : NULL;
184 /* use this rather than PE_get_current() - because the editing cache is
185 * dependent on the cache being updated which can happen after this UI
186 * draws causing a glitch [#28883] */
187 ParticleSystem *psys = psys_get_current(ob);
191 if (psys->flag & PSYS_GLOBAL_HAIR) {
192 return particle_edit_disconnected_hair_brush_items;
195 return particle_edit_hair_brush_items;
199 return particle_edit_cache_brush_items;
202 static int rna_ParticleEdit_editable_get(PointerRNA *ptr)
204 ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
206 return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
208 static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
210 ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
213 PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
215 return (edit && edit->psys);
221 static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr))
223 return BLI_strdup("tool_settings.particle_edit");
226 static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
228 Scene *scene = (Scene *)ptr->id.data;
229 ToolSettings *ts = scene->toolsettings;
230 Brush *brush = value.id.data;
233 /* check the origin of the Paint struct to see which paint
234 * mode to select from */
236 if (ptr->data == &ts->imapaint)
237 mode = OB_MODE_TEXTURE_PAINT;
238 else if (ptr->data == ts->sculpt)
239 mode = OB_MODE_SCULPT;
240 else if (ptr->data == ts->vpaint)
241 mode = OB_MODE_VERTEX_PAINT;
242 else if (ptr->data == ts->wpaint)
243 mode = OB_MODE_WEIGHT_PAINT;
245 return brush->ob_mode & mode;
248 static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
250 Object *ob = (scene->basact) ? scene->basact->object : NULL;
253 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
254 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
257 ob->sculpt->bm_smooth_shading = ((scene->toolsettings->sculpt->flags &
258 SCULPT_DYNTOPO_SMOOTH_SHADING) != 0);
263 static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
265 Object *ob = (scene->basact) ? scene->basact->object : NULL;
267 if (ob && ob->sculpt) {
268 Sculpt *sd = scene->toolsettings->sculpt;
269 ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0);
271 if (ob->sculpt->pbvh)
272 pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color);
274 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
278 static char *rna_Sculpt_path(PointerRNA *UNUSED(ptr))
280 return BLI_strdup("tool_settings.sculpt");
283 static char *rna_VertexPaint_path(PointerRNA *ptr)
285 Scene *scene = (Scene *)ptr->id.data;
286 ToolSettings *ts = scene->toolsettings;
287 if (ptr->data == ts->vpaint) {
288 return BLI_strdup("tool_settings.vertex_paint");
291 return BLI_strdup("tool_settings.weight_paint");
295 static char *rna_ImagePaintSettings_path(PointerRNA *UNUSED(ptr))
297 return BLI_strdup("tool_settings.image_paint");
300 static char *rna_UvSculpt_path(PointerRNA *UNUSED(ptr))
302 return BLI_strdup("tool_settings.uv_sculpt");
305 static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr))
307 return BLI_strdup("tool_settings.particle_edit.brush");
310 static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
312 Paint *paint = ptr->data;
313 Brush *br = paint->brush;
314 BKE_paint_invalidate_overlay_all();
315 WM_main_add_notifier(NC_BRUSH | NA_SELECTED, br);
318 static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
320 /* not the best solution maybe, but will refresh the 3D viewport */
321 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
324 static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
328 if (ob && ob->type == OB_MESH) {
329 /* of course we need to invalidate here */
330 BKE_texpaint_slots_refresh_object(scene, ob);
332 /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */
333 GPU_drawobject_free(ob->derivedFinal);
334 BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
335 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
339 static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
343 if (ob && ob->type == OB_MESH) {
344 GPU_drawobject_free(ob->derivedFinal);
345 BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
346 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
350 static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
354 Image *ima = scene->toolsettings->imapaint.canvas;
356 for (sc = bmain->screen.first; sc; sc = sc->id.next) {
358 for (sa = sc->areabase.first; sa; sa = sa->next) {
360 for (sl = sa->spacedata.first; sl; sl = sl->next) {
361 if (sl->spacetype == SPACE_IMAGE) {
362 SpaceImage *sima = (SpaceImage *)sl;
365 ED_space_image_set(sima, scene, scene->obedit, ima);
371 if (ob && ob->type == OB_MESH) {
372 GPU_drawobject_free(ob->derivedFinal);
373 BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
374 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
378 static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint)
380 return imapaint->missing_data == 0;
384 static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr)
386 GP_BrushEdit_Settings *gset = (GP_BrushEdit_Settings *)ptr->data;
387 GP_EditBrush_Data *brush = NULL;
389 if ((gset->brushtype >= 0) && (gset->brushtype < TOT_GP_EDITBRUSH_TYPES))
390 brush = &gset->brush[gset->brushtype];
392 return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush);
395 static char *rna_GPencilSculptSettings_path(PointerRNA *UNUSED(ptr))
397 return BLI_strdup("tool_settings.gpencil_sculpt");
400 static char *rna_GPencilSculptBrush_path(PointerRNA *UNUSED(ptr))
402 return BLI_strdup("tool_settings.gpencil_sculpt.brush");
408 static void rna_def_paint_curve(BlenderRNA *brna)
412 srna = RNA_def_struct(brna, "PaintCurve", "ID");
413 RNA_def_struct_ui_text(srna, "Paint Curve", "");
414 RNA_def_struct_ui_icon(srna, ICON_CURVE_BEZCURVE);
418 static void rna_def_paint(BlenderRNA *brna)
423 srna = RNA_def_struct(brna, "Paint", NULL);
424 RNA_def_struct_ui_text(srna, "Paint", "");
426 /* Global Settings */
427 prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
428 RNA_def_property_flag(prop, PROP_EDITABLE);
429 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
430 RNA_def_property_ui_text(prop, "Brush", "Active Brush");
431 RNA_def_property_update(prop, 0, "rna_Paint_brush_update");
433 prop = RNA_def_property(srna, "palette", PROP_POINTER, PROP_NONE);
434 RNA_def_property_flag(prop, PROP_EDITABLE);
435 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, NULL);
436 RNA_def_property_ui_text(prop, "Palette", "Active Palette");
438 prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
439 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
440 RNA_def_property_ui_text(prop, "Show Brush", "");
441 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
443 prop = RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
444 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE);
445 RNA_def_property_ui_text(prop, "Show Brush On Surface", "");
446 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
448 prop = RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
449 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
450 RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view");
451 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
453 prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_UNSIGNED);
454 RNA_def_property_int_sdna(prop, NULL, "num_input_samples");
455 RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1);
456 RNA_def_property_ui_text(prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke");
457 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
459 prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
460 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_X);
461 RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
462 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
464 prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
465 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Y);
466 RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
467 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
469 prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
470 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Z);
471 RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
472 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
474 prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
475 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMMETRY_FEATHER);
476 RNA_def_property_ui_text(prop, "Symmetry Feathering",
477 "Reduce the strength of the brush where it overlaps symmetrical daubs");
478 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
480 prop = RNA_def_property(srna, "cavity_curve", PROP_POINTER, PROP_NONE);
481 RNA_def_property_flag(prop, PROP_NEVER_NULL);
482 RNA_def_property_ui_text(prop, "Curve", "Editable cavity curve");
483 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
485 prop = RNA_def_property(srna, "use_cavity", PROP_BOOLEAN, PROP_NONE);
486 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_USE_CAVITY_MASK);
487 RNA_def_property_ui_text(prop, "Cavity Mask", "Mask painting according to mesh geometry cavity");
488 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
490 prop = RNA_def_property(srna, "tile_offset", PROP_FLOAT, PROP_XYZ);
491 RNA_def_property_float_sdna(prop, NULL, "tile_offset");
492 RNA_def_property_array(prop, 3);
493 RNA_def_property_range(prop, 0.01, FLT_MAX);
494 RNA_def_property_ui_range(prop, 0.01, 100, 1 * 100, 2);
495 RNA_def_property_ui_text(prop, "Tiling offset for the X Axis",
496 "Stride at which tiled strokes are copied");
498 prop = RNA_def_property(srna, "tile_x", PROP_BOOLEAN, PROP_NONE);
499 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_X);
500 RNA_def_property_ui_text(prop, "Tile X", "Tile along X axis");
501 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
503 prop = RNA_def_property(srna, "tile_y", PROP_BOOLEAN, PROP_NONE);
504 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Y);
505 RNA_def_property_ui_text(prop, "Tile Y", "Tile along Y axis");
506 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
508 prop = RNA_def_property(srna, "tile_z", PROP_BOOLEAN, PROP_NONE);
509 RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Z);
510 RNA_def_property_ui_text(prop, "Tile Z", "Tile along Z axis");
511 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
514 static void rna_def_sculpt(BlenderRNA *brna)
516 static EnumPropertyItem detail_refine_items[] = {
517 {SCULPT_DYNTOPO_SUBDIVIDE, "SUBDIVIDE", 0,
518 "Subdivide Edges", "Subdivide long edges to add mesh detail where needed"},
519 {SCULPT_DYNTOPO_COLLAPSE, "COLLAPSE", 0,
520 "Collapse Edges", "Collapse short edges to remove mesh detail where possible"},
521 {SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
522 "Subdivide Collapse", "Both subdivide long edges and collapse short edges to refine mesh detail"},
523 {0, NULL, 0, NULL, NULL}
526 static EnumPropertyItem detail_type_items[] = {
528 "Relative Detail", "Mesh detail is relative to the brush size and detail size"},
529 {SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0,
530 "Constant Detail", "Mesh detail is constant in object space according to detail size"},
531 {SCULPT_DYNTOPO_DETAIL_BRUSH, "BRUSH", 0,
532 "Brush Detail", "Mesh detail is relative to brush radius"},
533 {0, NULL, 0, NULL, NULL}
539 srna = RNA_def_struct(brna, "Sculpt", "Paint");
540 RNA_def_struct_path_func(srna, "rna_Sculpt_path");
541 RNA_def_struct_ui_text(srna, "Sculpt", "");
543 prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
544 RNA_def_property_int_sdna(prop, NULL, "radial_symm");
545 RNA_def_property_int_default(prop, 1);
546 RNA_def_property_range(prop, 1, 64);
547 RNA_def_property_ui_range(prop, 0, 32, 1, 1);
548 RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
549 "Number of times to copy strokes across the surface");
551 prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
552 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
553 RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
554 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
556 prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
557 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
558 RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
559 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
561 prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
562 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
563 RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
564 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
566 prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
567 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
568 RNA_def_property_ui_text(prop, "Use OpenMP",
569 "Take advantage of multiple CPU cores to improve sculpting performance");
570 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
572 prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
573 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
574 RNA_def_property_ui_text(prop, "Use Deform Only",
575 "Use only deformation modifiers (temporary disable all "
576 "constructive modifiers except multi-resolution)");
577 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
579 prop = RNA_def_property(srna, "show_diffuse_color", PROP_BOOLEAN, PROP_NONE);
580 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SHOW_DIFFUSE);
581 RNA_def_property_ui_text(prop, "Show Diffuse Color",
582 "Show diffuse color of object and overlay sculpt mask on top of it");
583 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
585 prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_PIXEL);
586 RNA_def_property_ui_range(prop, 0.5, 40.0, 10, 2);
587 RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)");
588 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
590 prop = RNA_def_property(srna, "detail_percent", PROP_FLOAT, PROP_PERCENTAGE);
591 RNA_def_property_ui_range(prop, 0.5, 100.0, 10, 2);
592 RNA_def_property_ui_text(prop, "Detail Percentage", "Maximum edge length for dynamic topology sculpting (in brush percenage)");
593 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
595 prop = RNA_def_property(srna, "constant_detail", PROP_FLOAT, PROP_PERCENTAGE);
596 RNA_def_property_range(prop, 0.001, 10000.0);
597 RNA_def_property_ui_range(prop, 0.1, 100.0, 10, 2);
598 RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (as percentage of blender unit)");
599 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
601 prop = RNA_def_property(srna, "use_smooth_shading", PROP_BOOLEAN, PROP_NONE);
602 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING);
603 RNA_def_property_ui_text(prop, "Smooth Shading",
604 "Show faces in dynamic-topology mode with smooth "
605 "shading rather than flat shaded");
606 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
608 prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE);
609 RNA_def_property_enum_items(prop, rna_enum_symmetrize_direction_items);
610 RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator");
612 prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE);
613 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
614 RNA_def_property_enum_items(prop, detail_refine_items);
615 RNA_def_property_ui_text(prop, "Detail Refine Method",
616 "In dynamic-topology mode, how to add or remove mesh detail");
617 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
619 prop = RNA_def_property(srna, "detail_type_method", PROP_ENUM, PROP_NONE);
620 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
621 RNA_def_property_enum_items(prop, detail_type_items);
622 RNA_def_property_ui_text(prop, "Detail Type Method",
623 "In dynamic-topology mode, how mesh detail size is calculated");
624 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
626 prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
627 RNA_def_property_float_sdna(prop, NULL, "gravity_factor");
628 RNA_def_property_range(prop, 0.0f, 1.0f);
629 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
630 RNA_def_property_ui_text(prop, "Gravity", "Amount of gravity after each dab");
631 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
633 prop = RNA_def_property(srna, "gravity_object", PROP_POINTER, PROP_NONE);
634 RNA_def_property_flag(prop, PROP_EDITABLE);
635 RNA_def_property_ui_text(prop, "Orientation", "Object whose Z axis defines orientation of gravity");
636 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
640 static void rna_def_uv_sculpt(BlenderRNA *brna)
644 srna = RNA_def_struct(brna, "UvSculpt", "Paint");
645 RNA_def_struct_path_func(srna, "rna_UvSculpt_path");
646 RNA_def_struct_ui_text(srna, "UV Sculpting", "");
650 /* use for weight paint too */
651 static void rna_def_vertex_paint(BlenderRNA *brna)
656 srna = RNA_def_struct(brna, "VertexPaint", "Paint");
657 RNA_def_struct_sdna(srna, "VPaint");
658 RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
659 RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
661 /* vertex paint only */
662 prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
663 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS);
664 RNA_def_property_ui_text(prop, "Normals", "Apply the vertex normal before painting");
665 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
667 prop = RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE);
668 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY);
669 RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse");
670 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
672 /* weight paint only */
673 prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
674 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_ONLYVGROUP);
675 RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to vertices in the group");
676 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
679 static void rna_def_image_paint(BlenderRNA *brna)
685 static EnumPropertyItem paint_type_items[] = {
686 {IMAGEPAINT_MODE_MATERIAL, "MATERIAL", 0,
687 "Material", "Detect image slots from the material"},
688 {IMAGEPAINT_MODE_IMAGE, "IMAGE", 0,
689 "Image", "Set image for texture painting directly"},
690 {0, NULL, 0, NULL, NULL}
693 srna = RNA_def_struct(brna, "ImagePaint", "Paint");
694 RNA_def_struct_sdna(srna, "ImagePaintSettings");
695 RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path");
696 RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
699 func = RNA_def_function(srna, "detect_data", "rna_ImaPaint_detect_data");
700 RNA_def_function_ui_description(func, "Check if required texpaint data exist");
703 RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
706 prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
707 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
708 RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
709 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
711 prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
712 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
713 RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
714 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
716 prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
717 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
718 RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
719 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
721 prop = RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
722 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
723 RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
724 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
726 prop = RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
727 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
728 RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
729 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
731 prop = RNA_def_property(srna, "stencil_image", PROP_POINTER, PROP_NONE);
732 RNA_def_property_pointer_sdna(prop, NULL, "stencil");
733 RNA_def_property_flag(prop, PROP_EDITABLE);
734 RNA_def_property_ui_text(prop, "Stencil Image", "Image used as stencil");
735 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_stencil_update");
737 prop = RNA_def_property(srna, "canvas", PROP_POINTER, PROP_NONE);
738 RNA_def_property_flag(prop, PROP_EDITABLE);
739 RNA_def_property_ui_text(prop, "Canvas", "Image used as canvas");
740 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_canvas_update");
742 prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
743 RNA_def_property_pointer_sdna(prop, NULL, "clone");
744 RNA_def_property_flag(prop, PROP_EDITABLE);
745 RNA_def_property_ui_text(prop, "Clone Image", "Image used as clone source");
746 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
748 prop = RNA_def_property(srna, "stencil_color", PROP_FLOAT, PROP_COLOR_GAMMA);
749 RNA_def_property_range(prop, 0.0, 1.0);
750 RNA_def_property_float_sdna(prop, NULL, "stencil_col");
751 RNA_def_property_ui_text(prop, "Stencil Color", "Stencil color in the viewport");
752 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
754 prop = RNA_def_property(srna, "dither", PROP_FLOAT, PROP_NONE);
755 RNA_def_property_range(prop, 0.0, 2.0);
756 RNA_def_property_ui_text(prop, "Dither", "Amount of dithering when painting on byte images");
757 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
759 prop = RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
760 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
761 RNA_def_property_ui_text(prop, "Clone Map",
762 "Use another UV map as clone source, otherwise use the 3D cursor as the source");
763 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
767 prop = RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_PIXEL);
768 RNA_def_property_ui_range(prop, 0, 8, 0, -1);
769 RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
771 prop = RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
772 RNA_def_property_range(prop, 0, 90);
773 RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle");
775 prop = RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size",
776 "Size to capture the image for re-projecting", 0, 0);
777 RNA_def_property_range(prop, 512, 16384);
779 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
780 RNA_def_property_enum_items(prop, paint_type_items);
781 RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting");
782 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
785 prop = RNA_def_property(srna, "missing_uvs", PROP_BOOLEAN, PROP_NONE);
786 RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_UVS);
787 RNA_def_property_ui_text(prop, "Missing UVs",
788 "A UV layer is missing on the mesh");
789 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
791 prop = RNA_def_property(srna, "missing_materials", PROP_BOOLEAN, PROP_NONE);
792 RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_MATERIAL);
793 RNA_def_property_ui_text(prop, "Missing Materials",
794 "The mesh is missing materials");
795 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
797 prop = RNA_def_property(srna, "missing_stencil", PROP_BOOLEAN, PROP_NONE);
798 RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_STENCIL);
799 RNA_def_property_ui_text(prop, "Missing Stencil",
800 "Image Painting does not have a stencil");
801 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
803 prop = RNA_def_property(srna, "missing_texture", PROP_BOOLEAN, PROP_NONE);
804 RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_TEX);
805 RNA_def_property_ui_text(prop, "Missing Texture",
806 "Image Painting does not have a texture to paint on");
807 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
810 static void rna_def_particle_edit(BlenderRNA *brna)
815 static EnumPropertyItem select_mode_items[] = {
816 {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
817 {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
818 {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
819 {0, NULL, 0, NULL, NULL}
822 static EnumPropertyItem puff_mode[] = {
823 {0, "ADD", 0, "Add", "Make hairs more puffy"},
824 {1, "SUB", 0, "Sub", "Make hairs less puffy"},
825 {0, NULL, 0, NULL, NULL}
828 static EnumPropertyItem length_mode[] = {
829 {0, "GROW", 0, "Grow", "Make hairs longer"},
830 {1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
831 {0, NULL, 0, NULL, NULL}
834 static EnumPropertyItem edit_type_items[] = {
835 {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
836 {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
837 {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
838 {0, NULL, 0, NULL, NULL}
844 srna = RNA_def_struct(brna, "ParticleEdit", NULL);
845 RNA_def_struct_sdna(srna, "ParticleEditSettings");
846 RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
847 RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
849 prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
850 RNA_def_property_enum_sdna(prop, NULL, "brushtype");
851 RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
852 RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
853 RNA_def_property_ui_text(prop, "Tool", "");
855 prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
856 RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
857 RNA_def_property_enum_items(prop, select_mode_items);
858 RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
859 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
861 prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
862 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
863 RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
865 prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
866 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
867 RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
869 prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
870 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
871 RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
873 prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
874 RNA_def_property_float_sdna(prop, NULL, "emitterdist");
875 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
876 RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");
878 prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
879 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
880 RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
881 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
883 prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
884 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
885 RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
887 prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
888 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
889 RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
890 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
892 prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
893 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
894 RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");
896 prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
897 RNA_def_property_int_sdna(prop, NULL, "totaddkey");
898 RNA_def_property_range(prop, 2, SHRT_MAX);
899 RNA_def_property_ui_range(prop, 2, 20, 10, 3);
900 RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
902 prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
903 RNA_def_property_struct_type(prop, "ParticleBrush");
904 RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
905 RNA_def_property_ui_text(prop, "Brush", "");
907 prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
908 RNA_def_property_range(prop, 1, 10);
909 RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with");
910 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
912 prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
913 RNA_def_property_range(prop, 1, 100);
914 RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
915 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
917 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
918 RNA_def_property_enum_sdna(prop, NULL, "edittype");
919 RNA_def_property_enum_items(prop, edit_type_items);
920 RNA_def_property_ui_text(prop, "Type", "");
921 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
923 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
924 RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
925 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
926 RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
928 prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
929 RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
930 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
931 RNA_def_property_ui_text(prop, "Hair", "Editing hair");
933 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
934 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
935 RNA_def_property_ui_text(prop, "Object", "The edited object");
937 prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
938 RNA_def_property_flag(prop, PROP_EDITABLE);
939 RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
940 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
941 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
945 srna = RNA_def_struct(brna, "ParticleBrush", NULL);
946 RNA_def_struct_sdna(srna, "ParticleBrushData");
947 RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
948 RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
950 prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
951 RNA_def_property_range(prop, 1, SHRT_MAX);
952 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3);
953 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
955 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
956 RNA_def_property_range(prop, 0.001, 1.0);
957 RNA_def_property_ui_text(prop, "Strength", "Brush strength");
959 prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
960 RNA_def_property_range(prop, 1, 1000);
961 RNA_def_property_ui_range(prop, 1, 100, 10, 3);
962 RNA_def_property_ui_text(prop, "Count", "Particle count");
964 prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
965 RNA_def_property_int_sdna(prop, NULL, "step");
966 RNA_def_property_range(prop, 1, SHRT_MAX);
967 RNA_def_property_ui_range(prop, 1, 50, 10, 3);
968 RNA_def_property_ui_text(prop, "Steps", "Brush steps");
970 prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
971 RNA_def_property_enum_sdna(prop, NULL, "invert");
972 RNA_def_property_enum_items(prop, puff_mode);
973 RNA_def_property_ui_text(prop, "Puff Mode", "");
975 prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
976 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
977 RNA_def_property_ui_text(prop, "Puff Volume",
978 "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
980 prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
981 RNA_def_property_enum_sdna(prop, NULL, "invert");
982 RNA_def_property_enum_items(prop, length_mode);
983 RNA_def_property_ui_text(prop, "Length Mode", "");
986 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
987 RNA_def_property_struct_type(prop, "CurveMapping");
988 RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
989 RNA_def_property_ui_text(prop, "Curve", "");
992 static void rna_def_gpencil_sculpt(BlenderRNA *brna)
994 static EnumPropertyItem prop_direction_items[] = {
995 {0, "ADD", 0, "Add", "Add effect of brush"},
996 {GP_EDITBRUSH_FLAG_INVERT, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
997 {0, NULL, 0, NULL, NULL}};
1002 /* == Settings == */
1003 srna = RNA_def_struct(brna, "GPencilSculptSettings", NULL);
1004 RNA_def_struct_sdna(srna, "GP_BrushEdit_Settings");
1005 RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path");
1006 RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool");
1008 prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
1009 RNA_def_property_enum_sdna(prop, NULL, "brushtype");
1010 RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items);
1011 RNA_def_property_ui_text(prop, "Tool", "");
1012 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1014 prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
1015 RNA_def_property_struct_type(prop, "GPencilSculptBrush");
1016 RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL);
1017 RNA_def_property_ui_text(prop, "Brush", "");
1019 prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE);
1020 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_SELECT_MASK);
1021 RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
1022 RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); // FIXME: this needs a custom icon
1023 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1025 prop = RNA_def_property(srna, "affect_position", PROP_BOOLEAN, PROP_NONE);
1026 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_POSITION);
1027 RNA_def_property_ui_text(prop, "Affect Position", "The brush affects the position of the point");
1028 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1030 prop = RNA_def_property(srna, "affect_strength", PROP_BOOLEAN, PROP_NONE);
1031 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_STRENGTH);
1032 RNA_def_property_ui_text(prop, "Affect Strength", "The brush affects the color strength of the point");
1033 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1035 prop = RNA_def_property(srna, "affect_thickness", PROP_BOOLEAN, PROP_NONE);
1036 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_THICKNESS);
1037 RNA_def_property_ui_text(prop, "Affect Thickness", "The brush affects the thickness of the point");
1038 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1040 prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
1041 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_INTERPOLATE_ALL_LAYERS);
1042 RNA_def_property_ui_text(prop, "Interpolate All Layers", "Interpolate all layers, not only active");
1043 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1045 prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
1046 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_INTERPOLATE_ONLY_SELECTED);
1047 RNA_def_property_ui_text(prop, "Interpolate Selected Strokes", "Interpolate only selected strokes in the original frame");
1048 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1050 prop = RNA_def_property(srna, "selection_alpha", PROP_FLOAT, PROP_NONE);
1051 RNA_def_property_float_sdna(prop, NULL, "alpha");
1052 RNA_def_property_range(prop, 0.0f, 1.0f);
1053 RNA_def_property_ui_text(prop, "Alpha", "Alpha value for selected vertices");
1054 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
1057 srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL);
1058 RNA_def_struct_sdna(srna, "GP_EditBrush_Data");
1059 RNA_def_struct_path_func(srna, "rna_GPencilSculptBrush_path");
1060 RNA_def_struct_ui_text(srna, "GPencil Sculpt Brush", "Stroke editing brush");
1062 prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
1063 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS);
1064 RNA_def_property_ui_range(prop, 1, 100, 10, 3); // XXX: too big
1065 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
1066 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1068 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
1069 RNA_def_property_range(prop, 0.001, 1.0);
1070 RNA_def_property_ui_text(prop, "Strength", "Brush strength");
1071 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1073 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
1074 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_PRESSURE);
1075 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1076 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
1077 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1079 prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
1080 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_FALLOFF);
1081 RNA_def_property_ui_text(prop, "Use Falloff", "Strength of brush decays with distance from cursor");
1082 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1084 prop = RNA_def_property(srna, "affect_pressure", PROP_BOOLEAN, PROP_NONE);
1085 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE);
1086 RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes");
1087 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1089 prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
1090 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
1091 RNA_def_property_enum_items(prop, prop_direction_items);
1092 RNA_def_property_ui_text(prop, "Direction", "");
1093 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
1096 void RNA_def_sculpt_paint(BlenderRNA *brna)
1098 /* *** Non-Animated *** */
1099 RNA_define_animate_sdna(false);
1100 rna_def_paint_curve(brna);
1101 rna_def_paint(brna);
1102 rna_def_sculpt(brna);
1103 rna_def_uv_sculpt(brna);
1104 rna_def_vertex_paint(brna);
1105 rna_def_image_paint(brna);
1106 rna_def_particle_edit(brna);
1107 rna_def_gpencil_sculpt(brna);
1108 RNA_define_animate_sdna(true);