[Bf-blender-cvs] [8f9f65bc29f] master: Allow overrides for cloth, collision and force field properties.

Alexander Gavrilov noreply at git.blender.org
Mon Jan 3 16:11:14 CET 2022


Commit: 8f9f65bc29fbd781249583646bcc038e327f2eca
Author: Alexander Gavrilov
Date:   Tue Dec 28 15:06:17 2021 +0300
Branches: master
https://developer.blender.org/rB8f9f65bc29fbd781249583646bcc038e327f2eca

Allow overrides for cloth, collision and force field properties.

Allow overriding simple properties of cloth simulations, colliders
and force fields. Vertex group and shape key selectors in cloth are
still not overridable since they are tied to mesh data.

Force fields have a number of physical fields shared between multiple
RNA fields. Until they are decoupled, they will produce redundant
overrides, and cannot have different hard range limits.

Differential Revision: https://developer.blender.org/D13710

===================================================================

M	source/blender/makesrna/intern/rna_cloth.c
M	source/blender/makesrna/intern/rna_dynamicpaint.c
M	source/blender/makesrna/intern/rna_fluid.c
M	source/blender/makesrna/intern/rna_object_force.c
M	source/blender/makesrna/intern/rna_particle.c
M	source/blender/makesrna/intern/rna_rigidbody.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 2bc00dd5af5..187e232b030 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -584,6 +584,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "ClothSimSettings");
   RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
 
+  RNA_define_lib_overridable(true);
+
   /* goal */
 
   prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
@@ -659,6 +661,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_mass_vgroup_get",
                                 "rna_ClothSettings_mass_vgroup_length",
                                 "rna_ClothSettings_mass_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
   RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
 
@@ -707,6 +710,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_shrink_vgroup_get",
                                 "rna_ClothSettings_shrink_vgroup_length",
                                 "rna_ClothSettings_shrink_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
 
@@ -810,6 +814,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_struct_vgroup_get",
                                 "rna_ClothSettings_struct_vgroup_length",
                                 "rna_ClothSettings_struct_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop,
                            "Structural Stiffness Vertex Group",
                            "Vertex group for fine control over structural stiffness");
@@ -820,6 +825,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_shear_vgroup_get",
                                 "rna_ClothSettings_shear_vgroup_length",
                                 "rna_ClothSettings_shear_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(
       prop, "Shear Stiffness Vertex Group", "Vertex group for fine control over shear stiffness");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -856,6 +862,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_bend_vgroup_get",
                                 "rna_ClothSettings_bend_vgroup_length",
                                 "rna_ClothSettings_bend_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop,
                            "Bending Stiffness Vertex Group",
                            "Vertex group for fine control over bending stiffness");
@@ -874,6 +881,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                  "rna_ClothSettings_rest_shape_key_set",
                                  NULL,
                                  NULL);
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(
       prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -976,6 +984,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_internal_vgroup_get",
                                 "rna_ClothSettings_internal_vgroup_length",
                                 "rna_ClothSettings_internal_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop,
                            "Internal Springs Vertex Group",
                            "Vertex group for fine control over the internal spring stiffness");
@@ -1044,6 +1053,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
                                 "rna_ClothSettings_pressure_vgroup_get",
                                 "rna_ClothSettings_pressure_vgroup_length",
                                 "rna_ClothSettings_pressure_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(
       prop,
       "Pressure Vertex Group",
@@ -1082,6 +1092,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(
       prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
 #  endif
+
+  RNA_define_lib_overridable(false);
 }
 
 static void rna_def_cloth_collision_settings(BlenderRNA *brna)
@@ -1097,6 +1109,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "ClothCollSettings");
   RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
 
+  RNA_define_lib_overridable(true);
+
   /* general collision */
 
   prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
@@ -1169,7 +1183,6 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
   prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
   RNA_def_property_pointer_sdna(prop, NULL, "group");
   RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection");
   RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
 
@@ -1178,6 +1191,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
                                 "rna_CollSettings_selfcol_vgroup_get",
                                 "rna_CollSettings_selfcol_vgroup_length",
                                 "rna_CollSettings_selfcol_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(
       prop,
       "Selfcollision Vertex Group",
@@ -1189,6 +1203,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
                                 "rna_CollSettings_objcol_vgroup_get",
                                 "rna_CollSettings_objcol_vgroup_length",
                                 "rna_CollSettings_objcol_vgroup_set");
+  RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(
       prop,
       "Collision Vertex Group",
@@ -1203,6 +1218,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
       "Impulse Clamping",
       "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+  RNA_define_lib_overridable(false);
 }
 
 void RNA_def_cloth(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index a9d5ef089bb..b693d78a302 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -589,6 +589,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
   prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
   RNA_def_property_struct_type(prop, "EffectorWeights");
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop, "Effector Weights", "");
 
   prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index 90e77406f23..7aa96eb8430 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -1461,6 +1461,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
   prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
   RNA_def_property_struct_type(prop, "EffectorWeights");
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
   RNA_def_property_ui_text(prop, "Effector Weights", "");
 
   /* object collections */
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 2fca9f0af7a..d697a48e04b 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1128,6 +1128,8 @@ static void rna_def_collision(BlenderRNA *brna)
   RNA_def_struct_ui_text(
       srna, "Collision Settings", "Collision settings for object in physics simulation");
 
+  RNA_define_lib_overridable(true);
+
   prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
   RNA_def_property_ui_text(
@@ -1230,6 +1232,8 @@ static void rna_def_collision(BlenderRNA *brna)
                            "Cloth collision impulses act in the direction of the collider normals "
                            "(more reliable in some cases)");
   RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+  RNA_define_lib_overridable(false);
 }
 
 static void rna_def_effector_weight(BlenderRNA *brna)
@@ -1243,6 +1247,8 @@ static void rna_def_effector_weight(BlenderRNA *brna)
   RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
   RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
 
+  RNA_define_lib_overridable(true);
+
   /* Flags */
   prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
@@ -1362,6 +1368,8 @@ static void rna_def_effector_weight(BlenderRNA *brna)
   RNA_def_property_ui_range(

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list