Blender V5.3
rna_dynamicpaint.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "BKE_modifier.hh"
12
14
15#include "BLT_translation.hh"
16
18#include "DNA_modifier_types.h"
19#include "DNA_scene_types.h"
20
21#include "RNA_define.hh"
22#include "RNA_enum_types.hh"
23
24#include "rna_internal.hh"
25
26#include "WM_types.hh"
27
28namespace blender {
29
31 {MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
32 {MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
33 {0, nullptr, 0, nullptr, nullptr},
34};
35
36}
37
38#ifdef RNA_RUNTIME
39
40# include <fmt/format.h>
41
42# include "BLI_listbase.hh"
43# include "BLI_string.hh"
44
45# include "BKE_context.hh"
46# include "BKE_dynamicpaint.h"
47# include "BKE_particle.h"
48
49# include "DEG_depsgraph.hh"
50# include "DEG_depsgraph_build.hh"
51
52namespace blender {
53
54static std::optional<std::string> rna_DynamicPaintCanvasSettings_path(const PointerRNA *ptr)
55{
56 const DynamicPaintCanvasSettings *settings = static_cast<DynamicPaintCanvasSettings *>(
57 ptr->data);
58 const ModifierData *md = reinterpret_cast<ModifierData *>(settings->pmd);
59 char name_esc[sizeof(md->name) * 2];
60
61 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
62 return fmt::format("modifiers[\"{}\"].canvas_settings", name_esc);
63}
64
65static std::optional<std::string> rna_DynamicPaintBrushSettings_path(const PointerRNA *ptr)
66{
67 const DynamicPaintBrushSettings *settings = static_cast<DynamicPaintBrushSettings *>(ptr->data);
68 const ModifierData *md = reinterpret_cast<ModifierData *>(settings->pmd);
69 char name_esc[sizeof(md->name) * 2];
70
71 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
72 return fmt::format("modifiers[\"{}\"].brush_settings", name_esc);
73}
74
75static std::optional<std::string> rna_DynamicPaintSurface_path(const PointerRNA *ptr)
76{
77 const DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
78 const ModifierData *md = reinterpret_cast<ModifierData *>(surface->canvas->pmd);
79 char name_esc[sizeof(md->name) * 2];
80 char name_esc_surface[sizeof(surface->name) * 2];
81
82 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
83 BLI_str_escape(name_esc_surface, surface->name, sizeof(name_esc_surface));
84 return fmt::format(
85 "modifiers[\"{}\"].canvas_settings.canvas_surfaces[\"{}\"]", name_esc, name_esc_surface);
86}
87
88/*
89 * Surfaces
90 */
91
92static void rna_DynamicPaint_redoModifier(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
93{
95}
96
97static void rna_DynamicPaintSurfaces_updateFrames(Main * /*bmain*/,
98 Scene * /*scene*/,
99 PointerRNA *ptr)
100{
101 dynamicPaint_cacheUpdateFrames(static_cast<DynamicPaintSurface *>(ptr->data));
102}
103
104static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
105{
106 dynamicPaint_resetSurface(scene, static_cast<DynamicPaintSurface *>(ptr->data));
107 rna_DynamicPaint_redoModifier(bmain, scene, ptr);
108}
109
110static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, PointerRNA *ptr)
111{
112 DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
113
114 surface->init_layername[0] = '\0';
115 dynamicPaint_clearSurface(scene, surface);
116 rna_DynamicPaint_redoModifier(bmain, scene, ptr);
117}
118
119static void rna_DynamicPaintSurface_uniqueName(Main * /*bmain*/,
120 Scene * /*scene*/,
121 PointerRNA *ptr)
122{
124 (static_cast<DynamicPaintSurface *>(ptr->data))->name);
125}
126
127static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
128{
129 dynamicPaintSurface_updateType(static_cast<DynamicPaintSurface *>(ptr->data));
130 dynamicPaint_resetSurface(scene, static_cast<DynamicPaintSurface *>(ptr->data));
131 rna_DynamicPaintSurface_reset(bmain, scene, ptr);
132}
133
134static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, PointerRNA *ptr)
135{
136 DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
137
138 /* Only #MOD_DPAINT_SURFACE_F_VERTEX supports #MOD_DPAINT_SURFACE_T_WEIGHT. */
139 if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ &&
140 surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
141 {
142 surface->type = MOD_DPAINT_SURFACE_T_PAINT;
143 }
144
145 dynamicPaintSurface_updateType(static_cast<DynamicPaintSurface *>(ptr->data));
146 rna_DynamicPaintSurface_reset(bmain, scene, ptr);
147}
148
149static void rna_DynamicPaint_reset_dependency(Main *bmain, Scene * /*scene*/, PointerRNA * /*ptr*/)
150{
152}
153
154static void rna_DynamicPaintSurface_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
155{
156 rna_DynamicPaintSurface_reset(bmain, scene, ptr);
157 rna_DynamicPaint_reset_dependency(bmain, scene, ptr);
158}
159
160static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
161{
163 DynamicPaintSurface *surface = canvas->surfaces.first();
164 int id = 0;
165
166 for (; surface; surface = surface->next) {
167 if (id == canvas->active_sur) {
168 return RNA_pointer_create_with_parent(*ptr, RNA_DynamicPaintSurface, surface);
169 }
170 id++;
171 }
172 return {};
173}
174
175static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
176{
178# if 0
180 iter, ptr,(void *)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0);
181# endif
182 rna_iterator_listbase_begin(iter, ptr, &canvas->surfaces, nullptr);
183}
184
185static int rna_Surface_active_point_index_get(PointerRNA *ptr)
186{
188 return canvas->active_sur;
189}
190
191static void rna_Surface_active_point_index_set(PointerRNA *ptr, int value)
192{
194 canvas->active_sur = value;
195}
196
197static void rna_Surface_active_point_range(
198 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
199{
201
202 *min = 0;
203 *max = canvas->surfaces.count() - 1;
204}
205
206/* uvlayer */
207static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
208{
209 DynamicPaintCanvasSettings *canvas = (static_cast<DynamicPaintSurface *>(ptr->data))->canvas;
210 DynamicPaintSurface *surface = canvas->surfaces.first();
211 int id = 0;
212
213 for (; surface; surface = surface->next) {
214 if (id == canvas->active_sur) {
216 ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
217 return;
218 }
219 id++;
220 }
221}
222
223/* is point cache used */
224static bool rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
225{
226 DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
227
228 return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? true : false;
229}
230
231/* Does output layer exist. */
232static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
233{
234 return dynamicPaint_outputLayerExists(surface, ob, index);
235}
236
237static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext * /*C*/,
238 PointerRNA *ptr,
239 PropertyRNA * /*prop*/,
240 bool *r_free)
241{
242 DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
243
244 EnumPropertyItem *item = nullptr;
245 EnumPropertyItem tmp = {0, "", 0, "", ""};
246 int totitem = 0;
247
248 /* Paint type - available for all formats */
250 tmp.identifier = "PAINT";
251 tmp.name = "Paint";
252 tmp.icon = ICON_TPAINT_HLT;
253 RNA_enum_item_add(&item, &totitem, &tmp);
254
255 /* Displace */
258 tmp.identifier = "DISPLACE";
259 tmp.name = "Displace";
260 tmp.icon = ICON_MOD_DISPLACE;
261 RNA_enum_item_add(&item, &totitem, &tmp);
262 }
263
264 /* Weight */
265 if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
266 tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT;
267 tmp.identifier = "WEIGHT";
268 tmp.name = "Weight";
269 tmp.icon = ICON_MOD_VERTEX_WEIGHT;
270 RNA_enum_item_add(&item, &totitem, &tmp);
271 }
272
273 /* Height waves */
274 {
275 tmp.value = MOD_DPAINT_SURFACE_T_WAVE;
276 tmp.identifier = "WAVE";
277 tmp.name = "Waves";
278 tmp.icon = ICON_MOD_WAVE;
279 RNA_enum_item_add(&item, &totitem, &tmp);
280 }
281
282 RNA_enum_item_end(&item, &totitem);
283 *r_free = true;
284
285 return item;
286}
287
288} // namespace blender
289
290#else
291
292namespace blender {
293
294/* canvas.canvas_surfaces */
296{
297 StructRNA *srna;
298 PropertyRNA *prop;
299
300 RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
301 srna = RNA_def_struct(brna, "DynamicPaintSurfaces", nullptr);
302 RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
303 RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
304
305 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
308 "rna_Surface_active_point_index_get",
309 "rna_Surface_active_point_index_set",
310 "rna_Surface_active_point_range");
311 RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
312
313 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
314 RNA_def_property_struct_type(prop, "DynamicPaintSurface");
315 RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", nullptr, nullptr, nullptr);
316 RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
317 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
318}
319
321{
322 StructRNA *srna;
323 PropertyRNA *prop;
324 PropertyRNA *parm;
325 FunctionRNA *func;
326
327 /* Surface format */
328 static const EnumPropertyItem prop_dynamicpaint_surface_format[] = {
329 // {MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""},
330 {MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
331 {MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
332 {0, nullptr, 0, nullptr, nullptr},
333 };
334
335 /* Surface type - generated dynamically based on surface format */
336 static const EnumPropertyItem prop_dynamicpaint_surface_type[] = {
337 {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
338 {0, nullptr, 0, nullptr, nullptr},
339 };
340
341 /* Initial color setting */
342 static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
343 {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
344 {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
345 {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
346 {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
347 {0, nullptr, 0, nullptr, nullptr},
348 };
349
350 /* Effect type
351 * Only used by UI to view per effect settings. */
352 static const EnumPropertyItem prop_dynamicpaint_effecttype[] = {
353 {1, "SPREAD", 0, "Spread", ""},
354 {2, "DRIP", 0, "Drip", ""},
355 {3, "SHRINK", 0, "Shrink", ""},
356 {0, nullptr, 0, nullptr, nullptr},
357 };
358
359 /* Displace-map file format. */
360 static const EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
361 {MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
362 {MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
363 {0, nullptr, 0, nullptr, nullptr},
364 };
365
366 /* Displace-map type. */
367 static const EnumPropertyItem prop_dynamicpaint_displace_type[] = {
368 {MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
369 {MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
370 {0, nullptr, 0, nullptr, nullptr},
371 };
372
373 /* Surface */
374 srna = RNA_def_struct(brna, "DynamicPaintSurface", nullptr);
375 RNA_def_struct_sdna(srna, "DynamicPaintSurface");
376 RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
377 RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
378
379 prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
381 RNA_def_property_enum_sdna(prop, nullptr, "format");
382 RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
383 RNA_def_property_ui_text(prop, "Format", "Surface Format");
384 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
385
386 prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
388 RNA_def_property_enum_sdna(prop, nullptr, "type");
389 RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
390 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_DynamicPaint_surface_type_itemf");
391 RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
392 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
393
394 prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
395 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_ACTIVE);
396 RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
397 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
398
399 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
400 RNA_def_property_ui_text(prop, "Name", "Surface name");
401 RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
403
404 prop = RNA_def_property(srna, "brush_collection", PROP_POINTER, PROP_NONE);
405 RNA_def_property_struct_type(prop, "Collection");
406 RNA_def_property_pointer_sdna(prop, nullptr, "brush_group");
409 prop, "Brush Collection", "Only use brush objects from this collection");
411 prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset_dependency");
412
413 /*
414 * Paint, wet and displace
415 */
416
417 prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
418 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_DISSOLVE);
419 RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
421
422 prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
423 RNA_def_property_int_sdna(prop, nullptr, "diss_speed");
424 RNA_def_property_range(prop, 1.0, 10000.0);
425 RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
427 prop, "Dissolve Time", "Approximately in how many frames should dissolve happen");
428
429 prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
431 RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
432
433 prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_TIME);
434 RNA_def_property_range(prop, 1.0, 10000.0);
435 RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
437 prop, "Dry Time", "Approximately in how many frames should drying happen");
438
439 /*
440 * Simulation settings
441 */
442 prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
444 RNA_def_property_range(prop, 16.0, 4096.0);
445 RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, -1);
446 RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
447
448 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
449 RNA_def_property_string_sdna(prop, nullptr, "uvlayer_name");
450 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
451 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_DynamicPaint_uvlayer_set");
452
453 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
454 RNA_def_property_int_sdna(prop, nullptr, "start_frame");
457 RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
458 RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
459 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
460
461 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
462 RNA_def_property_int_sdna(prop, nullptr, "end_frame");
465 RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
466 RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
467 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
468
469 prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
470 RNA_def_property_int_sdna(prop, nullptr, "substeps");
471 RNA_def_property_range(prop, 0.0, 20.0);
472 RNA_def_property_ui_range(prop, 0.0, 10, 1, -1);
474 prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
475
476 prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
480 "Anti-Aliasing",
482 " multisampling to smooth paint edges");
483 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
484
485 prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
486 RNA_def_property_float_sdna(prop, nullptr, "influence_scale");
487 RNA_def_property_range(prop, 0.0, 1.0);
488 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
490 prop, "Influence Scale", "Adjust influence brush objects have on this surface");
491 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
492
493 prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
494 RNA_def_property_float_sdna(prop, nullptr, "radius_scale");
495 RNA_def_property_range(prop, 0.0, 10.0);
496 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
498 prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
499 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
500
501 /*
502 * Initial Color
503 */
504
505 prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
507 RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
508 RNA_def_property_ui_text(prop, "Initial Color", "");
511 "rna_DynamicPaintSurface_initialcolortype");
512
513 prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
515 RNA_def_property_array(prop, 4);
516 RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
518 prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
519
520 prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
522 RNA_def_property_ui_text(prop, "Texture", "");
524 prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
525
526 prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
527 RNA_def_property_ui_text(prop, "Data Layer", "");
529 prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
530
531 /*
532 * Effect Settings
533 */
534 prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
536 RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
537 RNA_def_property_ui_text(prop, "Effect Type", "");
538
539 prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
540 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_DRY_LOG);
542 prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
543
544 prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
547 prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)");
548
549 prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
553 prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
554 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
555
556 prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
557 RNA_def_property_float_sdna(prop, nullptr, "spread_speed");
558 RNA_def_property_range(prop, 0.001, 10.0);
559 RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
561 prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
562
563 prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
564 RNA_def_property_float_sdna(prop, nullptr, "color_dry_threshold");
565 RNA_def_property_range(prop, 0.0, 1.0);
566 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
568 prop, "Color Dry", "The wetness level when colors start to shift to the background");
569
570 prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
571 RNA_def_property_float_sdna(prop, nullptr, "color_spread_speed");
572 RNA_def_property_range(prop, 0.0, 2.0);
573 RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
574 RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
575
576 prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
580 prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
581 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
582
583 prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
586 RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
587 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
588
589 prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
590 RNA_def_property_float_sdna(prop, nullptr, "shrink_speed");
591 RNA_def_property_range(prop, 0.001, 10.0);
592 RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
594 prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
595
596 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
597 RNA_def_property_struct_type(prop, "EffectorWeights");
600 RNA_def_property_ui_text(prop, "Effector Weights", "");
601
602 prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
603 RNA_def_property_float_sdna(prop, nullptr, "drip_vel");
604 RNA_def_property_range(prop, -200.0f, 200.0f);
605 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
606 RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");
607
608 prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
609 RNA_def_property_float_sdna(prop, nullptr, "drip_acc");
610 RNA_def_property_range(prop, -200.0f, 200.0f);
611 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
612 RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");
613
614 /*
615 * Output settings
616 */
617 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
619 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_MULALPHA);
621 prop, "Premultiply Alpha", "Multiply color by alpha (recommended for Blender input)");
622
623 prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
624 RNA_def_property_string_sdna(prop, nullptr, "image_output_path");
626 RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
627
628 /* output for primary surface data */
629 prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
630 RNA_def_property_string_sdna(prop, nullptr, "output_name");
631 RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
632
633 prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
634 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_OUT1);
635 RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
636
637 /* Output for secondary surface data. */
638 prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
639 RNA_def_property_string_sdna(prop, nullptr, "output_name2");
640 RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
641
642 prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
643 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_OUT2);
644 RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
645
646 /* to check if output name exists */
647 func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
648 RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
649 parm = RNA_def_pointer(func, "object", "Object", "", "");
651 parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
653 /* return type */
654 parm = RNA_def_boolean(func, "exists", false, "", "");
655 RNA_def_function_return(func, parm);
656
657 prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
659 RNA_def_property_range(prop, 0.00, 50.0);
660 RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
662 prop,
663 "Max Displace",
664 "Maximum level of depth intersection in object space (use 0.0 to disable)");
665 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
666
667 prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
668 RNA_def_property_float_sdna(prop, nullptr, "disp_factor");
670 RNA_def_property_range(prop, -50.0, 50.0);
671 RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
673 prop, "Displace Factor", "Strength of displace when applied to the mesh");
674 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
675
676 prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
678 RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
679 RNA_def_property_ui_text(prop, "File Format", "");
680
681 prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
682 RNA_def_property_enum_sdna(prop, nullptr, "disp_type");
684 RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
685 RNA_def_property_ui_text(prop, "Data Type", "");
686
687 prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
691 prop, "Incremental", "New displace is added cumulatively on top of existing");
692 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
693
694 /* wave simulator settings */
695 prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
696 RNA_def_property_range(prop, 0.0, 1.0);
697 RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
698 RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
699
700 prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
701 RNA_def_property_range(prop, 0.01, 5.0);
702 RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
703 RNA_def_property_ui_text(prop, "Speed", "Wave propagation speed");
704
705 prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
706 RNA_def_property_range(prop, 0.01, 3.0);
707 RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
708 RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
709
710 prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
711 RNA_def_property_range(prop, 0.0, 1.0);
712 RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
713 RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
714
715 prop = RNA_def_property(srna, "wave_smoothness", PROP_FLOAT, PROP_NONE);
716 RNA_def_property_range(prop, 0.0, 10.0);
717 RNA_def_property_ui_range(prop, 0.1, 5.0, 1, 2);
719 "Smoothness",
720 "Limit maximum steepness of wave slope between simulation points "
721 "(use higher values for smoother waves at expense of reduced detail)");
722
723 prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
725 RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
726
727 /* cache */
728 prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
730 RNA_def_property_pointer_sdna(prop, nullptr, "pointcache");
731 RNA_def_property_struct_type(prop, "PointCache");
732 RNA_def_property_ui_text(prop, "Point Cache", "");
733
734 /* is cache used */
735 prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
736 RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", nullptr);
737 RNA_def_property_ui_text(prop, "Use Cache", "");
739}
740
742{
743 StructRNA *srna;
744 PropertyRNA *prop;
745
746 srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", nullptr);
747 RNA_def_struct_ui_text(srna, "Canvas Settings", "Dynamic Paint canvas settings");
748 RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
749 RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
750
751 /*
752 * Surface Slots
753 */
754 prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
756 "rna_DynamicPaint_surfaces_begin",
757 "rna_iterator_listbase_next",
758 "rna_iterator_listbase_end",
759 "rna_iterator_listbase_get",
760 nullptr,
761 nullptr,
762 nullptr,
763 nullptr);
764 RNA_def_property_struct_type(prop, "DynamicPaintSurface");
765 RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
766 rna_def_canvas_surfaces(brna, prop);
767}
768
770{
771 StructRNA *srna;
772 PropertyRNA *prop;
773
774 /* paint collision type */
775 static const EnumPropertyItem prop_dynamicpaint_collisiontype[] = {
776 {MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""},
777 {MOD_DPAINT_COL_POINT, "POINT", ICON_EMPTY_AXIS, "Object Center", ""},
778 {MOD_DPAINT_COL_DIST, "DISTANCE", ICON_DRIVER_DISTANCE, "Proximity", ""},
779 {MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
780 {MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
781 {0, nullptr, 0, nullptr, nullptr},
782 };
783
784 static const EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
785 {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
786 {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
787 {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
788 {0, nullptr, 0, nullptr, nullptr},
789 };
790
791 static const EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
792 {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
793 {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
794 {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
795 {MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
796 {0, nullptr, 0, nullptr, nullptr},
797 };
798
799 static const EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
800 {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
801 {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
802 {MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
803 {0, nullptr, 0, nullptr, nullptr},
804 };
805
806 srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", nullptr);
807 RNA_def_struct_ui_text(srna, "Brush Settings", "Brush settings");
808 RNA_def_struct_sdna(srna, "DynamicPaintBrushSettings");
809 RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
810
811 /*
812 * Paint
813 */
814 prop = RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
815 RNA_def_property_float_sdna(prop, nullptr, "r");
816 RNA_def_property_array(prop, 3);
817 RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
818 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
819
820 prop = RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
821 RNA_def_property_float_sdna(prop, nullptr, "alpha");
822 RNA_def_property_range(prop, 0.0, 1.0);
823 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
824 RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
825 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
826
827 prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
830 prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing");
831
832 prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
833 RNA_def_property_float_sdna(prop, nullptr, "wetness");
834 RNA_def_property_range(prop, 0.0, 1.0);
835 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
837 prop,
838 "Paint Wetness",
839 "Paint wetness, visible in wetmap (some effects only affect wet paint)");
840 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
841
842 prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
843 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_ERASE);
844 RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
845 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
846
847 prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
849 RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
850 RNA_def_property_ui_text(prop, "Wave Type", "");
852
853 prop = RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
854 RNA_def_property_range(prop, -2.0, 2.0);
855 RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
856 RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
857
858 prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
859 RNA_def_property_range(prop, 0.00, 50.0);
860 RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
862 prop,
863 "Clamp Waves",
864 "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
865
866 prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
869 prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
870
871 prop = RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
872 RNA_def_property_range(prop, 0.0, 1.0);
873 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
874 RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
875
876 prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
877 RNA_def_property_float_sdna(prop, nullptr, "max_velocity");
878 RNA_def_property_range(prop, 0.0001, 10.0);
879 RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
881 prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)");
882
883 prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
886 prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
887 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
888
889 prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
892 prop,
893 "Multiply Depth",
894 "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
895 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
896
897 prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
899 RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
900 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
901
902 /*
903 * Paint Area / Collision
904 */
905 prop = RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
907 RNA_def_property_enum_sdna(prop, nullptr, "collision");
908 RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
909 RNA_def_property_ui_text(prop, "Paint Source", "");
910 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
911
912 prop = RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
913 RNA_def_property_float_sdna(prop, nullptr, "paint_distance");
914 RNA_def_property_range(prop, 0.0, 500.0);
915 RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
917 prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint");
918 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
919
920 prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
922 RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
923 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
924
925 prop = RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
927 RNA_def_property_enum_sdna(prop, nullptr, "proximity_falloff");
928 RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
929 RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
931 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
932
933 prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
936 prop,
937 "Project",
938 "Brush is projected to canvas from defined direction within brush proximity");
939 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
940
941 prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
942 RNA_def_property_enum_sdna(prop, nullptr, "ray_dir");
943 RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
945 prop,
946 "Ray Direction",
947 "Ray direction to use for projection (if brush object is located in that direction "
948 "it's painted)");
949 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
950
951 prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
954 prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
955 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
956
957 prop = RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
959 RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
960 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
961
962 /*
963 * Particle
964 */
965 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
966 RNA_def_property_pointer_sdna(prop, nullptr, "psys");
967 RNA_def_property_struct_type(prop, "ParticleSystem");
969 RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
970 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_reset_dependency");
971
972 prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
973 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MOD_DPAINT_PART_RAD);
974 RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
975 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
976
977 prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
978 RNA_def_property_float_sdna(prop, nullptr, "particle_radius");
979 RNA_def_property_range(prop, 0.01, 10.0);
980 RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
981 RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
982 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
983
984 prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
985 RNA_def_property_float_sdna(prop, nullptr, "particle_smooth");
986 RNA_def_property_range(prop, 0.0, 10.0);
987 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, -1);
988 RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
989 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
990
991 /*
992 * Color ramps
993 */
994 prop = RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
995 RNA_def_property_pointer_sdna(prop, nullptr, "paint_ramp");
996 RNA_def_property_struct_type(prop, "ColorRamp");
998 prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
999 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
1000
1001 prop = RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
1002 RNA_def_property_pointer_sdna(prop, nullptr, "vel_ramp");
1003 RNA_def_property_struct_type(prop, "ColorRamp");
1005 prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
1006 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
1007}
1008
1015
1016} // namespace blender
1017
1018#endif
#define BLI_STR_UTF8_MULTIPLICATION_SIGN
#define BLT_I18NCONTEXT_ID_BRUSH
#define BLT_I18NCONTEXT_ID_SIMULATION
#define MAXFRAMEF
#define ND_DRAW
Definition WM_types.hh:502
#define ND_MODIFIER
Definition WM_types.hh:503
#define NC_MATERIAL
Definition WM_types.hh:393
#define NC_OBJECT
Definition WM_types.hh:392
#define ND_SHADING_DRAW
Definition WM_types.hh:521
#define ELEM(...)
btScalar max
BMesh Iterators.
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
bool dynamicPaint_resetSurface(const struct Scene *scene, struct DynamicPaintSurface *surface)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void dynamicPaint_clearSurface(const struct Scene *scene, struct DynamicPaintSurface *surface)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int output)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int result_maxncpy)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:526
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[]
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void DEG_relations_tag_update(Main *bmain)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_DIRPATH
Definition RNA_types.hh:285
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:329
@ PROP_UNSIGNED
Definition RNA_types.hh:306
@ PARM_REQUIRED
Definition RNA_types.hh:631
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
static void rna_def_canvas_surface(BlenderRNA *brna)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_dynamic_paint(BlenderRNA *brna)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
#define min(a, b)
Definition sort.cc:38