Blender  V2.93
rna_cloth.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <limits.h>
22 #include <stdlib.h>
23 
24 #include "DNA_cloth_types.h"
25 #include "DNA_object_types.h"
26 #include "DNA_scene_types.h"
27 
28 #include "RNA_define.h"
29 
30 #include "rna_internal.h"
31 
32 #include "BLI_math.h"
33 
34 #include "BKE_cloth.h"
35 #include "BKE_modifier.h"
36 
37 #include "SIM_mass_spring.h"
38 
39 #include "WM_api.h"
40 #include "WM_types.h"
41 
42 #ifdef RNA_RUNTIME
43 
44 # include "BKE_context.h"
45 # include "DEG_depsgraph.h"
46 # include "DEG_depsgraph_build.h"
47 
48 static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
49 {
50  Object *ob = (Object *)ptr->owner_id;
51 
54 }
55 
56 static void rna_cloth_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
57 {
59  rna_cloth_update(bmain, scene, ptr);
60 }
61 
62 static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
63 {
64  Object *ob = (Object *)ptr->owner_id;
65  /* ClothSimSettings *settings = (ClothSimSettings *)ptr->data; */
68 
69  cloth_free_modifier(clmd);
70 
73 }
74 
75 static void rna_ClothSettings_bending_set(struct PointerRNA *ptr, float value)
76 {
77  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
78 
79  settings->bending = value;
80 
81  /* check for max clipping */
82  if (value > settings->max_bend) {
83  settings->max_bend = value;
84  }
85 }
86 
87 static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value)
88 {
89  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
90 
91  /* check for clipping */
92  if (value < settings->bending) {
93  value = settings->bending;
94  }
95 
96  settings->max_bend = value;
97 }
98 
99 static void rna_ClothSettings_tension_set(struct PointerRNA *ptr, float value)
100 {
101  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
102 
103  settings->tension = value;
104 
105  /* check for max clipping */
106  if (value > settings->max_tension) {
107  settings->max_tension = value;
108  }
109 }
110 
111 static void rna_ClothSettings_max_tension_set(struct PointerRNA *ptr, float value)
112 {
113  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
114 
115  /* check for clipping */
116  if (value < settings->tension) {
117  value = settings->tension;
118  }
119 
120  settings->max_tension = value;
121 }
122 
123 static void rna_ClothSettings_compression_set(struct PointerRNA *ptr, float value)
124 {
125  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
126 
127  settings->compression = value;
128 
129  /* check for max clipping */
130  if (value > settings->max_compression) {
131  settings->max_compression = value;
132  }
133 }
134 
135 static void rna_ClothSettings_max_compression_set(struct PointerRNA *ptr, float value)
136 {
137  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
138 
139  /* check for clipping */
140  if (value < settings->compression) {
141  value = settings->compression;
142  }
143 
144  settings->max_compression = value;
145 }
146 
147 static void rna_ClothSettings_shear_set(struct PointerRNA *ptr, float value)
148 {
149  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
150 
151  settings->shear = value;
152 
153  /* check for max clipping */
154  if (value > settings->max_shear) {
155  settings->max_shear = value;
156  }
157 }
158 
159 static void rna_ClothSettings_max_shear_set(struct PointerRNA *ptr, float value)
160 {
161  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
162 
163  /* check for clipping */
164  if (value < settings->shear) {
165  value = settings->shear;
166  }
167 
168  settings->max_shear = value;
169 }
170 
171 static void rna_ClothSettings_max_sewing_set(struct PointerRNA *ptr, float value)
172 {
173  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
174 
175  /* check for clipping */
176  if (value < 0.0f) {
177  value = 0.0f;
178  }
179 
180  settings->max_sewing = value;
181 }
182 
183 static void rna_ClothSettings_shrink_min_set(struct PointerRNA *ptr, float value)
184 {
185  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
186 
187  settings->shrink_min = value;
188 
189  /* check for max clipping */
190  if (value > settings->shrink_max) {
191  settings->shrink_max = value;
192  }
193 }
194 
195 static void rna_ClothSettings_shrink_max_set(struct PointerRNA *ptr, float value)
196 {
197  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
198 
199  /* check for clipping */
200  if (value < settings->shrink_min) {
201  value = settings->shrink_min;
202  }
203 
204  settings->shrink_max = value;
205 }
206 
207 static void rna_ClothSettings_internal_tension_set(struct PointerRNA *ptr, float value)
208 {
209  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
210 
211  settings->internal_tension = value;
212 
213  /* check for max clipping */
214  if (value > settings->max_internal_tension) {
215  settings->max_internal_tension = value;
216  }
217 }
218 
219 static void rna_ClothSettings_max_internal_tension_set(struct PointerRNA *ptr, float value)
220 {
221  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
222 
223  /* check for clipping */
224  if (value < settings->internal_tension) {
225  value = settings->internal_tension;
226  }
227 
228  settings->max_internal_tension = value;
229 }
230 
231 static void rna_ClothSettings_internal_compression_set(struct PointerRNA *ptr, float value)
232 {
233  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
234 
235  settings->internal_compression = value;
236 
237  /* check for max clipping */
238  if (value > settings->max_internal_compression) {
239  settings->max_internal_compression = value;
240  }
241 }
242 
243 static void rna_ClothSettings_max_internal_compression_set(struct PointerRNA *ptr, float value)
244 {
245  ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
246 
247  /* check for clipping */
248  if (value < settings->internal_compression) {
249  value = settings->internal_compression;
250  }
251 
252  settings->max_internal_compression = value;
253 }
254 
255 static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value)
256 {
259 }
260 
261 static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr)
262 {
265 }
266 
267 static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
268 {
271 }
272 
273 static void rna_ClothSettings_shrink_vgroup_get(PointerRNA *ptr, char *value)
274 {
277 }
278 
279 static int rna_ClothSettings_shrink_vgroup_length(PointerRNA *ptr)
280 {
283 }
284 
285 static void rna_ClothSettings_shrink_vgroup_set(PointerRNA *ptr, const char *value)
286 {
289 }
290 
291 static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value)
292 {
295 }
296 
297 static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr)
298 {
301 }
302 
303 static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value)
304 {
307 }
308 
309 static void rna_ClothSettings_shear_vgroup_get(PointerRNA *ptr, char *value)
310 {
313 }
314 
315 static int rna_ClothSettings_shear_vgroup_length(PointerRNA *ptr)
316 {
319 }
320 
321 static void rna_ClothSettings_shear_vgroup_set(PointerRNA *ptr, const char *value)
322 {
325 }
326 
327 static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value)
328 {
331 }
332 
333 static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr)
334 {
337 }
338 
339 static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value)
340 {
343 }
344 
345 static void rna_ClothSettings_internal_vgroup_get(PointerRNA *ptr, char *value)
346 {
349 }
350 
351 static int rna_ClothSettings_internal_vgroup_length(PointerRNA *ptr)
352 {
355 }
356 
357 static void rna_ClothSettings_internal_vgroup_set(PointerRNA *ptr, const char *value)
358 {
361 }
362 
363 static void rna_ClothSettings_pressure_vgroup_get(PointerRNA *ptr, char *value)
364 {
367 }
368 
369 static int rna_ClothSettings_pressure_vgroup_length(PointerRNA *ptr)
370 {
373 }
374 
375 static void rna_ClothSettings_pressure_vgroup_set(PointerRNA *ptr, const char *value)
376 {
379 }
380 
381 static void rna_CollSettings_selfcol_vgroup_get(PointerRNA *ptr, char *value)
382 {
385 }
386 
387 static int rna_CollSettings_selfcol_vgroup_length(PointerRNA *ptr)
388 {
391 }
392 
393 static void rna_CollSettings_selfcol_vgroup_set(PointerRNA *ptr, const char *value)
394 {
397 }
398 
399 static void rna_CollSettings_objcol_vgroup_get(PointerRNA *ptr, char *value)
400 {
403 }
404 
405 static int rna_CollSettings_objcol_vgroup_length(PointerRNA *ptr)
406 {
409 }
410 
411 static void rna_CollSettings_objcol_vgroup_set(PointerRNA *ptr, const char *value)
412 {
415 }
416 
417 static PointerRNA rna_ClothSettings_rest_shape_key_get(PointerRNA *ptr)
418 {
419  Object *ob = (Object *)ptr->owner_id;
421 
423 }
424 
425 static void rna_ClothSettings_rest_shape_key_set(PointerRNA *ptr,
426  PointerRNA value,
427  struct ReportList *UNUSED(reports))
428 {
429  Object *ob = (Object *)ptr->owner_id;
431 
433 }
434 
435 static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values)
436 {
438 
439  values[0] = sim->gravity[0];
440  values[1] = sim->gravity[1];
441  values[2] = sim->gravity[2];
442 }
443 
444 static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
445 {
447 
448  sim->gravity[0] = values[0];
449  sim->gravity[1] = values[1];
450  sim->gravity[2] = values[2];
451 }
452 
453 static char *rna_ClothSettings_path(PointerRNA *ptr)
454 {
455  Object *ob = (Object *)ptr->owner_id;
457 
458  if (md) {
459  char name_esc[sizeof(md->name) * 2];
460  BLI_str_escape(name_esc, md->name, sizeof(name_esc));
461  return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
462  }
463  else {
464  return NULL;
465  }
466 }
467 
468 static char *rna_ClothCollisionSettings_path(PointerRNA *ptr)
469 {
470  Object *ob = (Object *)ptr->owner_id;
472 
473  if (md) {
474  char name_esc[sizeof(md->name) * 2];
475  BLI_str_escape(name_esc, md->name, sizeof(name_esc));
476  return BLI_sprintfN("modifiers[\"%s\"].collision_settings", name_esc);
477  }
478  else {
479  return NULL;
480  }
481 }
482 
483 static int rna_ClothSettings_internal_editable(struct PointerRNA *ptr, const char **r_info)
484 {
486 
487  if (sim && (sim->bending_model == CLOTH_BENDING_LINEAR)) {
488  *r_info = "Only available with angular bending springs.";
489  return 0;
490  }
491 
492  return sim ? PROP_EDITABLE : 0;
493 }
494 
495 #else
496 
498 {
499  StructRNA *srna;
500  PropertyRNA *prop;
501 
502  static const EnumPropertyItem status_items[] = {
503  {SIM_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"},
505  "NUMERICAL_ISSUE",
506  0,
507  "Numerical Issue",
508  "The provided data did not satisfy the prerequisites"},
510  "NO_CONVERGENCE",
511  0,
512  "No Convergence",
513  "Iterative procedure did not converge"},
515  "INVALID_INPUT",
516  0,
517  "Invalid Input",
518  "The inputs are invalid, or the algorithm has been improperly called"},
519  {0, NULL, 0, NULL, NULL},
520  };
521 
522  srna = RNA_def_struct(brna, "ClothSolverResult", NULL);
523  RNA_def_struct_ui_text(srna, "Solver Result", "Result of cloth solver iteration");
524 
526 
527  prop = RNA_def_property(srna, "status", PROP_ENUM, PROP_NONE);
528  RNA_def_property_enum_items(prop, status_items);
529  RNA_def_property_enum_sdna(prop, NULL, "status");
532  RNA_def_property_ui_text(prop, "Status", "Status of the solver iteration");
533 
534  prop = RNA_def_property(srna, "max_error", PROP_FLOAT, PROP_NONE);
535  RNA_def_property_float_sdna(prop, NULL, "max_error");
537  RNA_def_property_ui_text(prop, "Maximum Error", "Maximum error during substeps");
538 
539  prop = RNA_def_property(srna, "min_error", PROP_FLOAT, PROP_NONE);
540  RNA_def_property_float_sdna(prop, NULL, "min_error");
542  RNA_def_property_ui_text(prop, "Minimum Error", "Minimum error during substeps");
543 
544  prop = RNA_def_property(srna, "avg_error", PROP_FLOAT, PROP_NONE);
545  RNA_def_property_float_sdna(prop, NULL, "avg_error");
547  RNA_def_property_ui_text(prop, "Average Error", "Average error during substeps");
548 
549  prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
550  RNA_def_property_int_sdna(prop, NULL, "max_iterations");
552  RNA_def_property_ui_text(prop, "Maximum Iterations", "Maximum iterations during substeps");
553 
554  prop = RNA_def_property(srna, "min_iterations", PROP_INT, PROP_NONE);
555  RNA_def_property_int_sdna(prop, NULL, "min_iterations");
557  RNA_def_property_ui_text(prop, "Minimum Iterations", "Minimum iterations during substeps");
558 
559  prop = RNA_def_property(srna, "avg_iterations", PROP_FLOAT, PROP_NONE);
560  RNA_def_property_float_sdna(prop, NULL, "avg_iterations");
562  RNA_def_property_ui_text(prop, "Average Iterations", "Average iterations during substeps");
563 
565 }
566 
568 {
569  StructRNA *srna;
570  PropertyRNA *prop;
571 
572  static const EnumPropertyItem prop_bending_model_items[] = {
573  {CLOTH_BENDING_ANGULAR, "ANGULAR", 0, "Angular", "Cloth model with angular bending springs"},
575  "LINEAR",
576  0,
577  "Linear",
578  "Cloth model with linear bending springs (legacy)"},
579  {0, NULL, 0, NULL, NULL},
580  };
581 
582  srna = RNA_def_struct(brna, "ClothSettings", NULL);
583  RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object");
584  RNA_def_struct_sdna(srna, "ClothSimSettings");
585  RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
586 
587  /* goal */
588 
589  prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
590  RNA_def_property_float_sdna(prop, NULL, "mingoal");
591  RNA_def_property_range(prop, 0.0f, 1.0f);
593  prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range");
594  RNA_def_property_update(prop, 0, "rna_cloth_update");
595 
596  prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
597  RNA_def_property_float_sdna(prop, NULL, "maxgoal");
598  RNA_def_property_range(prop, 0.0f, 1.0f);
600  prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range");
601  RNA_def_property_update(prop, 0, "rna_cloth_update");
602 
603  prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
604  RNA_def_property_float_sdna(prop, NULL, "defgoal");
605  RNA_def_property_range(prop, 0.0f, 1.0f);
607  prop,
608  "Goal Default",
609  "Default Goal (vertex target position) value, when no Vertex Group used");
610  RNA_def_property_update(prop, 0, "rna_cloth_update");
611 
612  prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
613  RNA_def_property_float_sdna(prop, NULL, "goalspring");
614  RNA_def_property_range(prop, 0.0f, 0.999f);
616  prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
617  RNA_def_property_update(prop, 0, "rna_cloth_update");
618 
619  prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
620  RNA_def_property_float_sdna(prop, NULL, "goalfrict");
621  RNA_def_property_range(prop, 0.0f, 50.0f);
622  RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
623  RNA_def_property_update(prop, 0, "rna_cloth_update");
624 
625  prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_FACTOR);
626  RNA_def_property_float_sdna(prop, NULL, "velocity_smooth");
627  RNA_def_property_range(prop, 0.0f, 1.0f);
628  RNA_def_property_ui_text(prop, "Internal Friction", "");
629  RNA_def_property_update(prop, 0, "rna_cloth_update");
630 
631  prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_FACTOR);
632  RNA_def_property_float_sdna(prop, NULL, "collider_friction");
633  RNA_def_property_range(prop, 0.0f, 1.0f);
634  RNA_def_property_ui_text(prop, "Collider Friction", "");
635  RNA_def_property_update(prop, 0, "rna_cloth_update");
636 
637  prop = RNA_def_property(srna, "density_target", PROP_FLOAT, PROP_NONE);
638  RNA_def_property_float_sdna(prop, NULL, "density_target");
639  RNA_def_property_range(prop, 0.0f, 10000.0f);
640  RNA_def_property_ui_text(prop, "Target Density", "Maximum density of hair");
641  RNA_def_property_update(prop, 0, "rna_cloth_update");
642 
643  prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_FACTOR);
644  RNA_def_property_float_sdna(prop, NULL, "density_strength");
645  RNA_def_property_range(prop, 0.0f, 1.0f);
647  prop, "Target Density Strength", "Influence of target density on the simulation");
648  RNA_def_property_update(prop, 0, "rna_cloth_update");
649 
650  /* mass */
651 
652  prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
653  RNA_def_property_range(prop, 0.0f, FLT_MAX);
654  RNA_def_property_ui_text(prop, "Vertex Mass", "The mass of each vertex on the cloth material");
656  RNA_def_property_update(prop, 0, "rna_cloth_update");
657 
658  prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
660  "rna_ClothSettings_mass_vgroup_get",
661  "rna_ClothSettings_mass_vgroup_length",
662  "rna_ClothSettings_mass_vgroup_set");
663  RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
664  RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
665 
666  prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
667  RNA_def_property_array(prop, 3);
668  RNA_def_property_range(prop, -100.0, 100.0);
670  prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL);
671  RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector");
672  RNA_def_property_update(prop, 0, "rna_cloth_update");
673 
674  /* various */
675 
676  prop = RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
677  RNA_def_property_float_sdna(prop, NULL, "Cvi");
678  RNA_def_property_range(prop, 0.0f, 10.0f);
680  prop, "Air Damping", "Air has normally some thickness which slows falling things down");
681  RNA_def_property_update(prop, 0, "rna_cloth_update");
682 
683  prop = RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
684  RNA_def_property_float_sdna(prop, NULL, "goalspring");
685  RNA_def_property_range(prop, 0.0f, 50.0);
686  RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness");
687  RNA_def_property_update(prop, 0, "rna_cloth_update");
688 
689  prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
690  RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame");
691  RNA_def_property_range(prop, 1, INT_MAX);
692  RNA_def_property_ui_range(prop, 1, 80, 1, -1);
694  prop,
695  "Quality",
696  "Quality of the simulation in steps per frame (higher is better quality but slower)");
697  RNA_def_property_update(prop, 0, "rna_cloth_update");
698 
699  prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
700  RNA_def_property_float_sdna(prop, NULL, "time_scale");
701  RNA_def_property_range(prop, 0.0f, FLT_MAX);
702  RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
703  RNA_def_property_ui_text(prop, "Speed", "Cloth speed is multiplied by this value");
704  RNA_def_property_update(prop, 0, "rna_cloth_update");
705 
706  prop = RNA_def_property(srna, "vertex_group_shrink", PROP_STRING, PROP_NONE);
708  "rna_ClothSettings_shrink_vgroup_get",
709  "rna_ClothSettings_shrink_vgroup_length",
710  "rna_ClothSettings_shrink_vgroup_set");
711  RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
712  RNA_def_property_update(prop, 0, "rna_cloth_update");
713 
714  prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_FACTOR);
715  RNA_def_property_float_sdna(prop, NULL, "shrink_min");
716  RNA_def_property_range(prop, -FLT_MAX, 1.0f);
717  RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.05f, 3);
718  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_min_set", NULL);
719  RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
720  RNA_def_property_update(prop, 0, "rna_cloth_update");
721 
722  prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_FACTOR);
723  RNA_def_property_float_sdna(prop, NULL, "shrink_max");
724  RNA_def_property_range(prop, -FLT_MAX, 1.0f);
725  RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.05f, 3);
726  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_max_set", NULL);
727  RNA_def_property_ui_text(prop, "Shrink Factor Max", "Max amount to shrink cloth by");
728  RNA_def_property_update(prop, 0, "rna_cloth_update");
729 
730  prop = RNA_def_property(srna, "voxel_cell_size", PROP_FLOAT, PROP_UNSIGNED);
731  RNA_def_property_float_sdna(prop, NULL, "voxel_cell_size");
732  RNA_def_property_range(prop, 0.0001f, 10000.0f);
734  prop, "Voxel Grid Cell Size", "Size of the voxel grid cells for interaction effects");
735  RNA_def_property_update(prop, 0, "rna_cloth_update");
736 
737  /* springs */
738  prop = RNA_def_property(srna, "tension_damping", PROP_FLOAT, PROP_NONE);
739  RNA_def_property_float_sdna(prop, NULL, "tension_damp");
740  RNA_def_property_range(prop, 0.0f, 50.0f);
742  prop, "Tension Spring Damping", "Amount of damping in stretching behavior");
743  RNA_def_property_update(prop, 0, "rna_cloth_update");
744 
745  prop = RNA_def_property(srna, "compression_damping", PROP_FLOAT, PROP_NONE);
746  RNA_def_property_float_sdna(prop, NULL, "compression_damp");
747  RNA_def_property_range(prop, 0.0f, 50.0f);
749  prop, "Compression Spring Damping", "Amount of damping in compression behavior");
750  RNA_def_property_update(prop, 0, "rna_cloth_update");
751 
752  prop = RNA_def_property(srna, "shear_damping", PROP_FLOAT, PROP_NONE);
753  RNA_def_property_float_sdna(prop, NULL, "shear_damp");
754  RNA_def_property_range(prop, 0.0f, 50.0f);
755  RNA_def_property_ui_text(prop, "Shear Spring Damping", "Amount of damping in shearing behavior");
756  RNA_def_property_update(prop, 0, "rna_cloth_update");
757 
758  prop = RNA_def_property(srna, "tension_stiffness", PROP_FLOAT, PROP_NONE);
759  RNA_def_property_float_sdna(prop, NULL, "tension");
760  RNA_def_property_range(prop, 0.0f, 10000.0f);
761  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_tension_set", NULL);
762  RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
763  RNA_def_property_update(prop, 0, "rna_cloth_update");
764 
765  prop = RNA_def_property(srna, "tension_stiffness_max", PROP_FLOAT, PROP_NONE);
766  RNA_def_property_float_sdna(prop, NULL, "max_tension");
767  RNA_def_property_range(prop, 0.0f, 10000.0f);
768  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_tension_set", NULL);
769  RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
770  RNA_def_property_update(prop, 0, "rna_cloth_update");
771 
772  prop = RNA_def_property(srna, "compression_stiffness", PROP_FLOAT, PROP_NONE);
773  RNA_def_property_float_sdna(prop, NULL, "compression");
774  RNA_def_property_range(prop, 0.0f, 10000.0f);
775  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_compression_set", NULL);
777  prop, "Compression Stiffness", "How much the material resists compression");
778  RNA_def_property_update(prop, 0, "rna_cloth_update");
779 
780  prop = RNA_def_property(srna, "compression_stiffness_max", PROP_FLOAT, PROP_NONE);
781  RNA_def_property_float_sdna(prop, NULL, "max_compression");
782  RNA_def_property_range(prop, 0.0f, 10000.0f);
783  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_compression_set", NULL);
785  prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
786  RNA_def_property_update(prop, 0, "rna_cloth_update");
787 
788  prop = RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
789  RNA_def_property_float_sdna(prop, NULL, "shear");
790  RNA_def_property_range(prop, 0.0f, 10000.0f);
791  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shear_set", NULL);
792  RNA_def_property_ui_text(prop, "Shear Stiffness", "How much the material resists shearing");
793  RNA_def_property_update(prop, 0, "rna_cloth_update");
794 
795  prop = RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
796  RNA_def_property_float_sdna(prop, NULL, "max_shear");
797  RNA_def_property_range(prop, 0.0f, 10000.0f);
798  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_shear_set", NULL);
799  RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value");
800  RNA_def_property_update(prop, 0, "rna_cloth_update");
801 
802  prop = RNA_def_property(srna, "sewing_force_max", PROP_FLOAT, PROP_NONE);
803  RNA_def_property_float_sdna(prop, NULL, "max_sewing");
804  RNA_def_property_range(prop, 0.0f, 10000.0f);
805  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_sewing_set", NULL);
806  RNA_def_property_ui_text(prop, "Sewing Force Max", "Maximum sewing force");
807  RNA_def_property_update(prop, 0, "rna_cloth_update");
808 
809  prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
811  "rna_ClothSettings_struct_vgroup_get",
812  "rna_ClothSettings_struct_vgroup_length",
813  "rna_ClothSettings_struct_vgroup_set");
815  "Structural Stiffness Vertex Group",
816  "Vertex group for fine control over structural stiffness");
817  RNA_def_property_update(prop, 0, "rna_cloth_update");
818 
819  prop = RNA_def_property(srna, "vertex_group_shear_stiffness", PROP_STRING, PROP_NONE);
821  "rna_ClothSettings_shear_vgroup_get",
822  "rna_ClothSettings_shear_vgroup_length",
823  "rna_ClothSettings_shear_vgroup_set");
825  prop, "Shear Stiffness Vertex Group", "Vertex group for fine control over shear stiffness");
826  RNA_def_property_update(prop, 0, "rna_cloth_update");
827 
828  prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
829  RNA_def_property_float_sdna(prop, NULL, "bending");
830  RNA_def_property_range(prop, 0.0f, 10000.0f);
831  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_bending_set", NULL);
832  RNA_def_property_ui_text(prop, "Bending Stiffness", "How much the material resists bending");
833  RNA_def_property_update(prop, 0, "rna_cloth_update");
834 
835  prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
836  RNA_def_property_float_sdna(prop, NULL, "max_bend");
837  RNA_def_property_range(prop, 0.0f, 10000.0f);
838  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL);
839  RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
840  RNA_def_property_update(prop, 0, "rna_cloth_update");
841 
842  prop = RNA_def_property(srna, "bending_damping", PROP_FLOAT, PROP_NONE);
843  RNA_def_property_float_sdna(prop, NULL, "bending_damping");
844  RNA_def_property_range(prop, 0.0f, 1000.0f);
846  prop, "Bending Spring Damping", "Amount of damping in bending behavior");
847  RNA_def_property_update(prop, 0, "rna_cloth_update");
848 
849  prop = RNA_def_property(srna, "use_sewing_springs", PROP_BOOLEAN, PROP_NONE);
851  RNA_def_property_ui_text(prop, "Sew Cloth", "Pulls loose edges together");
853  RNA_def_property_update(prop, 0, "rna_cloth_update");
854 
855  prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
857  "rna_ClothSettings_bend_vgroup_get",
858  "rna_ClothSettings_bend_vgroup_length",
859  "rna_ClothSettings_bend_vgroup_set");
861  "Bending Stiffness Vertex Group",
862  "Vertex group for fine control over bending stiffness");
863  RNA_def_property_update(prop, 0, "rna_cloth_update");
864 
865  prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
866  RNA_def_property_struct_type(prop, "EffectorWeights");
868  RNA_def_property_ui_text(prop, "Effector Weights", "");
869 
870  prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
872  RNA_def_property_struct_type(prop, "ShapeKey");
874  "rna_ClothSettings_rest_shape_key_get",
875  "rna_ClothSettings_rest_shape_key_set",
876  NULL,
877  NULL);
879  prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
880  RNA_def_property_update(prop, 0, "rna_cloth_update");
881 
882  prop = RNA_def_property(srna, "use_dynamic_mesh", PROP_BOOLEAN, PROP_NONE);
885  prop, "Dynamic Base Mesh", "Make simulation respect deformations in the base mesh");
886  RNA_def_property_update(prop, 0, "rna_cloth_update");
888 
889  prop = RNA_def_property(srna, "bending_model", PROP_ENUM, PROP_NONE);
890  RNA_def_property_enum_sdna(prop, NULL, "bending_model");
891  RNA_def_property_enum_items(prop, prop_bending_model_items);
892  RNA_def_property_ui_text(prop, "Bending Model", "Physical model for simulating bending forces");
893  RNA_def_property_update(prop, 0, "rna_cloth_update");
895 
896  prop = RNA_def_property(srna, "use_internal_springs", PROP_BOOLEAN, PROP_NONE);
899  "Create Internal Springs",
900  "Simulate an internal volume structure by creating springs connecting "
901  "the opposite sides of the mesh");
902  RNA_def_property_update(prop, 0, "rna_cloth_update");
904 
905  prop = RNA_def_property(srna, "internal_spring_normal_check", PROP_BOOLEAN, PROP_NONE);
909  "Check Internal Spring Normals",
910  "Require the points the internal springs connect to have opposite "
911  "normal directions");
912  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
913  RNA_def_property_update(prop, 0, "rna_cloth_update");
915 
916  prop = RNA_def_property(srna, "internal_spring_max_length", PROP_FLOAT, PROP_NONE);
917  RNA_def_property_float_sdna(prop, NULL, "internal_spring_max_length");
918  RNA_def_property_range(prop, 0.0f, 1000.0f);
920  prop,
921  "Internal Spring Max Length",
922  "The maximum length an internal spring can have during creation. If the distance between "
923  "internal points is greater than this, no internal spring will be created between these "
924  "points. "
925  "A length of zero means that there is no length limit");
926  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
927  RNA_def_property_update(prop, 0, "rna_cloth_update");
929 
930  prop = RNA_def_property(srna, "internal_spring_max_diversion", PROP_FLOAT, PROP_ANGLE);
931  RNA_def_property_float_sdna(prop, NULL, "internal_spring_max_diversion");
932  RNA_def_property_range(prop, 0.0f, M_PI / 4.0f);
934  "Internal Spring Max Diversion",
935  "How much the rays used to connect the internal points can diverge "
936  "from the vertex normal");
937  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
938  RNA_def_property_update(prop, 0, "rna_cloth_update");
940 
941  prop = RNA_def_property(srna, "internal_tension_stiffness", PROP_FLOAT, PROP_NONE);
942  RNA_def_property_float_sdna(prop, NULL, "internal_tension");
943  RNA_def_property_range(prop, 0.0f, 10000.0f);
944  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_internal_tension_set", NULL);
945  RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
946  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
947  RNA_def_property_update(prop, 0, "rna_cloth_update");
948 
949  prop = RNA_def_property(srna, "internal_tension_stiffness_max", PROP_FLOAT, PROP_NONE);
950  RNA_def_property_float_sdna(prop, NULL, "max_internal_tension");
951  RNA_def_property_range(prop, 0.0f, 10000.0f);
952  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_internal_tension_set", NULL);
953  RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
954  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
955  RNA_def_property_update(prop, 0, "rna_cloth_update");
956 
957  prop = RNA_def_property(srna, "internal_compression_stiffness", PROP_FLOAT, PROP_NONE);
958  RNA_def_property_float_sdna(prop, NULL, "internal_compression");
959  RNA_def_property_range(prop, 0.0f, 10000.0f);
960  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_internal_compression_set", NULL);
962  prop, "Compression Stiffness", "How much the material resists compression");
963  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
964  RNA_def_property_update(prop, 0, "rna_cloth_update");
965 
966  prop = RNA_def_property(srna, "internal_compression_stiffness_max", PROP_FLOAT, PROP_NONE);
967  RNA_def_property_float_sdna(prop, NULL, "max_internal_compression");
968  RNA_def_property_range(prop, 0.0f, 10000.0f);
969  RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_internal_compression_set", NULL);
971  prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
972  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
973  RNA_def_property_update(prop, 0, "rna_cloth_update");
974 
975  prop = RNA_def_property(srna, "vertex_group_intern", PROP_STRING, PROP_NONE);
977  "rna_ClothSettings_internal_vgroup_get",
978  "rna_ClothSettings_internal_vgroup_length",
979  "rna_ClothSettings_internal_vgroup_set");
981  "Internal Springs Vertex Group",
982  "Vertex group for fine control over the internal spring stiffness");
983  RNA_def_property_editable_func(prop, "rna_ClothSettings_internal_editable");
984  RNA_def_property_update(prop, 0, "rna_cloth_update");
985 
986  /* Pressure */
987 
988  prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
990  RNA_def_property_ui_text(prop, "Use Pressure", "Simulate pressure inside a closed cloth mesh");
992  RNA_def_property_update(prop, 0, "rna_cloth_update");
993 
994  prop = RNA_def_property(srna, "use_pressure_volume", PROP_BOOLEAN, PROP_NONE);
997  "Use Custom Volume",
998  "Use the Target Volume parameter as the initial volume, instead "
999  "of calculating it from the mesh itself");
1001  RNA_def_property_update(prop, 0, "rna_cloth_update");
1002 
1003  prop = RNA_def_property(srna, "uniform_pressure_force", PROP_FLOAT, PROP_NONE);
1004  RNA_def_property_float_sdna(prop, NULL, "uniform_pressure_force");
1005  RNA_def_property_range(prop, -10000.0f, 10000.0f);
1006  RNA_def_property_float_default(prop, 0.0f);
1008  "Pressure",
1009  "The uniform pressure that is constantly applied to the mesh, in units "
1010  "of Pressure Scale. Can be negative");
1011  RNA_def_property_update(prop, 0, "rna_cloth_update");
1012 
1013  prop = RNA_def_property(srna, "target_volume", PROP_FLOAT, PROP_NONE);
1014  RNA_def_property_float_sdna(prop, NULL, "target_volume");
1015  RNA_def_property_range(prop, 0.0f, 10000.0f);
1016  RNA_def_property_float_default(prop, 0.0f);
1018  "Target Volume",
1019  "The mesh volume where the inner/outer pressure will be the same. If "
1020  "set to zero the change in volume will not affect pressure");
1021  RNA_def_property_update(prop, 0, "rna_cloth_update");
1022 
1023  prop = RNA_def_property(srna, "pressure_factor", PROP_FLOAT, PROP_NONE);
1024  RNA_def_property_float_sdna(prop, NULL, "pressure_factor");
1025  RNA_def_property_range(prop, 0.0f, 10000.0f);
1027  "Pressure Scale",
1028  "Ambient pressure (kPa) that balances out between the inside and "
1029  "outside of the object when it has the target volume");
1030  RNA_def_property_update(prop, 0, "rna_cloth_update");
1031 
1032  prop = RNA_def_property(srna, "fluid_density", PROP_FLOAT, PROP_NONE);
1033  RNA_def_property_float_sdna(prop, NULL, "fluid_density");
1034  RNA_def_property_ui_range(prop, -2.0f, 2.0f, 0.05f, 4);
1036  prop,
1037  "Fluid Density",
1038  "Density (kg/l) of the fluid contained inside the object, used to create "
1039  "a hydrostatic pressure gradient simulating the weight of the internal fluid, "
1040  "or buoyancy from the surrounding fluid if negative");
1041  RNA_def_property_update(prop, 0, "rna_cloth_update");
1042 
1043  prop = RNA_def_property(srna, "vertex_group_pressure", PROP_STRING, PROP_NONE);
1045  "rna_ClothSettings_pressure_vgroup_get",
1046  "rna_ClothSettings_pressure_vgroup_length",
1047  "rna_ClothSettings_pressure_vgroup_set");
1049  prop,
1050  "Pressure Vertex Group",
1051  "Vertex Group for where to apply pressure. Zero weight means no "
1052  "pressure while a weight of one means full pressure. Faces with a vertex "
1053  "that has zero weight will be excluded from the volume calculation");
1054  RNA_def_property_update(prop, 0, "rna_cloth_update");
1055 
1056  /* unused */
1057 
1058  /* unused still */
1059 # if 0
1060  prop = RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
1061  RNA_def_property_float_sdna(prop, NULL, "eff_force_scale");
1062  RNA_def_property_range(prop, 0.0f, 100.0f);
1063  RNA_def_property_ui_text(prop, "Effector Force Scale", "");
1064 # endif
1065  /* unused still */
1066 # if 0
1067  prop = RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
1068  RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale");
1069  RNA_def_property_range(prop, 0.0f, 100.0f);
1070  RNA_def_property_ui_text(prop, "Effector Wind Scale", "");
1071 # endif
1072  /* unused still */
1073 # if 0
1074  prop = RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
1076  RNA_def_property_ui_text(prop, "Tearing", "");
1077 # endif
1078  /* unused still */
1079 # if 0
1080  prop = RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
1081  RNA_def_property_int_sdna(prop, NULL, "maxspringlen");
1082  RNA_def_property_range(prop, 1.0, 1000.0);
1084  prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
1085 # endif
1086 }
1087 
1089 {
1090  StructRNA *srna;
1091  PropertyRNA *prop;
1092 
1093  srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL);
1095  srna,
1096  "Cloth Collision Settings",
1097  "Cloth simulation settings for self collision and collision with other objects");
1098  RNA_def_struct_sdna(srna, "ClothCollSettings");
1099  RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
1100 
1101  /* general collision */
1102 
1103  prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
1105  RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
1106  RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
1107 
1108  prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
1109  RNA_def_property_float_sdna(prop, NULL, "epsilon");
1110  RNA_def_property_range(prop, 0.001f, 1.0f);
1112  prop,
1113  "Minimum Distance",
1114  "Minimum distance between collision objects before collision response takes effect");
1115  RNA_def_property_update(prop, 0, "rna_cloth_update");
1116 
1117  prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
1118  RNA_def_property_range(prop, 0.0f, 80.0f);
1120  prop, "Friction", "Friction force if a collision happened (higher = less movement)");
1121  RNA_def_property_update(prop, 0, "rna_cloth_update");
1122 
1123  prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
1124  RNA_def_property_float_sdna(prop, NULL, "damping");
1125  RNA_def_property_range(prop, 0.0f, 1.0f);
1126  RNA_def_property_float_default(prop, 1.0f);
1127  RNA_def_property_ui_text(prop, "Restitution", "Amount of velocity lost on collision");
1128  RNA_def_property_update(prop, 0, "rna_cloth_update");
1129 
1130  prop = RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
1131  RNA_def_property_int_sdna(prop, NULL, "loop_count");
1132  RNA_def_property_range(prop, 1, SHRT_MAX);
1133  RNA_def_property_ui_range(prop, 1, 20, 1, -1);
1135  prop,
1136  "Collision Quality",
1137  "How many collision iterations should be done. (higher is better quality but slower)");
1138  RNA_def_property_update(prop, 0, "rna_cloth_update");
1139 
1140  prop = RNA_def_property(srna, "impulse_clamp", PROP_FLOAT, PROP_NONE);
1141  RNA_def_property_float_sdna(prop, NULL, "clamp");
1142  RNA_def_property_range(prop, 0.0f, 100.0f);
1144  prop,
1145  "Impulse Clamping",
1146  "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1147  RNA_def_property_update(prop, 0, "rna_cloth_update");
1148 
1149  /* self collision */
1150 
1151  prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
1153  RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
1154  RNA_def_property_update(prop, 0, "rna_cloth_update");
1155 
1156  prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_DISTANCE);
1157  RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
1158  RNA_def_property_range(prop, 0.001f, 0.1f);
1160  prop,
1161  "Self Minimum Distance",
1162  "Minimum distance between cloth faces before collision response takes effect");
1163  RNA_def_property_update(prop, 0, "rna_cloth_update");
1164 
1165  prop = RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
1166  RNA_def_property_range(prop, 0.0f, 80.0f);
1167  RNA_def_property_ui_text(prop, "Self Friction", "Friction with self contact");
1168  RNA_def_property_update(prop, 0, "rna_cloth_update");
1169 
1170  prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
1171  RNA_def_property_pointer_sdna(prop, NULL, "group");
1174  RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection");
1175  RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
1176 
1177  prop = RNA_def_property(srna, "vertex_group_self_collisions", PROP_STRING, PROP_NONE);
1179  "rna_CollSettings_selfcol_vgroup_get",
1180  "rna_CollSettings_selfcol_vgroup_length",
1181  "rna_CollSettings_selfcol_vgroup_set");
1183  prop,
1184  "Selfcollision Vertex Group",
1185  "Triangles with all vertices in this group are not used during self collisions");
1186  RNA_def_property_update(prop, 0, "rna_cloth_update");
1187 
1188  prop = RNA_def_property(srna, "vertex_group_object_collisions", PROP_STRING, PROP_NONE);
1190  "rna_CollSettings_objcol_vgroup_get",
1191  "rna_CollSettings_objcol_vgroup_length",
1192  "rna_CollSettings_objcol_vgroup_set");
1194  prop,
1195  "Collision Vertex Group",
1196  "Triangles with all vertices in this group are not used during object collisions");
1197  RNA_def_property_update(prop, 0, "rna_cloth_update");
1198 
1199  prop = RNA_def_property(srna, "self_impulse_clamp", PROP_FLOAT, PROP_NONE);
1200  RNA_def_property_float_sdna(prop, NULL, "self_clamp");
1201  RNA_def_property_range(prop, 0.0f, 100.0f);
1203  prop,
1204  "Impulse Clamping",
1205  "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1206  RNA_def_property_update(prop, 0, "rna_cloth_update");
1207 }
1208 
1210 {
1214 }
1215 
1216 #endif
void cloth_free_modifier(struct ClothModifierData *clmd)
Definition: cloth.c:430
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
#define M_PI
Definition: BLI_math_base.h:38
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, const size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:333
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ 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.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_UNIT_MASS
Definition: RNA_types.h:88
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_ENUM_FLAG
Definition: RNA_types.h:251
@ PROP_DISTANCE
Definition: RNA_types.h:135
@ PROP_ACCELERATION
Definition: RNA_types.h:143
@ PROP_ANGLE
Definition: RNA_types.h:132
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_FACTOR
Definition: RNA_types.h:131
@ PROP_UNSIGNED
Definition: RNA_types.h:129
@ SIM_SOLVER_SUCCESS
@ SIM_SOLVER_INVALID_INPUT
@ SIM_SOLVER_NUMERICAL_ISSUE
@ SIM_SOLVER_NO_CONVERGENCE
#define ND_MODIFIER
Definition: WM_types.h:363
#define NC_OBJECT
Definition: WM_types.h:280
Scene scene
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
Definition: rna_cloth.c:1088
void RNA_def_cloth(BlenderRNA *brna)
Definition: rna_cloth.c:1209
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
Definition: rna_cloth.c:567
static void rna_def_cloth_solver_result(BlenderRNA *brna)
Definition: rna_cloth.c:497
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1212
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2042
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_define_verify_sdna(bool verify)
Definition: rna_define.c:751
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2877
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current)
void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index)
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index)
PointerRNA rna_object_shapekey_index_get(struct ID *id, int value)
int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index)
float max_internal_compression
Definition: BKE_main.h:116
void * data
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157