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): Miika Hämäläinen
20
* ***** END GPL LICENSE BLOCK *****
23
/** \file blender/makesrna/intern/rna_dynamicpaint.c
31
#include "RNA_define.h"
33
#include "rna_internal.h"
35
#include "BKE_modifier.h"
36
#include "BKE_dynamicpaint.h"
38
#include "DNA_dynamicpaint_types.h"
39
#include "DNA_modifier_types.h"
40
#include "DNA_object_force.h"
41
#include "DNA_object_types.h"
42
#include "DNA_scene_types.h"
46
EnumPropertyItem prop_dynamicpaint_type_items[] = {
47
{MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
48
{MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
49
{0, NULL, 0, NULL, NULL}};
54
#include "BKE_context.h"
55
#include "BKE_depsgraph.h"
56
#include "BKE_particle.h"
59
static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
61
DynamicPaintCanvasSettings *settings = (DynamicPaintCanvasSettings*)ptr->data;
62
ModifierData *md = (ModifierData *)settings->pmd;
64
return BLI_sprintfN("modifiers[\"%s\"].canvas_settings", md->name);
67
static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
69
DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings*)ptr->data;
70
ModifierData *md = (ModifierData *)settings->pmd;
72
return BLI_sprintfN("modifiers[\"%s\"].brush_settings", md->name);
75
static char *rna_DynamicPaintSurface_path(PointerRNA *ptr)
77
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
78
ModifierData *md = (ModifierData *)surface->canvas->pmd;
80
return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]", md->name, surface->name);
88
static void rna_DynamicPaint_redoModifier(Main *bmain, Scene *scene, PointerRNA *ptr)
90
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
93
static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, PointerRNA *ptr)
95
dynamicPaint_cacheUpdateFrames((DynamicPaintSurface*)ptr->data);
98
static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
100
dynamicPaint_resetSurface((DynamicPaintSurface*)ptr->data);
101
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
104
static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, PointerRNA *ptr)
106
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
108
surface->init_layername[0] = '\0';
109
dynamicPaint_clearSurface(surface);
110
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
113
static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, PointerRNA *ptr)
115
DynamicPaintSurface *act_surface = (DynamicPaintSurface*)ptr->data;
116
DynamicPaintSurface *surface = act_surface->canvas->surfaces.first;
118
/* since only one color surface can show preview at time
119
* disable preview on other surfaces*/
120
for (; surface; surface = surface->next) {
121
if (surface != act_surface)
122
surface->flags &= ~MOD_DPAINT_PREVIEW;
124
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
127
static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, PointerRNA *ptr)
129
dynamicPaintSurface_setUniqueName((DynamicPaintSurface*)ptr->data, ((DynamicPaintSurface*)ptr->data)->name);
133
static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
135
dynamicPaintSurface_updateType((DynamicPaintSurface*)ptr->data);
136
dynamicPaint_resetSurface((DynamicPaintSurface*)ptr->data);
137
rna_DynamicPaintSurface_reset(bmain, scene, ptr);
140
static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, PointerRNA *ptr)
142
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
144
surface->type = MOD_DPAINT_SURFACE_T_PAINT;
145
dynamicPaintSurface_updateType((DynamicPaintSurface*)ptr->data);
146
rna_DynamicPaintSurface_reset(bmain, scene, ptr);
149
static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerRNA *ptr)
151
rna_DynamicPaintSurface_reset(bmain, scene, ptr);
152
DAG_scene_sort(bmain, scene);
155
static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
157
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
158
DynamicPaintSurface *surface = canvas->surfaces.first;
161
for (; surface; surface = surface->next) {
162
if (id == canvas->active_sur)
163
return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface);
166
return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, NULL);
169
static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
171
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
172
/*rna_iterator_array_begin(iter, (void*)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0); */
173
rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
176
static int rna_Surface_active_point_index_get(PointerRNA *ptr)
178
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
179
return canvas->active_sur;
182
static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value)
184
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
185
canvas->active_sur = value;
189
static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
191
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
194
*max = BLI_countlist(&canvas->surfaces)-1;
198
static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
200
DynamicPaintCanvasSettings *canvas = ((DynamicPaintSurface*)ptr->data)->canvas;
201
DynamicPaintSurface *surface = canvas->surfaces.first;
204
for (; surface; surface = surface->next) {
205
if (id == canvas->active_sur) {
206
rna_object_uvlayer_name_set(ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
213
/* is point cache used */
214
static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
216
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
218
return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0;
221
/* does output layer exist*/
222
static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
224
return dynamicPaint_outputLayerExists(surface, ob, index);
228
static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr,
229
PropertyRNA *UNUSED(prop), int *free)
231
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
233
EnumPropertyItem *item = NULL;
234
EnumPropertyItem tmp = {0, "", 0, "", ""};
237
/* Paint type - available for all formats */
238
tmp.value = MOD_DPAINT_SURFACE_T_PAINT;
239
tmp.identifier = "PAINT";
241
RNA_enum_item_add(&item, &totitem, &tmp);
244
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX ||
245
surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
246
tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE;
247
tmp.identifier = "DISPLACE";
248
tmp.name = "Displace";
249
RNA_enum_item_add(&item, &totitem, &tmp);
253
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
254
tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT;
255
tmp.identifier = "WEIGHT";
257
RNA_enum_item_add(&item, &totitem, &tmp);
262
tmp.value = MOD_DPAINT_SURFACE_T_WAVE;
263
tmp.identifier = "WAVE";
265
RNA_enum_item_add(&item, &totitem, &tmp);
268
RNA_enum_item_end(&item, &totitem);
276
/* canvas.canvas_surfaces */
277
static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
282
RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
283
srna = RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
284
RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
285
RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
287
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
288
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
289
RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set",
290
"rna_Surface_active_point_range");
291
RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
293
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
294
RNA_def_property_struct_type(prop, "DynamicPaintSurface");
295
RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", NULL, NULL, NULL);
296
RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
297
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
301
static void rna_def_canvas_surface(BlenderRNA *brna)
309
static EnumPropertyItem prop_dynamicpaint_surface_format[] = {
310
/*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
311
{MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
312
{MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
313
{0, NULL, 0, NULL, NULL}};
315
/* Surface type - generated dynamically based on surface format */
316
static EnumPropertyItem prop_dynamicpaint_surface_type[] = {
317
{MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
318
{0, NULL, 0, NULL, NULL}};
320
/* Surface output preview. currently only paint has multiple outputs */
321
static EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
322
{MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
323
{MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
324
{0, NULL, 0, NULL, NULL}};
326
/* Initial color setting */
327
static EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
328
{MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
329
{MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
330
{MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
331
{MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
332
{0, NULL, 0, NULL, NULL}};
335
* Only used by ui to view per effect settings */
336
static EnumPropertyItem prop_dynamicpaint_effecttype[] = {
337
{1, "SPREAD", 0, "Spread", ""},
338
{2, "DRIP", 0, "Drip", ""},
339
{3, "SHRINK", 0, "Shrink", ""},
340
{0, NULL, 0, NULL, NULL}};
342
/* Displacemap file format */
343
static EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
344
{MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
346
{MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
348
{0, NULL, 0, NULL, NULL}};
350
/* Displacemap type */
351
static EnumPropertyItem prop_dynamicpaint_displace_type[] = {
352
{MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
353
{MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
354
{0, NULL, 0, NULL, NULL}};
359
srna = RNA_def_struct(brna, "DynamicPaintSurface", NULL);
360
RNA_def_struct_sdna(srna, "DynamicPaintSurface");
361
RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
362
RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
364
prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
365
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
366
RNA_def_property_enum_sdna(prop, NULL, "format");
367
RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
368
RNA_def_property_ui_text(prop, "Format", "Surface Format");
369
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
371
prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
372
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
373
RNA_def_property_enum_sdna(prop, NULL, "type");
374
RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
375
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DynamicPaint_surface_type_itemf");
376
RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
377
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
379
prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
380
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
381
RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
382
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
384
prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
385
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
386
RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
387
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
389
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
390
RNA_def_property_ui_text(prop, "Name", "Surface name");
391
RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
392
RNA_def_struct_name_property(srna, prop);
394
prop = RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
395
RNA_def_property_struct_type(prop, "Group");
396
RNA_def_property_flag(prop, PROP_EDITABLE);
397
RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
398
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_resetDependancy");
402
* Paint, wet and displace
405
prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
406
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
407
RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
409
prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
410
RNA_def_property_int_sdna(prop, NULL, "diss_speed");
411
RNA_def_property_range(prop, 1.0, 10000.0);
412
RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
413
RNA_def_property_ui_text(prop, "Dissolve Speed", "Approximately in how many frames should dissolve happen");
415
prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
416
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
417
RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
419
prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
420
RNA_def_property_range(prop, 1.0, 10000.0);
421
RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
422
RNA_def_property_ui_text(prop, "Dry Speed", "Approximately in how many frames should drying happen");
425
* Simulation settings
427
prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
428
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
429
RNA_def_property_range(prop, 16.0, 4096.0);
430
RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, 0);
431
RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
433
prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
434
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
435
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
436
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
438
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
439
RNA_def_property_int_sdna(prop, NULL, "start_frame");
440
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
441
RNA_def_property_range(prop, 1.0, 9999.0);
442
RNA_def_property_ui_range(prop, 1.0, 9999, 1, 0);
443
RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
444
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
446
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
447
RNA_def_property_int_sdna(prop, NULL, "end_frame");
448
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
449
RNA_def_property_range(prop, 1.0, 9999.0);
450
RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, 0);
451
RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
452
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
454
prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
455
RNA_def_property_int_sdna(prop, NULL, "substeps");
456
RNA_def_property_range(prop, 0.0, 20.0);
457
RNA_def_property_ui_range(prop, 0.0, 10, 1, 0);
458
RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
460
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
461
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
462
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
463
RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smoothen paint edges");
464
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
466
prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
467
RNA_def_property_float_sdna(prop, NULL, "influence_scale");
468
RNA_def_property_range(prop, 0.0, 1.0);
469
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
470
RNA_def_property_ui_text(prop, "Influence Scale", "Adjust influence brush objects have on this surface");
471
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
473
prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
474
RNA_def_property_float_sdna(prop, NULL, "radius_scale");
475
RNA_def_property_range(prop, 0.0, 10.0);
476
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
477
RNA_def_property_ui_text(prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
478
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
484
prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
485
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
486
RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
487
RNA_def_property_ui_text(prop, "Initial Color", "");
488
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");
490
prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
491
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
492
RNA_def_property_array(prop, 4);
493
RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
494
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
496
prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
497
RNA_def_property_flag(prop, PROP_EDITABLE);
498
RNA_def_property_ui_text(prop, "Texture", "");
499
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
501
prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
502
RNA_def_property_ui_text(prop, "Data Layer", "");
503
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
508
prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
509
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
510
RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
511
RNA_def_property_ui_text(prop, "Effect Type", "");
513
prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
514
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
515
RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
517
prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
518
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
519
RNA_def_property_ui_text(prop, "Slow",
520
"Use logarithmic dissolve (makes high values to fade faster than low values)");
522
prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
523
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
524
RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
525
RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
526
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
528
prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
529
RNA_def_property_float_sdna(prop, NULL, "spread_speed");
530
RNA_def_property_range(prop, 0.001, 10.0);
531
RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
532
RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
534
prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
535
RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
536
RNA_def_property_range(prop, 0.0, 1.0);
537
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
538
RNA_def_property_ui_text(prop, "Color Dry", "The wetness level when colors start to shift to the background");
540
prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
541
RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
542
RNA_def_property_range(prop, 0.0, 2.0);
543
RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
544
RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
546
prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
547
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
548
RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
549
RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
550
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
552
prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
553
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
554
RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
555
RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
556
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
558
prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
559
RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
560
RNA_def_property_range(prop, 0.001, 10.0);
561
RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
562
RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
564
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
565
RNA_def_property_struct_type(prop, "EffectorWeights");
566
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
567
RNA_def_property_ui_text(prop, "Effector Weights", "");
569
prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
570
RNA_def_property_float_sdna(prop, NULL, "drip_vel");
571
RNA_def_property_range(prop, -200.0f, 200.0f);
572
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
573
RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");
575
prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
576
RNA_def_property_float_sdna(prop, NULL, "drip_acc");
577
RNA_def_property_range(prop, -200.0f, 200.0f);
578
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
579
RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");
584
prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
585
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
586
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
587
RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
589
prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
590
RNA_def_property_string_sdna(prop, NULL, "image_output_path");
591
RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
593
/* output for primary surface data */
594
prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
595
RNA_def_property_string_sdna(prop, NULL, "output_name");
596
RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
598
prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
599
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
600
RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
602
/* output for secondary sufrace data */
603
prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
604
RNA_def_property_string_sdna(prop, NULL, "output_name2");
605
RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
607
prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
608
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
609
RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
611
prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
612
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
613
RNA_def_property_enum_sdna(prop, NULL, "preview_id");
614
RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
615
RNA_def_property_ui_text(prop, "Preview", "");
616
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
618
/* to check if output name exists */
619
func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
620
RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
621
parm = RNA_def_pointer(func, "object", "Object", "", "");
622
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
623
parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
624
RNA_def_property_flag(parm, PROP_REQUIRED);
626
parm = RNA_def_boolean(func, "exists", 0, "", "");
627
RNA_def_function_return(func, parm);
629
prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
630
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
631
RNA_def_property_range(prop, 0.00, 50.0);
632
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
633
RNA_def_property_ui_text(prop, "Max Displace",
634
"Maximum level of depth intersection in object space (use 0.0 to disable)");
635
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
637
prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
638
RNA_def_property_float_sdna(prop, NULL, "disp_factor");
639
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
640
RNA_def_property_range(prop, -50.0, 50.0);
641
RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
642
RNA_def_property_ui_text(prop, "Displace Factor", "Strength of displace when applied to the mesh");
643
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
645
prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
646
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
647
RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
648
RNA_def_property_ui_text(prop, "File Format", "");
650
prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
651
RNA_def_property_enum_sdna(prop, NULL, "disp_type");
652
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
653
RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
654
RNA_def_property_ui_text(prop, "Data Type", "");
656
prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
657
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
658
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
659
RNA_def_property_ui_text(prop, "Incremental", "New displace is added cumulatively on top of existing");
660
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
662
/* wave simulator settings */
663
prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
664
RNA_def_property_range(prop, 0.0, 1.0);
665
RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
666
RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
668
prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
669
RNA_def_property_range(prop, 0.01, 5.0);
670
RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
671
RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed");
673
prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
674
RNA_def_property_range(prop, 0.01, 3.0);
675
RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
676
RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
678
prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
679
RNA_def_property_range(prop, 0.0, 1.0);
680
RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
681
RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
683
prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
684
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
685
RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
689
prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
690
RNA_def_property_flag(prop, PROP_NEVER_NULL);
691
RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
692
RNA_def_property_ui_text(prop, "Point Cache", "");
695
prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
696
RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
697
RNA_def_property_ui_text(prop, "Use Cache", "");
698
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
701
static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
706
srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL);
707
RNA_def_struct_ui_text(srna, "Canvas Settings", "Dynamic Paint canvas settings");
708
RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
709
RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
714
prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
715
RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next",
716
"rna_iterator_listbase_end", "rna_iterator_listbase_get",
717
NULL, NULL, NULL, NULL);
718
RNA_def_property_struct_type(prop, "DynamicPaintSurface");
719
RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
720
rna_def_canvas_surfaces(brna, prop);
723
static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
728
/* paint collision type */
729
static EnumPropertyItem prop_dynamicpaint_collisiontype[] = {
730
{MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""},
731
{MOD_DPAINT_COL_POINT, "POINT", ICON_META_EMPTY, "Object Center", ""},
732
{MOD_DPAINT_COL_DIST, "DISTANCE", ICON_META_EMPTY, "Proximity", ""},
733
{MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
734
{MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
735
{0, NULL, 0, NULL, NULL}};
737
static EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
738
{MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
739
{MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
740
{MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
741
{0, NULL, 0, NULL, NULL}};
743
static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
744
{MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
745
{MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
746
{MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
747
{MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
748
{0, NULL, 0, NULL, NULL}};
750
static EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
751
{MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
752
{MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
753
{MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
754
{0, NULL, 0, NULL, NULL}};
756
srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", NULL);
757
RNA_def_struct_ui_text(srna, "Brush Settings", "Brush settings");
758
RNA_def_struct_sdna(srna, "DynamicPaintBrushSettings");
759
RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
764
prop = RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
765
RNA_def_property_float_sdna(prop, NULL, "r");
766
RNA_def_property_array(prop, 3);
767
RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
768
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
770
prop = RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
771
RNA_def_property_float_sdna(prop, NULL, "alpha");
772
RNA_def_property_range(prop, 0.0, 1.0);
773
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
774
RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
775
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
777
prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
778
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_MATERIAL);
779
RNA_def_property_ui_text(prop, "Use object material", "Use object material to define color and influence");
780
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
782
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
783
RNA_def_property_pointer_sdna(prop, NULL, "mat");
784
RNA_def_property_ui_text(prop, "Material",
785
"Material to use (if not defined, material linked to the mesh is used)");
786
RNA_def_property_flag(prop, PROP_EDITABLE);
787
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
789
prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
790
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
791
RNA_def_property_ui_text(prop, "Absolute Alpha",
792
"Only increase alpha value if paint alpha is higher than existing");
794
prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
795
RNA_def_property_float_sdna(prop, NULL, "wetness");
796
RNA_def_property_range(prop, 0.0, 1.0);
797
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
798
RNA_def_property_ui_text(prop, "Paint Wetness",
799
"Paint wetness, visible in wetmap (some effects only affect wet paint)");
800
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
802
prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
803
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE);
804
RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
805
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
807
prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
808
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
809
RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
810
RNA_def_property_ui_text(prop, "Wave Type", "");
812
prop = RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
813
RNA_def_property_range(prop, -2.0, 2.0);
814
RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
815
RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
817
prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
818
RNA_def_property_range(prop, 0.00, 50.0);
819
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
820
RNA_def_property_ui_text(prop, "Clamp Waves",
821
"Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
823
prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
824
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
825
RNA_def_property_ui_text(prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
827
prop = RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
828
RNA_def_property_range(prop, 0.0, 1.0);
829
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
830
RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
832
prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
833
RNA_def_property_float_sdna(prop, NULL, "max_velocity");
834
RNA_def_property_range(prop, 0.0001, 10.0);
835
RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
836
RNA_def_property_ui_text(prop, "Max Velocity",
837
"Velocity considered as maximum influence (Blender units per frame)");
839
prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
840
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
841
RNA_def_property_ui_text(prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
842
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
844
prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
845
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
846
RNA_def_property_ui_text(prop, "Multiply Depth",
847
"Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
848
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
850
prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
851
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR);
852
RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
853
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
856
* Paint Area / Collision
858
prop = RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
859
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
860
RNA_def_property_enum_sdna(prop, NULL, "collision");
861
RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
862
RNA_def_property_ui_text(prop, "Paint Source", "");
863
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
865
prop = RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
866
RNA_def_property_float_sdna(prop, NULL, "paint_distance");
867
RNA_def_property_range(prop, 0.0, 500.0);
868
RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
869
RNA_def_property_ui_text(prop, "Proximity Distance",
870
"Maximum distance from brush to mesh surface to affect paint");
871
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
873
prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
874
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA);
875
RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
876
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
878
prop = RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
879
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
880
RNA_def_property_enum_sdna(prop, NULL, "proximity_falloff");
881
RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
882
RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
883
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
885
prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
886
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
887
RNA_def_property_ui_text(prop, "Project",
888
"Brush is projected to canvas from defined direction within brush proximity");
889
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
891
prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
892
RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
893
RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
894
RNA_def_property_ui_text(prop, "Ray Direction",
895
"Ray direction to use for projection (if brush object is located in that direction "
897
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
899
prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
900
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX);
901
RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
902
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
904
prop = RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
905
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
906
RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
907
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
913
prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
914
RNA_def_property_pointer_sdna(prop, NULL, "psys");
915
RNA_def_property_struct_type(prop, "ParticleSystem");
916
RNA_def_property_flag(prop, PROP_EDITABLE);
917
RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
918
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_resetDependancy");
921
prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
922
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
923
RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
924
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
926
prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
927
RNA_def_property_float_sdna(prop, NULL, "particle_radius");
928
RNA_def_property_range(prop, 0.01, 10.0);
929
RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
930
RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
931
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
933
prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
934
RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
935
RNA_def_property_range(prop, 0.0, 10.0);
936
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 0);
937
RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
938
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
944
prop = RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
945
RNA_def_property_pointer_sdna(prop, NULL, "paint_ramp");
946
RNA_def_property_struct_type(prop, "ColorRamp");
947
RNA_def_property_ui_text(prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
948
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
950
prop = RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
951
RNA_def_property_pointer_sdna(prop, NULL, "vel_ramp");
952
RNA_def_property_struct_type(prop, "ColorRamp");
953
RNA_def_property_ui_text(prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
954
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
957
void RNA_def_dynamic_paint(BlenderRNA *brna)
959
rna_def_dynamic_paint_canvas_settings(brna);
960
rna_def_dynamic_paint_brush_settings(brna);
961
rna_def_canvas_surface(brna);