Blender V4.3
rna_cloth.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
9#include <climits>
10#include <cstdlib>
11
12#include "BLI_math_base.h"
13
14#include "DNA_cloth_types.h"
15#include "DNA_object_types.h"
16#include "DNA_scene_types.h"
17
18#include "RNA_define.hh"
19
20#include "rna_internal.hh"
21
22#include "BKE_cloth.hh"
23#include "BKE_modifier.hh"
24
25#include "SIM_mass_spring.h"
26
27#include "WM_api.hh"
28#include "WM_types.hh"
29
30#ifdef RNA_RUNTIME
31
32# include <fmt/format.h>
33
34# include "BKE_context.hh"
35# include "DEG_depsgraph.hh"
36# include "DEG_depsgraph_build.hh"
37
38static void rna_cloth_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
39{
40 Object *ob = (Object *)ptr->owner_id;
41
44}
45
46static void rna_cloth_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
47{
49 rna_cloth_update(bmain, scene, ptr);
50}
51
52static void rna_cloth_pinning_changed(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
53{
54 Object *ob = (Object *)ptr->owner_id;
55 // ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
58
60
63}
64
65static void rna_ClothSettings_bending_set(PointerRNA *ptr, float value)
66{
68
69 settings->bending = value;
70
71 /* check for max clipping */
72 if (value > settings->max_bend) {
73 settings->max_bend = value;
74 }
75}
76
77static void rna_ClothSettings_max_bend_set(PointerRNA *ptr, float value)
78{
80
81 /* check for clipping */
82 if (value < settings->bending) {
83 value = settings->bending;
84 }
85
86 settings->max_bend = value;
87}
88
89static void rna_ClothSettings_tension_set(PointerRNA *ptr, float value)
90{
92
93 settings->tension = value;
94
95 /* check for max clipping */
96 if (value > settings->max_tension) {
97 settings->max_tension = value;
98 }
99}
100
101static void rna_ClothSettings_max_tension_set(PointerRNA *ptr, float value)
102{
104
105 /* check for clipping */
106 if (value < settings->tension) {
107 value = settings->tension;
108 }
109
110 settings->max_tension = value;
111}
112
113static void rna_ClothSettings_compression_set(PointerRNA *ptr, float value)
114{
116
117 settings->compression = value;
118
119 /* check for max clipping */
120 if (value > settings->max_compression) {
121 settings->max_compression = value;
122 }
123}
124
125static void rna_ClothSettings_max_compression_set(PointerRNA *ptr, float value)
126{
128
129 /* check for clipping */
130 if (value < settings->compression) {
131 value = settings->compression;
132 }
133
134 settings->max_compression = value;
135}
136
137static void rna_ClothSettings_shear_set(PointerRNA *ptr, float value)
138{
140
141 settings->shear = value;
142
143 /* check for max clipping */
144 if (value > settings->max_shear) {
145 settings->max_shear = value;
146 }
147}
148
149static void rna_ClothSettings_max_shear_set(PointerRNA *ptr, float value)
150{
152
153 /* check for clipping */
154 if (value < settings->shear) {
155 value = settings->shear;
156 }
157
158 settings->max_shear = value;
159}
160
161static void rna_ClothSettings_max_sewing_set(PointerRNA *ptr, float value)
162{
164
165 /* check for clipping */
166 if (value < 0.0f) {
167 value = 0.0f;
168 }
169
170 settings->max_sewing = value;
171}
172
173static void rna_ClothSettings_shrink_min_set(PointerRNA *ptr, float value)
174{
176
177 settings->shrink_min = value;
178
179 /* check for max clipping */
180 if (value > settings->shrink_max) {
181 settings->shrink_max = value;
182 }
183}
184
185static void rna_ClothSettings_shrink_max_set(PointerRNA *ptr, float value)
186{
188
189 /* check for clipping */
190 if (value < settings->shrink_min) {
191 value = settings->shrink_min;
192 }
193
194 settings->shrink_max = value;
195}
196
197static void rna_ClothSettings_internal_tension_set(PointerRNA *ptr, float value)
198{
200
201 settings->internal_tension = value;
202
203 /* check for max clipping */
204 if (value > settings->max_internal_tension) {
205 settings->max_internal_tension = value;
206 }
207}
208
209static void rna_ClothSettings_max_internal_tension_set(PointerRNA *ptr, float value)
210{
212
213 /* check for clipping */
214 if (value < settings->internal_tension) {
215 value = settings->internal_tension;
216 }
217
218 settings->max_internal_tension = value;
219}
220
221static void rna_ClothSettings_internal_compression_set(PointerRNA *ptr, float value)
222{
224
225 settings->internal_compression = value;
226
227 /* check for max clipping */
228 if (value > settings->max_internal_compression) {
229 settings->max_internal_compression = value;
230 }
231}
232
233static void rna_ClothSettings_max_internal_compression_set(PointerRNA *ptr, float value)
234{
236
237 /* check for clipping */
238 if (value < settings->internal_compression) {
239 value = settings->internal_compression;
240 }
241
242 settings->max_internal_compression = value;
243}
244
245static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value)
246{
248 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass);
249}
250
251static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr)
252{
254 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass);
255}
256
257static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
258{
260 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass);
261}
262
263static void rna_ClothSettings_shrink_vgroup_get(PointerRNA *ptr, char *value)
264{
266 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shrink);
267}
268
269static int rna_ClothSettings_shrink_vgroup_length(PointerRNA *ptr)
270{
272 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shrink);
273}
274
275static void rna_ClothSettings_shrink_vgroup_set(PointerRNA *ptr, const char *value)
276{
278 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shrink);
279}
280
281static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value)
282{
284 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct);
285}
286
287static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr)
288{
290 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct);
291}
292
293static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value)
294{
296 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct);
297}
298
299static void rna_ClothSettings_shear_vgroup_get(PointerRNA *ptr, char *value)
300{
302 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shear);
303}
304
305static int rna_ClothSettings_shear_vgroup_length(PointerRNA *ptr)
306{
308 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shear);
309}
310
311static void rna_ClothSettings_shear_vgroup_set(PointerRNA *ptr, const char *value)
312{
314 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shear);
315}
316
317static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value)
318{
320 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend);
321}
322
323static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr)
324{
326 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend);
327}
328
329static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value)
330{
332 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
333}
334
335static void rna_ClothSettings_internal_vgroup_get(PointerRNA *ptr, char *value)
336{
338 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_intern);
339}
340
341static int rna_ClothSettings_internal_vgroup_length(PointerRNA *ptr)
342{
344 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_intern);
345}
346
347static void rna_ClothSettings_internal_vgroup_set(PointerRNA *ptr, const char *value)
348{
350 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_intern);
351}
352
353static void rna_ClothSettings_pressure_vgroup_get(PointerRNA *ptr, char *value)
354{
356 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_pressure);
357}
358
359static int rna_ClothSettings_pressure_vgroup_length(PointerRNA *ptr)
360{
362 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_pressure);
363}
364
365static void rna_ClothSettings_pressure_vgroup_set(PointerRNA *ptr, const char *value)
366{
368 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_pressure);
369}
370
371static void rna_CollSettings_selfcol_vgroup_get(PointerRNA *ptr, char *value)
372{
374 rna_object_vgroup_name_index_get(ptr, value, coll->vgroup_selfcol);
375}
376
377static int rna_CollSettings_selfcol_vgroup_length(PointerRNA *ptr)
378{
380 return rna_object_vgroup_name_index_length(ptr, coll->vgroup_selfcol);
381}
382
383static void rna_CollSettings_selfcol_vgroup_set(PointerRNA *ptr, const char *value)
384{
386 rna_object_vgroup_name_index_set(ptr, value, &coll->vgroup_selfcol);
387}
388
389static void rna_CollSettings_objcol_vgroup_get(PointerRNA *ptr, char *value)
390{
392 rna_object_vgroup_name_index_get(ptr, value, coll->vgroup_objcol);
393}
394
395static int rna_CollSettings_objcol_vgroup_length(PointerRNA *ptr)
396{
398 return rna_object_vgroup_name_index_length(ptr, coll->vgroup_objcol);
399}
400
401static void rna_CollSettings_objcol_vgroup_set(PointerRNA *ptr, const char *value)
402{
404 rna_object_vgroup_name_index_set(ptr, value, &coll->vgroup_objcol);
405}
406
407static PointerRNA rna_ClothSettings_rest_shape_key_get(PointerRNA *ptr)
408{
409 Object *ob = (Object *)ptr->owner_id;
411
412 return rna_object_shapekey_index_get(static_cast<ID *>(ob->data), sim->shapekey_rest);
413}
414
415static void rna_ClothSettings_rest_shape_key_set(PointerRNA *ptr,
416 PointerRNA value,
417 ReportList * /*reports*/)
418{
419 Object *ob = (Object *)ptr->owner_id;
421
423 static_cast<ID *>(ob->data), value, sim->shapekey_rest);
424}
425
426static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values)
427{
429
430 values[0] = sim->gravity[0];
431 values[1] = sim->gravity[1];
432 values[2] = sim->gravity[2];
433}
434
435static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
436{
438
439 sim->gravity[0] = values[0];
440 sim->gravity[1] = values[1];
441 sim->gravity[2] = values[2];
442}
443
444static std::optional<std::string> rna_ClothSettings_path(const PointerRNA *ptr)
445{
446 const Object *ob = (Object *)ptr->owner_id;
448
449 if (md) {
450 char name_esc[sizeof(md->name) * 2];
451 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
452 return fmt::format("modifiers[\"{}\"].settings", name_esc);
453 }
454 return std::nullopt;
455}
456
457static std::optional<std::string> rna_ClothCollisionSettings_path(const PointerRNA *ptr)
458{
459 const Object *ob = (Object *)ptr->owner_id;
461
462 if (md) {
463 char name_esc[sizeof(md->name) * 2];
464 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
465 return fmt::format("modifiers[\"{}\"].collision_settings", name_esc);
466 }
467 return std::nullopt;
468}
469
470static int rna_ClothSettings_internal_editable(const PointerRNA *ptr, const char **r_info)
471{
473
474 if (sim && (sim->bending_model == CLOTH_BENDING_LINEAR)) {
475 *r_info = "Only available with angular bending springs.";
476 return 0;
477 }
478
479 return sim ? PROP_EDITABLE : PropertyFlag(0);
480}
481
482#else
483
485{
486 StructRNA *srna;
487 PropertyRNA *prop;
488
489 static const EnumPropertyItem status_items[] = {
490 {SIM_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"},
492 "NUMERICAL_ISSUE",
493 0,
494 "Numerical Issue",
495 "The provided data did not satisfy the prerequisites"},
497 "NO_CONVERGENCE",
498 0,
499 "No Convergence",
500 "Iterative procedure did not converge"},
502 "INVALID_INPUT",
503 0,
504 "Invalid Input",
505 "The inputs are invalid, or the algorithm has been improperly called"},
506 {0, nullptr, 0, nullptr, nullptr},
507 };
508
509 srna = RNA_def_struct(brna, "ClothSolverResult", nullptr);
510 RNA_def_struct_ui_text(srna, "Solver Result", "Result of cloth solver iteration");
511
513
514 prop = RNA_def_property(srna, "status", PROP_ENUM, PROP_NONE);
515 RNA_def_property_enum_items(prop, status_items);
516 RNA_def_property_enum_sdna(prop, nullptr, "status");
519 RNA_def_property_ui_text(prop, "Status", "Status of the solver iteration");
520
521 prop = RNA_def_property(srna, "max_error", PROP_FLOAT, PROP_NONE);
522 RNA_def_property_float_sdna(prop, nullptr, "max_error");
524 RNA_def_property_ui_text(prop, "Maximum Error", "Maximum error during substeps");
525
526 prop = RNA_def_property(srna, "min_error", PROP_FLOAT, PROP_NONE);
527 RNA_def_property_float_sdna(prop, nullptr, "min_error");
529 RNA_def_property_ui_text(prop, "Minimum Error", "Minimum error during substeps");
530
531 prop = RNA_def_property(srna, "avg_error", PROP_FLOAT, PROP_NONE);
532 RNA_def_property_float_sdna(prop, nullptr, "avg_error");
534 RNA_def_property_ui_text(prop, "Average Error", "Average error during substeps");
535
536 prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
537 RNA_def_property_int_sdna(prop, nullptr, "max_iterations");
539 RNA_def_property_ui_text(prop, "Maximum Iterations", "Maximum iterations during substeps");
540
541 prop = RNA_def_property(srna, "min_iterations", PROP_INT, PROP_NONE);
542 RNA_def_property_int_sdna(prop, nullptr, "min_iterations");
544 RNA_def_property_ui_text(prop, "Minimum Iterations", "Minimum iterations during substeps");
545
546 prop = RNA_def_property(srna, "avg_iterations", PROP_FLOAT, PROP_NONE);
547 RNA_def_property_float_sdna(prop, nullptr, "avg_iterations");
549 RNA_def_property_ui_text(prop, "Average Iterations", "Average iterations during substeps");
550
552}
553
555{
556 StructRNA *srna;
557 PropertyRNA *prop;
558
559 static const EnumPropertyItem prop_bending_model_items[] = {
560 {CLOTH_BENDING_ANGULAR, "ANGULAR", 0, "Angular", "Cloth model with angular bending springs"},
562 "LINEAR",
563 0,
564 "Linear",
565 "Cloth model with linear bending springs (legacy)"},
566 {0, nullptr, 0, nullptr, nullptr},
567 };
568
569 srna = RNA_def_struct(brna, "ClothSettings", nullptr);
570 RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object");
571 RNA_def_struct_sdna(srna, "ClothSimSettings");
572 RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
573
575
576 /* goal */
577
578 prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
579 RNA_def_property_float_sdna(prop, nullptr, "mingoal");
580 RNA_def_property_range(prop, 0.0f, 1.0f);
582 prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range");
583 RNA_def_property_update(prop, 0, "rna_cloth_update");
584
585 prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
586 RNA_def_property_float_sdna(prop, nullptr, "maxgoal");
587 RNA_def_property_range(prop, 0.0f, 1.0f);
589 prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range");
590 RNA_def_property_update(prop, 0, "rna_cloth_update");
591
592 prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
593 RNA_def_property_float_sdna(prop, nullptr, "defgoal");
594 RNA_def_property_range(prop, 0.0f, 1.0f);
596 prop,
597 "Goal Default",
598 "Default Goal (vertex target position) value, when no Vertex Group used");
599 RNA_def_property_update(prop, 0, "rna_cloth_update");
600
601 prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
602 RNA_def_property_float_sdna(prop, nullptr, "goalspring");
603 RNA_def_property_range(prop, 0.0f, 0.999f);
605 prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
606 RNA_def_property_update(prop, 0, "rna_cloth_update");
607
608 prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
609 RNA_def_property_float_sdna(prop, nullptr, "goalfrict");
610 RNA_def_property_range(prop, 0.0f, 50.0f);
611 RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
612 RNA_def_property_update(prop, 0, "rna_cloth_update");
613
614 prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_FACTOR);
615 RNA_def_property_float_sdna(prop, nullptr, "velocity_smooth");
616 RNA_def_property_range(prop, 0.0f, 1.0f);
617 RNA_def_property_ui_text(prop, "Internal Friction", "");
618 RNA_def_property_update(prop, 0, "rna_cloth_update");
619
620 prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_FACTOR);
621 RNA_def_property_float_sdna(prop, nullptr, "collider_friction");
622 RNA_def_property_range(prop, 0.0f, 1.0f);
623 RNA_def_property_ui_text(prop, "Collider Friction", "");
624 RNA_def_property_update(prop, 0, "rna_cloth_update");
625
626 prop = RNA_def_property(srna, "density_target", PROP_FLOAT, PROP_NONE);
627 RNA_def_property_float_sdna(prop, nullptr, "density_target");
628 RNA_def_property_range(prop, 0.0f, 10000.0f);
629 RNA_def_property_ui_text(prop, "Target Density", "Maximum density of hair");
630 RNA_def_property_update(prop, 0, "rna_cloth_update");
631
632 prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_FACTOR);
633 RNA_def_property_float_sdna(prop, nullptr, "density_strength");
634 RNA_def_property_range(prop, 0.0f, 1.0f);
636 prop, "Target Density Strength", "Influence of target density on the simulation");
637 RNA_def_property_update(prop, 0, "rna_cloth_update");
638
639 /* mass */
640
641 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
642 RNA_def_property_range(prop, 0.0f, FLT_MAX);
643 RNA_def_property_ui_text(prop, "Vertex Mass", "The mass of each vertex on the cloth material");
644 RNA_def_property_update(prop, 0, "rna_cloth_update");
645
646 prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
648 "rna_ClothSettings_mass_vgroup_get",
649 "rna_ClothSettings_mass_vgroup_length",
650 "rna_ClothSettings_mass_vgroup_set");
652 RNA_def_property_ui_text(prop, "Pin Vertex Group", "Vertex Group for pinning of vertices");
653 RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
654
655 prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
656 RNA_def_property_array(prop, 3);
657 RNA_def_property_range(prop, -100.0, 100.0);
659 prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", nullptr);
660 RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector");
661 RNA_def_property_update(prop, 0, "rna_cloth_update");
662
663 /* various */
664
665 prop = RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
666 RNA_def_property_float_sdna(prop, nullptr, "Cvi");
667 RNA_def_property_range(prop, 0.0f, 10.0f);
669 prop, "Air Damping", "Air has normally some thickness which slows falling things down");
670 RNA_def_property_update(prop, 0, "rna_cloth_update");
671
672 prop = RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
673 RNA_def_property_float_sdna(prop, nullptr, "goalspring");
674 RNA_def_property_range(prop, 0.0f, 50.0);
675 RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness");
676 RNA_def_property_update(prop, 0, "rna_cloth_update");
677
678 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
679 RNA_def_property_int_sdna(prop, nullptr, "stepsPerFrame");
680 RNA_def_property_range(prop, 1, INT_MAX);
681 RNA_def_property_ui_range(prop, 1, 80, 1, -1);
683 prop,
684 "Quality",
685 "Quality of the simulation in steps per frame (higher is better quality but slower)");
686 RNA_def_property_update(prop, 0, "rna_cloth_update");
687
688 prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
689 RNA_def_property_float_sdna(prop, nullptr, "time_scale");
690 RNA_def_property_range(prop, 0.0f, FLT_MAX);
691 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
692 RNA_def_property_ui_text(prop, "Speed", "Cloth speed is multiplied by this value");
693 RNA_def_property_update(prop, 0, "rna_cloth_update");
694
695 prop = RNA_def_property(srna, "vertex_group_shrink", PROP_STRING, PROP_NONE);
697 "rna_ClothSettings_shrink_vgroup_get",
698 "rna_ClothSettings_shrink_vgroup_length",
699 "rna_ClothSettings_shrink_vgroup_set");
701 RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
702 RNA_def_property_update(prop, 0, "rna_cloth_update");
703
704 prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_FACTOR);
705 RNA_def_property_float_sdna(prop, nullptr, "shrink_min");
706 RNA_def_property_range(prop, -FLT_MAX, 1.0f);
707 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.05f, 3);
708 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_shrink_min_set", nullptr);
709 RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
710 RNA_def_property_update(prop, 0, "rna_cloth_update");
711
712 prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_FACTOR);
713 RNA_def_property_float_sdna(prop, nullptr, "shrink_max");
714 RNA_def_property_range(prop, -FLT_MAX, 1.0f);
715 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.05f, 3);
716 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_shrink_max_set", nullptr);
717 RNA_def_property_ui_text(prop, "Shrink Factor Max", "Max amount to shrink cloth by");
718 RNA_def_property_update(prop, 0, "rna_cloth_update");
719
720 prop = RNA_def_property(srna, "voxel_cell_size", PROP_FLOAT, PROP_UNSIGNED);
721 RNA_def_property_float_sdna(prop, nullptr, "voxel_cell_size");
722 RNA_def_property_range(prop, 0.0001f, 10000.0f);
724 prop, "Voxel Grid Cell Size", "Size of the voxel grid cells for interaction effects");
725 RNA_def_property_update(prop, 0, "rna_cloth_update");
726
727 /* springs */
728 prop = RNA_def_property(srna, "tension_damping", PROP_FLOAT, PROP_NONE);
729 RNA_def_property_float_sdna(prop, nullptr, "tension_damp");
730 RNA_def_property_range(prop, 0.0f, 50.0f);
732 prop, "Tension Spring Damping", "Amount of damping in stretching behavior");
733 RNA_def_property_update(prop, 0, "rna_cloth_update");
734
735 prop = RNA_def_property(srna, "compression_damping", PROP_FLOAT, PROP_NONE);
736 RNA_def_property_float_sdna(prop, nullptr, "compression_damp");
737 RNA_def_property_range(prop, 0.0f, 50.0f);
739 prop, "Compression Spring Damping", "Amount of damping in compression behavior");
740 RNA_def_property_update(prop, 0, "rna_cloth_update");
741
742 prop = RNA_def_property(srna, "shear_damping", PROP_FLOAT, PROP_NONE);
743 RNA_def_property_float_sdna(prop, nullptr, "shear_damp");
744 RNA_def_property_range(prop, 0.0f, 50.0f);
745 RNA_def_property_ui_text(prop, "Shear Spring Damping", "Amount of damping in shearing behavior");
746 RNA_def_property_update(prop, 0, "rna_cloth_update");
747
748 prop = RNA_def_property(srna, "tension_stiffness", PROP_FLOAT, PROP_NONE);
749 RNA_def_property_float_sdna(prop, nullptr, "tension");
750 RNA_def_property_range(prop, 0.0f, 10000.0f);
751 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_tension_set", nullptr);
752 RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
753 RNA_def_property_update(prop, 0, "rna_cloth_update");
754
755 prop = RNA_def_property(srna, "tension_stiffness_max", PROP_FLOAT, PROP_NONE);
756 RNA_def_property_float_sdna(prop, nullptr, "max_tension");
757 RNA_def_property_range(prop, 0.0f, 10000.0f);
758 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_max_tension_set", nullptr);
759 RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
760 RNA_def_property_update(prop, 0, "rna_cloth_update");
761
762 prop = RNA_def_property(srna, "compression_stiffness", PROP_FLOAT, PROP_NONE);
763 RNA_def_property_float_sdna(prop, nullptr, "compression");
764 RNA_def_property_range(prop, 0.0f, 10000.0f);
765 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_compression_set", nullptr);
767 prop, "Compression Stiffness", "How much the material resists compression");
768 RNA_def_property_update(prop, 0, "rna_cloth_update");
769
770 prop = RNA_def_property(srna, "compression_stiffness_max", PROP_FLOAT, PROP_NONE);
771 RNA_def_property_float_sdna(prop, nullptr, "max_compression");
772 RNA_def_property_range(prop, 0.0f, 10000.0f);
773 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_max_compression_set", nullptr);
775 prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
776 RNA_def_property_update(prop, 0, "rna_cloth_update");
777
778 prop = RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
779 RNA_def_property_float_sdna(prop, nullptr, "shear");
780 RNA_def_property_range(prop, 0.0f, 10000.0f);
781 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_shear_set", nullptr);
782 RNA_def_property_ui_text(prop, "Shear Stiffness", "How much the material resists shearing");
783 RNA_def_property_update(prop, 0, "rna_cloth_update");
784
785 prop = RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
786 RNA_def_property_float_sdna(prop, nullptr, "max_shear");
787 RNA_def_property_range(prop, 0.0f, 10000.0f);
788 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_max_shear_set", nullptr);
789 RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value");
790 RNA_def_property_update(prop, 0, "rna_cloth_update");
791
792 prop = RNA_def_property(srna, "sewing_force_max", PROP_FLOAT, PROP_NONE);
793 RNA_def_property_float_sdna(prop, nullptr, "max_sewing");
794 RNA_def_property_range(prop, 0.0f, 10000.0f);
795 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_max_sewing_set", nullptr);
796 RNA_def_property_ui_text(prop, "Sewing Force Max", "Maximum sewing force");
797 RNA_def_property_update(prop, 0, "rna_cloth_update");
798
799 prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
801 "rna_ClothSettings_struct_vgroup_get",
802 "rna_ClothSettings_struct_vgroup_length",
803 "rna_ClothSettings_struct_vgroup_set");
806 "Structural Stiffness Vertex Group",
807 "Vertex group for fine control over structural stiffness");
808 RNA_def_property_update(prop, 0, "rna_cloth_update");
809
810 prop = RNA_def_property(srna, "vertex_group_shear_stiffness", PROP_STRING, PROP_NONE);
812 "rna_ClothSettings_shear_vgroup_get",
813 "rna_ClothSettings_shear_vgroup_length",
814 "rna_ClothSettings_shear_vgroup_set");
817 prop, "Shear Stiffness Vertex Group", "Vertex group for fine control over shear stiffness");
818 RNA_def_property_update(prop, 0, "rna_cloth_update");
819
820 prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
821 RNA_def_property_float_sdna(prop, nullptr, "bending");
822 RNA_def_property_range(prop, 0.0f, 10000.0f);
823 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_bending_set", nullptr);
824 RNA_def_property_ui_text(prop, "Bending Stiffness", "How much the material resists bending");
825 RNA_def_property_update(prop, 0, "rna_cloth_update");
826
827 prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
828 RNA_def_property_float_sdna(prop, nullptr, "max_bend");
829 RNA_def_property_range(prop, 0.0f, 10000.0f);
830 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_max_bend_set", nullptr);
831 RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
832 RNA_def_property_update(prop, 0, "rna_cloth_update");
833
834 prop = RNA_def_property(srna, "bending_damping", PROP_FLOAT, PROP_NONE);
835 RNA_def_property_float_sdna(prop, nullptr, "bending_damping");
836 RNA_def_property_range(prop, 0.0f, 1000.0f);
838 prop, "Bending Spring Damping", "Amount of damping in bending behavior");
839 RNA_def_property_update(prop, 0, "rna_cloth_update");
840
841 prop = RNA_def_property(srna, "use_sewing_springs", PROP_BOOLEAN, PROP_NONE);
843 RNA_def_property_ui_text(prop, "Sew Cloth", "Pulls loose edges together");
845 RNA_def_property_update(prop, 0, "rna_cloth_update");
846
847 prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
849 "rna_ClothSettings_bend_vgroup_get",
850 "rna_ClothSettings_bend_vgroup_length",
851 "rna_ClothSettings_bend_vgroup_set");
854 "Bending Stiffness Vertex Group",
855 "Vertex group for fine control over bending stiffness");
856 RNA_def_property_update(prop, 0, "rna_cloth_update");
857
858 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
859 RNA_def_property_struct_type(prop, "EffectorWeights");
861 RNA_def_property_ui_text(prop, "Effector Weights", "");
862
863 prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
865 RNA_def_property_struct_type(prop, "ShapeKey");
867 "rna_ClothSettings_rest_shape_key_get",
868 "rna_ClothSettings_rest_shape_key_set",
869 nullptr,
870 nullptr);
873 prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
874 RNA_def_property_update(prop, 0, "rna_cloth_update");
875
876 prop = RNA_def_property(srna, "use_dynamic_mesh", PROP_BOOLEAN, PROP_NONE);
879 prop, "Dynamic Base Mesh", "Make simulation respect deformations in the base mesh");
880 RNA_def_property_update(prop, 0, "rna_cloth_update");
882
883 prop = RNA_def_property(srna, "bending_model", PROP_ENUM, PROP_NONE);
884 RNA_def_property_enum_sdna(prop, nullptr, "bending_model");
885 RNA_def_property_enum_items(prop, prop_bending_model_items);
886 RNA_def_property_ui_text(prop, "Bending Model", "Physical model for simulating bending forces");
887 RNA_def_property_update(prop, 0, "rna_cloth_update");
889
890 prop = RNA_def_property(srna, "use_internal_springs", PROP_BOOLEAN, PROP_NONE);
893 "Create Internal Springs",
894 "Simulate an internal volume structure by creating springs connecting "
895 "the opposite sides of the mesh");
896 RNA_def_property_update(prop, 0, "rna_cloth_update");
898
899 prop = RNA_def_property(srna, "internal_spring_normal_check", PROP_BOOLEAN, PROP_NONE);
901 prop, nullptr, "flags", CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS_NORMAL);
903 "Check Internal Spring Normals",
904 "Require the points the internal springs connect to have opposite "
905 "normal directions");
906 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
907 RNA_def_property_update(prop, 0, "rna_cloth_update");
909
910 prop = RNA_def_property(srna, "internal_spring_max_length", PROP_FLOAT, PROP_NONE);
911 RNA_def_property_float_sdna(prop, nullptr, "internal_spring_max_length");
912 RNA_def_property_range(prop, 0.0f, 1000.0f);
914 prop,
915 "Internal Spring Max Length",
916 "The maximum length an internal spring can have during creation. If the distance between "
917 "internal points is greater than this, no internal spring will be created between these "
918 "points. "
919 "A length of zero means that there is no length limit.");
920 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
921 RNA_def_property_update(prop, 0, "rna_cloth_update");
923
924 prop = RNA_def_property(srna, "internal_spring_max_diversion", PROP_FLOAT, PROP_ANGLE);
925 RNA_def_property_float_sdna(prop, nullptr, "internal_spring_max_diversion");
926 RNA_def_property_range(prop, 0.0f, M_PI_4);
928 "Internal Spring Max Diversion",
929 "How much the rays used to connect the internal points can diverge "
930 "from the vertex normal");
931 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
932 RNA_def_property_update(prop, 0, "rna_cloth_update");
934
935 prop = RNA_def_property(srna, "internal_tension_stiffness", PROP_FLOAT, PROP_NONE);
936 RNA_def_property_float_sdna(prop, nullptr, "internal_tension");
937 RNA_def_property_range(prop, 0.0f, 10000.0f);
938 RNA_def_property_float_funcs(prop, nullptr, "rna_ClothSettings_internal_tension_set", nullptr);
939 RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
940 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
941 RNA_def_property_update(prop, 0, "rna_cloth_update");
942
943 prop = RNA_def_property(srna, "internal_tension_stiffness_max", PROP_FLOAT, PROP_NONE);
944 RNA_def_property_float_sdna(prop, nullptr, "max_internal_tension");
945 RNA_def_property_range(prop, 0.0f, 10000.0f);
947 prop, nullptr, "rna_ClothSettings_max_internal_tension_set", nullptr);
948 RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
949 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
950 RNA_def_property_update(prop, 0, "rna_cloth_update");
951
952 prop = RNA_def_property(srna, "internal_compression_stiffness", PROP_FLOAT, PROP_NONE);
953 RNA_def_property_float_sdna(prop, nullptr, "internal_compression");
954 RNA_def_property_range(prop, 0.0f, 10000.0f);
956 prop, nullptr, "rna_ClothSettings_internal_compression_set", nullptr);
958 prop, "Compression Stiffness", "How much the material resists compression");
959 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
960 RNA_def_property_update(prop, 0, "rna_cloth_update");
961
962 prop = RNA_def_property(srna, "internal_compression_stiffness_max", PROP_FLOAT, PROP_NONE);
963 RNA_def_property_float_sdna(prop, nullptr, "max_internal_compression");
964 RNA_def_property_range(prop, 0.0f, 10000.0f);
966 prop, nullptr, "rna_ClothSettings_max_internal_compression_set", nullptr);
968 prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
969 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
970 RNA_def_property_update(prop, 0, "rna_cloth_update");
971
972 prop = RNA_def_property(srna, "vertex_group_intern", PROP_STRING, PROP_NONE);
974 "rna_ClothSettings_internal_vgroup_get",
975 "rna_ClothSettings_internal_vgroup_length",
976 "rna_ClothSettings_internal_vgroup_set");
979 "Internal Springs Vertex Group",
980 "Vertex group for fine control over the internal spring stiffness");
981 RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
982 RNA_def_property_update(prop, 0, "rna_cloth_update");
983
984 /* Pressure */
985
986 prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
988 RNA_def_property_ui_text(prop, "Use Pressure", "Simulate pressure inside a closed cloth mesh");
990 RNA_def_property_update(prop, 0, "rna_cloth_update");
991
992 prop = RNA_def_property(srna, "use_pressure_volume", PROP_BOOLEAN, PROP_NONE);
995 "Use Custom Volume",
996 "Use the Target Volume parameter as the initial volume, instead "
997 "of calculating it from the mesh itself");
999 RNA_def_property_update(prop, 0, "rna_cloth_update");
1000
1001 prop = RNA_def_property(srna, "uniform_pressure_force", PROP_FLOAT, PROP_NONE);
1002 RNA_def_property_float_sdna(prop, nullptr, "uniform_pressure_force");
1003 RNA_def_property_range(prop, -10000.0f, 10000.0f);
1006 "Pressure",
1007 "The uniform pressure that is constantly applied to the mesh, in units "
1008 "of Pressure Scale. Can be negative.");
1009 RNA_def_property_update(prop, 0, "rna_cloth_update");
1010
1011 prop = RNA_def_property(srna, "target_volume", PROP_FLOAT, PROP_NONE);
1012 RNA_def_property_float_sdna(prop, nullptr, "target_volume");
1013 RNA_def_property_range(prop, 0.0f, 10000.0f);
1016 "Target Volume",
1017 "The mesh volume where the inner/outer pressure will be the same. If "
1018 "set to zero the change in volume will not affect pressure.");
1019 RNA_def_property_update(prop, 0, "rna_cloth_update");
1020
1021 prop = RNA_def_property(srna, "pressure_factor", PROP_FLOAT, PROP_NONE);
1022 RNA_def_property_float_sdna(prop, nullptr, "pressure_factor");
1023 RNA_def_property_range(prop, 0.0f, 10000.0f);
1025 "Pressure Scale",
1026 "Ambient pressure (kPa) that balances out between the inside and "
1027 "outside of the object when it has the target volume");
1028 RNA_def_property_update(prop, 0, "rna_cloth_update");
1029
1030 prop = RNA_def_property(srna, "fluid_density", PROP_FLOAT, PROP_NONE);
1031 RNA_def_property_float_sdna(prop, nullptr, "fluid_density");
1032 RNA_def_property_ui_range(prop, -2.0f, 2.0f, 0.05f, 4);
1034 prop,
1035 "Fluid Density",
1036 "Density (kg/l) of the fluid contained inside the object, used to create "
1037 "a hydrostatic pressure gradient simulating the weight of the internal fluid, "
1038 "or buoyancy from the surrounding fluid if negative");
1039 RNA_def_property_update(prop, 0, "rna_cloth_update");
1040
1041 prop = RNA_def_property(srna, "vertex_group_pressure", PROP_STRING, PROP_NONE);
1043 "rna_ClothSettings_pressure_vgroup_get",
1044 "rna_ClothSettings_pressure_vgroup_length",
1045 "rna_ClothSettings_pressure_vgroup_set");
1048 prop,
1049 "Pressure Vertex Group",
1050 "Vertex Group for where to apply pressure. Zero weight means no "
1051 "pressure while a weight of one means full pressure. Faces with a vertex "
1052 "that has zero weight will be excluded from the volume calculation.");
1053 RNA_def_property_update(prop, 0, "rna_cloth_update");
1054
1055 /* unused */
1056
1057 /* unused still */
1058# if 0
1059 prop = RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
1060 RNA_def_property_float_sdna(prop, nullptr, "eff_force_scale");
1061 RNA_def_property_range(prop, 0.0f, 100.0f);
1062 RNA_def_property_ui_text(prop, "Effector Force Scale", "");
1063# endif
1064 /* unused still */
1065# if 0
1066 prop = RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
1067 RNA_def_property_float_sdna(prop, nullptr, "eff_wind_scale");
1068 RNA_def_property_range(prop, 0.0f, 100.0f);
1069 RNA_def_property_ui_text(prop, "Effector Wind Scale", "");
1070# endif
1071 /* unused still */
1072# if 0
1073 prop = RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
1075 RNA_def_property_ui_text(prop, "Tearing", "");
1076# endif
1077 /* unused still */
1078# if 0
1079 prop = RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
1080 RNA_def_property_int_sdna(prop, nullptr, "maxspringlen");
1081 RNA_def_property_range(prop, 1.0, 1000.0);
1083 prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
1084# endif
1085
1087}
1088
1090{
1091 StructRNA *srna;
1092 PropertyRNA *prop;
1093
1094 srna = RNA_def_struct(brna, "ClothCollisionSettings", nullptr);
1096 srna,
1097 "Cloth Collision Settings",
1098 "Cloth simulation settings for self collision and collision with other objects");
1099 RNA_def_struct_sdna(srna, "ClothCollSettings");
1100 RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
1101
1103
1104 /* general collision */
1105
1106 prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
1108 RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
1109 RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
1110
1111 prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
1112 RNA_def_property_float_sdna(prop, nullptr, "epsilon");
1113 RNA_def_property_range(prop, 0.001f, 1.0f);
1115 prop,
1116 "Minimum Distance",
1117 "Minimum distance between collision objects before collision response takes effect");
1118 RNA_def_property_update(prop, 0, "rna_cloth_update");
1119
1120 prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
1121 RNA_def_property_range(prop, 0.0f, 80.0f);
1123 prop, "Friction", "Friction force if a collision happened (higher = less movement)");
1124 RNA_def_property_update(prop, 0, "rna_cloth_update");
1125
1126 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
1127 RNA_def_property_float_sdna(prop, nullptr, "damping");
1128 RNA_def_property_range(prop, 0.0f, 1.0f);
1130 RNA_def_property_ui_text(prop, "Restitution", "Amount of velocity lost on collision");
1131 RNA_def_property_update(prop, 0, "rna_cloth_update");
1132
1133 prop = RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
1134 RNA_def_property_int_sdna(prop, nullptr, "loop_count");
1135 RNA_def_property_range(prop, 1, SHRT_MAX);
1136 RNA_def_property_ui_range(prop, 1, 20, 1, -1);
1138 prop,
1139 "Collision Quality",
1140 "How many collision iterations should be done (higher is better quality but slower)");
1141 RNA_def_property_update(prop, 0, "rna_cloth_update");
1142
1143 prop = RNA_def_property(srna, "impulse_clamp", PROP_FLOAT, PROP_NONE);
1144 RNA_def_property_float_sdna(prop, nullptr, "clamp");
1145 RNA_def_property_range(prop, 0.0f, 100.0f);
1147 prop,
1148 "Impulse Clamping",
1149 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1150 RNA_def_property_update(prop, 0, "rna_cloth_update");
1151
1152 /* self collision */
1153
1154 prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
1156 RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
1157 RNA_def_property_update(prop, 0, "rna_cloth_update");
1158
1159 prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_DISTANCE);
1160 RNA_def_property_float_sdna(prop, nullptr, "selfepsilon");
1161 RNA_def_property_range(prop, 0.001f, 0.1f);
1163 prop,
1164 "Self Minimum Distance",
1165 "Minimum distance between cloth faces before collision response takes effect");
1166 RNA_def_property_update(prop, 0, "rna_cloth_update");
1167
1168 prop = RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
1169 RNA_def_property_range(prop, 0.0f, 80.0f);
1170 RNA_def_property_ui_text(prop, "Self Friction", "Friction with self contact");
1171 RNA_def_property_update(prop, 0, "rna_cloth_update");
1172
1173 prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
1174 RNA_def_property_pointer_sdna(prop, nullptr, "group");
1176 RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection");
1177 RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
1178
1179 prop = RNA_def_property(srna, "vertex_group_self_collisions", PROP_STRING, PROP_NONE);
1181 "rna_CollSettings_selfcol_vgroup_get",
1182 "rna_CollSettings_selfcol_vgroup_length",
1183 "rna_CollSettings_selfcol_vgroup_set");
1186 prop,
1187 "Selfcollision Vertex Group",
1188 "Triangles with all vertices in this group are not used during self collisions");
1189 RNA_def_property_update(prop, 0, "rna_cloth_update");
1190
1191 prop = RNA_def_property(srna, "vertex_group_object_collisions", PROP_STRING, PROP_NONE);
1193 "rna_CollSettings_objcol_vgroup_get",
1194 "rna_CollSettings_objcol_vgroup_length",
1195 "rna_CollSettings_objcol_vgroup_set");
1198 prop,
1199 "Collision Vertex Group",
1200 "Triangles with all vertices in this group are not used during object collisions");
1201 RNA_def_property_update(prop, 0, "rna_cloth_update");
1202
1203 prop = RNA_def_property(srna, "self_impulse_clamp", PROP_FLOAT, PROP_NONE);
1204 RNA_def_property_float_sdna(prop, nullptr, "self_clamp");
1205 RNA_def_property_range(prop, 0.0f, 100.0f);
1207 prop,
1208 "Impulse Clamping",
1209 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1210 RNA_def_property_update(prop, 0, "rna_cloth_update");
1211
1213}
1214
1221
1222#endif
void cloth_free_modifier(ClothModifierData *clmd)
Definition cloth.cc:433
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
#define M_PI_4
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1041
@ CLOTH_BENDING_LINEAR
@ CLOTH_BENDING_ANGULAR
@ CLOTH_COLLSETTINGS_FLAG_ENABLED
@ CLOTH_COLLSETTINGS_FLAG_SELF
@ CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH
@ CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS_NORMAL
@ CLOTH_SIMSETTINGS_FLAG_PRESSURE_VOL
@ CLOTH_SIMSETTINGS_FLAG_SEW
@ CLOTH_SIMSETTINGS_FLAG_PRESSURE
@ CLOTH_SIMSETTINGS_FLAG_TEARING
@ CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS
@ eModifierType_Cloth
Object is a sort of wrapper for general info.
@ PROP_FLOAT
Definition RNA_types.hh:67
@ PROP_BOOLEAN
Definition RNA_types.hh:65
@ PROP_ENUM
Definition RNA_types.hh:69
@ PROP_INT
Definition RNA_types.hh:66
@ PROP_STRING
Definition RNA_types.hh:68
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_UNIT_MASS
Definition RNA_types.hh:80
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:355
PropertyFlag
Definition RNA_types.hh:201
@ PROP_ANIMATABLE
Definition RNA_types.hh:220
@ PROP_EDITABLE
Definition RNA_types.hh:207
@ PROP_ENUM_FLAG
Definition RNA_types.hh:293
@ PROP_DISTANCE
Definition RNA_types.hh:159
@ PROP_ACCELERATION
Definition RNA_types.hh:167
@ PROP_ANGLE
Definition RNA_types.hh:155
@ PROP_NONE
Definition RNA_types.hh:136
@ PROP_FACTOR
Definition RNA_types.hh:154
@ PROP_UNSIGNED
Definition RNA_types.hh:152
@ SIM_SOLVER_SUCCESS
@ SIM_SOLVER_INVALID_INPUT
@ SIM_SOLVER_NUMERICAL_ISSUE
@ SIM_SOLVER_NO_CONVERGENCE
#define ND_MODIFIER
Definition WM_types.hh:429
#define NC_OBJECT
Definition WM_types.hh:346
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
void RNA_def_cloth(BlenderRNA *brna)
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
Definition rna_cloth.cc:554
static void rna_def_cloth_solver_result(BlenderRNA *brna)
Definition rna_cloth.cc:484
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_define_verify_sdna(bool verify)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
PointerRNA rna_object_shapekey_index_get(ID *id, int value)
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
#define FLT_MAX
Definition stdcycles.h:14
Definition DNA_ID.h:413
ID * owner_id
Definition RNA_types.hh:40
void * data
Definition RNA_types.hh:42
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126