32# include <fmt/format.h>
55 rna_cloth_update(bmain, scene,
ptr);
71static void rna_ClothSettings_bending_set(
PointerRNA *
ptr,
float value)
75 settings->bending = value;
78 settings->max_bend = std::max(value, settings->max_bend);
81static void rna_ClothSettings_max_bend_set(
PointerRNA *
ptr,
float value)
86 value = std::max(value, settings->bending);
88 settings->max_bend = value;
91static void rna_ClothSettings_tension_set(
PointerRNA *
ptr,
float value)
95 settings->tension = value;
98 settings->max_tension = std::max(value, settings->max_tension);
101static void rna_ClothSettings_max_tension_set(
PointerRNA *
ptr,
float value)
106 value = std::max(value, settings->tension);
108 settings->max_tension = value;
111static void rna_ClothSettings_compression_set(
PointerRNA *
ptr,
float value)
115 settings->compression = value;
118 settings->max_compression = std::max(value, settings->max_compression);
121static void rna_ClothSettings_max_compression_set(
PointerRNA *
ptr,
float value)
126 value = std::max(value, settings->compression);
128 settings->max_compression = value;
131static void rna_ClothSettings_shear_set(
PointerRNA *
ptr,
float value)
135 settings->shear = value;
138 settings->max_shear = std::max(value, settings->max_shear);
141static void rna_ClothSettings_max_shear_set(
PointerRNA *
ptr,
float value)
146 value = std::max(value, settings->shear);
148 settings->max_shear = value;
151static void rna_ClothSettings_max_sewing_set(
PointerRNA *
ptr,
float value)
156 value = std::max(value, 0.0f);
158 settings->max_sewing = value;
161static void rna_ClothSettings_shrink_min_set(
PointerRNA *
ptr,
float value)
165 settings->shrink_min = value;
168 settings->shrink_max = std::max(value, settings->shrink_max);
171static void rna_ClothSettings_shrink_max_set(
PointerRNA *
ptr,
float value)
176 value = std::max(value, settings->shrink_min);
178 settings->shrink_max = value;
181static void rna_ClothSettings_internal_tension_set(
PointerRNA *
ptr,
float value)
185 settings->internal_tension = value;
188 settings->max_internal_tension = std::max(value, settings->max_internal_tension);
191static void rna_ClothSettings_max_internal_tension_set(
PointerRNA *
ptr,
float value)
196 value = std::max(value, settings->internal_tension);
198 settings->max_internal_tension = value;
201static void rna_ClothSettings_internal_compression_set(
PointerRNA *
ptr,
float value)
205 settings->internal_compression = value;
208 settings->max_internal_compression = std::max(value, settings->max_internal_compression);
211static void rna_ClothSettings_max_internal_compression_set(
PointerRNA *
ptr,
float value)
216 value = std::max(value, settings->internal_compression);
218 settings->max_internal_compression = value;
221static void rna_ClothSettings_mass_vgroup_get(
PointerRNA *
ptr,
char *value)
227static int rna_ClothSettings_mass_vgroup_length(
PointerRNA *
ptr)
233static void rna_ClothSettings_mass_vgroup_set(
PointerRNA *
ptr,
const char *value)
239static void rna_ClothSettings_shrink_vgroup_get(
PointerRNA *
ptr,
char *value)
245static int rna_ClothSettings_shrink_vgroup_length(
PointerRNA *
ptr)
251static void rna_ClothSettings_shrink_vgroup_set(
PointerRNA *
ptr,
const char *value)
257static void rna_ClothSettings_struct_vgroup_get(
PointerRNA *
ptr,
char *value)
263static int rna_ClothSettings_struct_vgroup_length(
PointerRNA *
ptr)
269static void rna_ClothSettings_struct_vgroup_set(
PointerRNA *
ptr,
const char *value)
275static void rna_ClothSettings_shear_vgroup_get(
PointerRNA *
ptr,
char *value)
281static int rna_ClothSettings_shear_vgroup_length(
PointerRNA *
ptr)
287static void rna_ClothSettings_shear_vgroup_set(
PointerRNA *
ptr,
const char *value)
293static void rna_ClothSettings_bend_vgroup_get(
PointerRNA *
ptr,
char *value)
299static int rna_ClothSettings_bend_vgroup_length(
PointerRNA *
ptr)
305static void rna_ClothSettings_bend_vgroup_set(
PointerRNA *
ptr,
const char *value)
311static void rna_ClothSettings_internal_vgroup_get(
PointerRNA *
ptr,
char *value)
317static int rna_ClothSettings_internal_vgroup_length(
PointerRNA *
ptr)
323static void rna_ClothSettings_internal_vgroup_set(
PointerRNA *
ptr,
const char *value)
329static void rna_ClothSettings_pressure_vgroup_get(
PointerRNA *
ptr,
char *value)
335static int rna_ClothSettings_pressure_vgroup_length(
PointerRNA *
ptr)
341static void rna_ClothSettings_pressure_vgroup_set(
PointerRNA *
ptr,
const char *value)
347static void rna_CollSettings_selfcol_vgroup_get(
PointerRNA *
ptr,
char *value)
353static int rna_CollSettings_selfcol_vgroup_length(
PointerRNA *
ptr)
359static void rna_CollSettings_selfcol_vgroup_set(
PointerRNA *
ptr,
const char *value)
365static void rna_CollSettings_objcol_vgroup_get(
PointerRNA *
ptr,
char *value)
371static int rna_CollSettings_objcol_vgroup_length(
PointerRNA *
ptr)
377static void rna_CollSettings_objcol_vgroup_set(
PointerRNA *
ptr,
const char *value)
391static void rna_ClothSettings_rest_shape_key_set(
PointerRNA *
ptr,
402static void rna_ClothSettings_gravity_get(
PointerRNA *
ptr,
float *values)
411static void rna_ClothSettings_gravity_set(
PointerRNA *
ptr,
const float *values)
420static std::optional<std::string> rna_ClothSettings_path(
const PointerRNA *
ptr)
426 char name_esc[
sizeof(md->
name) * 2];
428 return fmt::format(
"modifiers[\"{}\"].settings", name_esc);
433static std::optional<std::string> rna_ClothCollisionSettings_path(
const PointerRNA *
ptr)
439 char name_esc[
sizeof(md->
name) * 2];
441 return fmt::format(
"modifiers[\"{}\"].collision_settings", name_esc);
446static int rna_ClothSettings_internal_editable(
const PointerRNA *
ptr,
const char **r_info)
451 *r_info =
N_(
"Only available with angular bending springs.");
471 "The provided data did not satisfy the prerequisites"},
476 "Iterative procedure did not converge"},
481 "The inputs are invalid, or the algorithm has been improperly called"},
482 {0,
nullptr, 0,
nullptr,
nullptr},
541 "Cloth model with linear bending springs (legacy)"},
542 {0,
nullptr, 0,
nullptr,
nullptr},
558 prop,
"Goal Minimum",
"Goal minimum, vertex group weights are scaled to match this range");
565 prop,
"Goal Maximum",
"Goal maximum, vertex group weights are scaled to match this range");
574 "Default Goal (vertex target position) value, when no Vertex Group used");
581 prop,
"Goal Stiffness",
"Goal (vertex target position) spring stiffness");
612 prop,
"Target Density Strength",
"Influence of target density on the simulation");
624 "rna_ClothSettings_mass_vgroup_get",
625 "rna_ClothSettings_mass_vgroup_length",
626 "rna_ClothSettings_mass_vgroup_set");
635 prop,
"rna_ClothSettings_gravity_get",
"rna_ClothSettings_gravity_set",
nullptr);
645 prop,
"Air Damping",
"Air has normally some thickness which slows falling things down");
661 "Quality of the simulation in steps per frame (higher is better quality but slower)");
673 "rna_ClothSettings_shrink_vgroup_get",
674 "rna_ClothSettings_shrink_vgroup_length",
675 "rna_ClothSettings_shrink_vgroup_set");
700 prop,
"Voxel Grid Cell Size",
"Size of the voxel grid cells for interaction effects");
708 prop,
"Tension Spring Damping",
"Amount of damping in stretching behavior");
715 prop,
"Compression Spring Damping",
"Amount of damping in compression behavior");
743 prop,
"Compression Stiffness",
"How much the material resists compression");
751 prop,
"Compression Stiffness Maximum",
"Maximum compression stiffness value");
777 "rna_ClothSettings_struct_vgroup_get",
778 "rna_ClothSettings_struct_vgroup_length",
779 "rna_ClothSettings_struct_vgroup_set");
782 "Structural Stiffness Vertex Group",
783 "Vertex group for fine control over structural stiffness");
788 "rna_ClothSettings_shear_vgroup_get",
789 "rna_ClothSettings_shear_vgroup_length",
790 "rna_ClothSettings_shear_vgroup_set");
793 prop,
"Shear Stiffness Vertex Group",
"Vertex group for fine control over shear stiffness");
814 prop,
"Bending Spring Damping",
"Amount of damping in bending behavior");
825 "rna_ClothSettings_bend_vgroup_get",
826 "rna_ClothSettings_bend_vgroup_length",
827 "rna_ClothSettings_bend_vgroup_set");
830 "Bending Stiffness Vertex Group",
831 "Vertex group for fine control over bending stiffness");
843 "rna_ClothSettings_rest_shape_key_get",
844 "rna_ClothSettings_rest_shape_key_set",
849 prop,
"Rest Shape Key",
"Shape key to use the rest spring lengths from");
855 prop,
"Dynamic Base Mesh",
"Make simulation respect deformations in the base mesh");
869 "Create Internal Springs",
870 "Simulate an internal volume structure by creating springs connecting "
871 "the opposite sides of the mesh");
879 "Check Internal Spring Normals",
880 "Require the points the internal springs connect to have opposite "
881 "normal directions");
891 "Internal Spring Max Length",
892 "The maximum length an internal spring can have during creation. If the distance between "
893 "internal points is greater than this, no internal spring will be created between these "
895 "A length of zero means that there is no length limit.");
904 "Internal Spring Max Diversion",
905 "How much the rays used to connect the internal points can diverge "
906 "from the vertex normal");
923 prop,
nullptr,
"rna_ClothSettings_max_internal_tension_set",
nullptr);
932 prop,
nullptr,
"rna_ClothSettings_internal_compression_set",
nullptr);
934 prop,
"Compression Stiffness",
"How much the material resists compression");
942 prop,
nullptr,
"rna_ClothSettings_max_internal_compression_set",
nullptr);
944 prop,
"Compression Stiffness Maximum",
"Maximum compression stiffness value");
950 "rna_ClothSettings_internal_vgroup_get",
951 "rna_ClothSettings_internal_vgroup_length",
952 "rna_ClothSettings_internal_vgroup_set");
955 "Internal Springs Vertex Group",
956 "Vertex group for fine control over the internal spring stiffness");
972 "Use the Target Volume parameter as the initial volume, instead "
973 "of calculating it from the mesh itself");
983 "The uniform pressure that is constantly applied to the mesh, in units "
984 "of Pressure Scale. Can be negative.");
993 "The mesh volume where the inner/outer pressure will be the same. If "
994 "set to zero the change in volume will not affect pressure.");
1002 "Ambient pressure (kPa) that balances out between the inside and "
1003 "outside of the object when it has the target volume");
1012 "Density (kg/l) of the fluid contained inside the object, used to create "
1013 "a hydrostatic pressure gradient simulating the weight of the internal fluid, "
1014 "or buoyancy from the surrounding fluid if negative");
1019 "rna_ClothSettings_pressure_vgroup_get",
1020 "rna_ClothSettings_pressure_vgroup_length",
1021 "rna_ClothSettings_pressure_vgroup_set");
1025 "Pressure Vertex Group",
1026 "Vertex Group for where to apply pressure. Zero weight means no "
1027 "pressure while a weight of one means full pressure. Faces with a vertex "
1028 "that has zero weight will be excluded from the volume calculation.");
1059 prop,
"Maximum Spring Extension",
"Maximum extension before spring gets cut");
1073 "Cloth Collision Settings",
1074 "Cloth simulation settings for self collision and collision with other objects");
1093 "Minimum distance between collision objects before collision response takes effect");
1099 prop,
"Friction",
"Friction force if a collision happened (higher = less movement)");
1115 "Collision Quality",
1116 "How many collision iterations should be done (higher is better quality but slower)");
1125 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
1140 "Self Minimum Distance",
1141 "Minimum distance between cloth faces before collision response takes effect");
1157 "rna_CollSettings_selfcol_vgroup_get",
1158 "rna_CollSettings_selfcol_vgroup_length",
1159 "rna_CollSettings_selfcol_vgroup_set");
1163 "Selfcollision Vertex Group",
1164 "Triangles with all vertices in this group are not used during self collisions");
1169 "rna_CollSettings_objcol_vgroup_get",
1170 "rna_CollSettings_objcol_vgroup_length",
1171 "rna_CollSettings_objcol_vgroup_set");
1175 "Collision Vertex Group",
1176 "Triangles with all vertices in this group are not used during object collisions");
1185 "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
void cloth_free_modifier(ClothModifierData *clmd)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
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)
@ 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
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
@ SIM_SOLVER_INVALID_INPUT
@ SIM_SOLVER_NUMERICAL_ISSUE
@ SIM_SOLVER_NO_CONVERGENCE
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
void RNA_def_cloth(BlenderRNA *brna)
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
static void rna_def_cloth_solver_result(BlenderRNA *brna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
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_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)
void WM_main_add_notifier(uint type, void *reference)