32# include <fmt/format.h>
49 Object *ob = id_cast<Object *>(ptr->owner_id);
58 rna_cloth_update(bmain, scene, ptr);
63 Object *ob = id_cast<Object *>(ptr->owner_id);
74static void rna_ClothSettings_bending_set(
PointerRNA *ptr,
float value)
81 settings->max_bend = std::max(value, settings->max_bend);
84static void rna_ClothSettings_max_bend_set(
PointerRNA *ptr,
float value)
89 value = std::max(value, settings->bending);
91 settings->max_bend = value;
94static void rna_ClothSettings_tension_set(
PointerRNA *ptr,
float value)
101 settings->max_tension = std::max(value, settings->max_tension);
104static void rna_ClothSettings_max_tension_set(
PointerRNA *ptr,
float value)
109 value = std::max(value, settings->tension);
111 settings->max_tension = value;
114static void rna_ClothSettings_compression_set(
PointerRNA *ptr,
float value)
121 settings->max_compression = std::max(value, settings->max_compression);
124static void rna_ClothSettings_max_compression_set(
PointerRNA *ptr,
float value)
129 value = std::max(value, settings->compression);
131 settings->max_compression = value;
134static void rna_ClothSettings_shear_set(
PointerRNA *ptr,
float value)
138 settings->
shear = value;
141 settings->max_shear = std::max(value, settings->max_shear);
144static void rna_ClothSettings_max_shear_set(
PointerRNA *ptr,
float value)
149 value = std::max(value, settings->shear);
151 settings->max_shear = value;
154static void rna_ClothSettings_max_sewing_set(
PointerRNA *ptr,
float value)
159 value = std::max(value, 0.0f);
161 settings->max_sewing = value;
164static void rna_ClothSettings_shrink_min_set(
PointerRNA *ptr,
float value)
171 settings->shrink_max = std::max(value, settings->shrink_max);
174static void rna_ClothSettings_shrink_max_set(
PointerRNA *ptr,
float value)
179 value = std::max(value, settings->shrink_min);
181 settings->shrink_max = value;
184static void rna_ClothSettings_internal_tension_set(
PointerRNA *ptr,
float value)
191 settings->max_internal_tension = std::max(value, settings->max_internal_tension);
194static void rna_ClothSettings_max_internal_tension_set(
PointerRNA *ptr,
float value)
199 value = std::max(value, settings->internal_tension);
201 settings->max_internal_tension = value;
204static void rna_ClothSettings_internal_compression_set(
PointerRNA *ptr,
float value)
211 settings->max_internal_compression = std::max(value, settings->max_internal_compression);
214static void rna_ClothSettings_max_internal_compression_set(
PointerRNA *ptr,
float value)
219 value = std::max(value, settings->internal_compression);
221 settings->max_internal_compression = value;
224static void rna_ClothSettings_mass_vgroup_get(
PointerRNA *ptr,
char *value)
230static int rna_ClothSettings_mass_vgroup_length(
PointerRNA *ptr)
236static void rna_ClothSettings_mass_vgroup_set(
PointerRNA *ptr,
const char *value)
242static void rna_ClothSettings_shrink_vgroup_get(
PointerRNA *ptr,
char *value)
248static int rna_ClothSettings_shrink_vgroup_length(
PointerRNA *ptr)
254static void rna_ClothSettings_shrink_vgroup_set(
PointerRNA *ptr,
const char *value)
260static void rna_ClothSettings_struct_vgroup_get(
PointerRNA *ptr,
char *value)
266static int rna_ClothSettings_struct_vgroup_length(
PointerRNA *ptr)
272static void rna_ClothSettings_struct_vgroup_set(
PointerRNA *ptr,
const char *value)
278static void rna_ClothSettings_shear_vgroup_get(
PointerRNA *ptr,
char *value)
284static int rna_ClothSettings_shear_vgroup_length(
PointerRNA *ptr)
290static void rna_ClothSettings_shear_vgroup_set(
PointerRNA *ptr,
const char *value)
296static void rna_ClothSettings_bend_vgroup_get(
PointerRNA *ptr,
char *value)
302static int rna_ClothSettings_bend_vgroup_length(
PointerRNA *ptr)
308static void rna_ClothSettings_bend_vgroup_set(
PointerRNA *ptr,
const char *value)
314static void rna_ClothSettings_internal_vgroup_get(
PointerRNA *ptr,
char *value)
320static int rna_ClothSettings_internal_vgroup_length(
PointerRNA *ptr)
326static void rna_ClothSettings_internal_vgroup_set(
PointerRNA *ptr,
const char *value)
332static void rna_ClothSettings_pressure_vgroup_get(
PointerRNA *ptr,
char *value)
338static int rna_ClothSettings_pressure_vgroup_length(
PointerRNA *ptr)
344static void rna_ClothSettings_pressure_vgroup_set(
PointerRNA *ptr,
const char *value)
350static void rna_CollSettings_selfcol_vgroup_get(
PointerRNA *ptr,
char *value)
356static int rna_CollSettings_selfcol_vgroup_length(
PointerRNA *ptr)
362static void rna_CollSettings_selfcol_vgroup_set(
PointerRNA *ptr,
const char *value)
368static void rna_CollSettings_objcol_vgroup_get(
PointerRNA *ptr,
char *value)
374static int rna_CollSettings_objcol_vgroup_length(
PointerRNA *ptr)
380static void rna_CollSettings_objcol_vgroup_set(
PointerRNA *ptr,
const char *value)
388 Object *ob = id_cast<Object *>(ptr->owner_id);
394static void rna_ClothSettings_rest_shape_key_set(
PointerRNA *ptr,
398 Object *ob = id_cast<Object *>(ptr->owner_id);
404static void rna_ClothSettings_gravity_get(
PointerRNA *ptr,
float *values)
409 values[1] = sim->gravity[1];
410 values[2] = sim->gravity[2];
413static void rna_ClothSettings_gravity_set(
PointerRNA *ptr,
const float *values)
418 sim->gravity[1] = values[1];
419 sim->gravity[2] = values[2];
422static std::optional<std::string> rna_ClothSettings_path(
const PointerRNA *ptr)
425 const Object *ob = id_cast<Object *>(ptr->owner_id);
431 if (clmd->sim_parms == settings) {
432 char name_esc[
sizeof(md->name) * 2];
434 return fmt::format(
"modifiers[\"{}\"].settings", name_esc);
442 if (psys.clmd->sim_parms == settings) {
443 char name_esc[
sizeof(psys.
name) * 2];
445 return fmt::format(
"particle_systems[\"{}\"].cloth.settings", name_esc);
452static std::optional<std::string> rna_ClothCollisionSettings_path(
const PointerRNA *ptr)
455 const Object *ob = id_cast<Object *>(ptr->owner_id);
461 if (clmd->coll_parms == settings) {
462 char name_esc[
sizeof(md->name) * 2];
464 return fmt::format(
"modifiers[\"{}\"].collision_settings", name_esc);
472 if (psys.clmd->coll_parms == settings) {
473 char name_esc[
sizeof(psys.
name) * 2];
475 return fmt::format(
"particle_systems[\"{}\"].cloth.collision_settings", name_esc);
482static int rna_ClothSettings_internal_editable(
const PointerRNA *ptr,
const char **r_info)
487 *r_info =
N_(
"Only available with angular bending springs.");
511 "The provided data did not satisfy the prerequisites"},
516 "Iterative procedure did not converge"},
521 "The inputs are invalid, or the algorithm has been improperly called"},
522 {0,
nullptr, 0,
nullptr,
nullptr},
581 "Cloth model with linear bending springs (legacy)"},
582 {0,
nullptr, 0,
nullptr,
nullptr},
598 prop,
"Goal Minimum",
"Goal minimum, vertex group weights are scaled to match this range");
605 prop,
"Goal Maximum",
"Goal maximum, vertex group weights are scaled to match this range");
614 "Default Goal (vertex target position) value, when no Vertex Group used");
621 prop,
"Goal Stiffness",
"Goal (vertex target position) spring stiffness");
652 prop,
"Target Density Strength",
"Influence of target density on the simulation");
664 "rna_ClothSettings_mass_vgroup_get",
665 "rna_ClothSettings_mass_vgroup_length",
666 "rna_ClothSettings_mass_vgroup_set");
675 prop,
"rna_ClothSettings_gravity_get",
"rna_ClothSettings_gravity_set",
nullptr);
685 prop,
"Air Damping",
"Air has normally some thickness which slows falling things down");
701 "Quality of the simulation in steps per frame (higher is better quality but slower)");
713 "rna_ClothSettings_shrink_vgroup_get",
714 "rna_ClothSettings_shrink_vgroup_length",
715 "rna_ClothSettings_shrink_vgroup_set");
740 prop,
"Voxel Grid Cell Size",
"Size of the voxel grid cells for interaction effects");
748 prop,
"Tension Spring Damping",
"Amount of damping in stretching behavior");
755 prop,
"Compression Spring Damping",
"Amount of damping in compression behavior");
783 prop,
"Compression Stiffness",
"How much the material resists compression");
791 prop,
"Compression Stiffness Maximum",
"Maximum compression stiffness value");
817 "rna_ClothSettings_struct_vgroup_get",
818 "rna_ClothSettings_struct_vgroup_length",
819 "rna_ClothSettings_struct_vgroup_set");
822 "Structural Stiffness Vertex Group",
823 "Vertex group for fine control over structural stiffness");
828 "rna_ClothSettings_shear_vgroup_get",
829 "rna_ClothSettings_shear_vgroup_length",
830 "rna_ClothSettings_shear_vgroup_set");
833 prop,
"Shear Stiffness Vertex Group",
"Vertex group for fine control over shear stiffness");
854 prop,
"Bending Spring Damping",
"Amount of damping in bending behavior");
865 "rna_ClothSettings_bend_vgroup_get",
866 "rna_ClothSettings_bend_vgroup_length",
867 "rna_ClothSettings_bend_vgroup_set");
870 "Bending Stiffness Vertex Group",
871 "Vertex group for fine control over bending stiffness");
883 "rna_ClothSettings_rest_shape_key_get",
884 "rna_ClothSettings_rest_shape_key_set",
889 prop,
"Rest Shape Key",
"Shape key to use the rest spring lengths from");
895 prop,
"Dynamic Base Mesh",
"Make simulation respect deformations in the base mesh");
909 "Create Internal Springs",
910 "Simulate an internal volume structure by creating springs connecting "
911 "the opposite sides of the mesh");
919 "Check Internal Spring Normals",
920 "Require the points the internal springs connect to have opposite "
921 "normal directions");
931 "Internal Spring Max Length",
932 "The maximum length an internal spring can have during creation. If the distance between "
933 "internal points is greater than this, no internal spring will be created between these "
935 "A length of zero means that there is no length limit.");
944 "Internal Spring Max Diversion",
945 "How much the rays used to connect the internal points can diverge "
946 "from the vertex normal");
963 prop,
nullptr,
"rna_ClothSettings_max_internal_tension_set",
nullptr);
972 prop,
nullptr,
"rna_ClothSettings_internal_compression_set",
nullptr);
974 prop,
"Compression Stiffness",
"How much the material resists compression");
982 prop,
nullptr,
"rna_ClothSettings_max_internal_compression_set",
nullptr);
984 prop,
"Compression Stiffness Maximum",
"Maximum compression stiffness value");
990 "rna_ClothSettings_internal_vgroup_get",
991 "rna_ClothSettings_internal_vgroup_length",
992 "rna_ClothSettings_internal_vgroup_set");
995 "Internal Springs Vertex Group",
996 "Vertex group for fine control over the internal spring stiffness");
1011 "Use Custom Volume",
1012 "Use the Target Volume parameter as the initial volume, instead "
1013 "of calculating it from the mesh itself");
1023 "The uniform pressure that is constantly applied to the mesh, in units "
1024 "of Pressure Scale. Can be negative.");
1033 "The mesh volume where the inner/outer pressure will be the same. If "
1034 "set to zero the change in volume will not affect pressure.");
1042 "Ambient pressure (kPa) that balances out between the inside and "
1043 "outside of the object when it has the target volume");
1052 "Density (kg/l) of the fluid contained inside the object, used to create "
1053 "a hydrostatic pressure gradient simulating the weight of the internal fluid, "
1054 "or buoyancy from the surrounding fluid if negative");
1059 "rna_ClothSettings_pressure_vgroup_get",
1060 "rna_ClothSettings_pressure_vgroup_length",
1061 "rna_ClothSettings_pressure_vgroup_set");
1065 "Pressure Vertex Group",
1066 "Vertex Group for where to apply pressure. Zero weight means no "
1067 "pressure while a weight of one means full pressure. Faces with a vertex "
1068 "that has zero weight will be excluded from the volume calculation.");
1099 prop,
"Maximum Spring Extension",
"Maximum extension before spring gets cut");
1113 "Cloth Collision Settings",
1114 "Cloth simulation settings for self collision and collision with other objects");
1133 "Minimum distance between collision objects before collision response takes effect");
1139 prop,
"Friction",
"Friction force if a collision happened (higher = less movement)");
1155 "Collision Quality",
1156 "How many collision iterations should be done (higher is better quality but slower)");
1165 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1180 "Self Minimum Distance",
1181 "Minimum distance between cloth faces before collision response takes effect");
1197 "rna_CollSettings_selfcol_vgroup_get",
1198 "rna_CollSettings_selfcol_vgroup_length",
1199 "rna_CollSettings_selfcol_vgroup_set");
1203 "Selfcollision Vertex Group",
1204 "Triangles with all vertices in this group are not used during self collisions");
1209 "rna_CollSettings_objcol_vgroup_get",
1210 "rna_CollSettings_objcol_vgroup_length",
1211 "rna_CollSettings_objcol_vgroup_set");
1215 "Collision Vertex Group",
1216 "Triangles with all vertices in this group are not used during object collisions");
1225 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
void WM_main_add_notifier(uint type, void *reference)
int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
@ SIM_SOLVER_NUMERICAL_ISSUE
@ SIM_SOLVER_NO_CONVERGENCE
@ SIM_SOLVER_INVALID_INPUT
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void cloth_free_modifier(ClothModifierData *clmd)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_cloth(BlenderRNA *brna)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
static void rna_def_cloth_solver_result(BlenderRNA *brna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
PointerRNA rna_object_shapekey_index_get(ID *id, int value)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
@ CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS_NORMAL
@ CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH
@ CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS
@ CLOTH_SIMSETTINGS_FLAG_PRESSURE_VOL
@ CLOTH_SIMSETTINGS_FLAG_TEARING
@ CLOTH_SIMSETTINGS_FLAG_SEW
@ CLOTH_SIMSETTINGS_FLAG_PRESSURE
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void DEG_relations_tag_update(Main *bmain)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_define_verify_sdna(bool verify)
@ CLOTH_COLLSETTINGS_FLAG_ENABLED
@ CLOTH_COLLSETTINGS_FLAG_SELF
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
void RNA_def_property_array(PropertyRNA *prop, int length)
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
float internal_compression