[Bf-blender-cvs] [1264142f783] master: LibOverride: RNA Apply: let apply function responsible for calling update or not on overridden properties.

Bastien Montagne noreply at git.blender.org
Fri Apr 1 12:45:44 CEST 2022


Commit: 1264142f78302dcecd229b3dd72544470e553964
Author: Bastien Montagne
Date:   Fri Apr 1 12:21:00 2022 +0200
Branches: master
https://developer.blender.org/rB1264142f78302dcecd229b3dd72544470e553964

LibOverride: RNA Apply: let apply function responsible for calling update or not on overridden properties.

While this is the desired behavior in almost cases, there are a few
hairy nightmares that may require not to do so.

NOTE: this change should should not modify any current behavior at all.

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

M	source/blender/makesrna/intern/rna_access_compare_override.c
M	source/blender/makesrna/intern/rna_animation.c
M	source/blender/makesrna/intern/rna_collection.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_pose.c
M	source/blender/makesrna/intern/rna_rna.c

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

diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index cce310e4b6d..5974788884e 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -612,10 +612,6 @@ static bool rna_property_override_operation_apply(Main *bmain,
                                       ptr_item_src,
                                       ptr_item_storage,
                                       opop);
-  if (success) {
-    RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
-  }
-
   return success;
 }
 
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index ba7f3c55460..4f07cb235fa 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -680,7 +680,7 @@ static FCurve *rna_Driver_find(AnimData *adt,
   return BKE_fcurve_find(&adt->drivers, data_path, index);
 }
 
-bool rna_AnimaData_override_apply(Main *UNUSED(bmain),
+bool rna_AnimaData_override_apply(Main *bmain,
                                   PointerRNA *ptr_dst,
                                   PointerRNA *ptr_src,
                                   PointerRNA *ptr_storage,
@@ -707,11 +707,13 @@ bool rna_AnimaData_override_apply(Main *UNUSED(bmain),
   if (adt_dst == NULL && adt_src != NULL) {
     /* Copy anim data from reference into final local ID. */
     BKE_animdata_copy_id(NULL, ptr_dst->owner_id, ptr_src->owner_id, 0);
+    RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
     return true;
   }
   else if (adt_dst != NULL && adt_src == NULL) {
     /* Override has cleared/removed anim data from its reference. */
     BKE_animdata_free(ptr_dst->owner_id, true);
+    RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
     return true;
   }
 
@@ -722,7 +724,7 @@ bool rna_NLA_tracks_override_apply(Main *bmain,
                                    PointerRNA *ptr_dst,
                                    PointerRNA *ptr_src,
                                    PointerRNA *UNUSED(ptr_storage),
-                                   PropertyRNA *UNUSED(prop_dst),
+                                   PropertyRNA *prop_dst,
                                    PropertyRNA *UNUSED(prop_src),
                                    PropertyRNA *UNUSED(prop_storage),
                                    const int UNUSED(len_dst),
@@ -771,6 +773,8 @@ bool rna_NLA_tracks_override_apply(Main *bmain,
   BLI_insertlinkafter(&anim_data_dst->nla_tracks, nla_track_anchor, nla_track_dst);
 
   // printf("%s: We inserted a NLA Track...\n", __func__);
+
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index eceabe65a67..599d36c0af7 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -138,7 +138,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
                                                   PointerRNA *ptr_dst,
                                                   PointerRNA *UNUSED(ptr_src),
                                                   PointerRNA *UNUSED(ptr_storage),
-                                                  PropertyRNA *UNUSED(prop_dst),
+                                                  PropertyRNA *prop_dst,
                                                   PropertyRNA *UNUSED(prop_src),
                                                   PropertyRNA *UNUSED(prop_storage),
                                                   const int UNUSED(len_dst),
@@ -185,6 +185,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
     BKE_main_collection_sync(bmain);
   }
 
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
@@ -245,7 +246,7 @@ static bool rna_Collection_children_override_apply(Main *bmain,
                                                    PointerRNA *ptr_dst,
                                                    PointerRNA *UNUSED(ptr_src),
                                                    PointerRNA *UNUSED(ptr_storage),
-                                                   PropertyRNA *UNUSED(prop_dst),
+                                                   PropertyRNA *prop_dst,
                                                    PropertyRNA *UNUSED(prop_src),
                                                    PropertyRNA *UNUSED(prop_storage),
                                                    const int UNUSED(len_dst),
@@ -287,6 +288,7 @@ static bool rna_Collection_children_override_apply(Main *bmain,
   BKE_collection_object_cache_free(coll_dst);
   BKE_main_collection_sync(bmain);
 
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 922e0204299..4f9a10c9993 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -895,7 +895,7 @@ static void rna_HookModifier_object_set(PointerRNA *ptr,
   BKE_object_modifier_hook_reset(owner, hmd);
 }
 
-static bool rna_HookModifier_object_override_apply(Main *UNUSED(bmain),
+static bool rna_HookModifier_object_override_apply(Main *bmain,
                                                    PointerRNA *ptr_dst,
                                                    PointerRNA *ptr_src,
                                                    PointerRNA *ptr_storage,
@@ -933,6 +933,7 @@ static bool rna_HookModifier_object_override_apply(Main *UNUSED(bmain),
     /* The only case where we do want default behavior (with matrix reset). */
     BKE_object_modifier_hook_reset(owner, hmd);
   }
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 0b39c8e27c7..3334022e202 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -646,7 +646,7 @@ static void rna_Object_parent_set(PointerRNA *ptr,
   }
 }
 
-static bool rna_Object_parent_override_apply(Main *UNUSED(bmain),
+static bool rna_Object_parent_override_apply(Main *bmain,
                                              PointerRNA *ptr_dst,
                                              PointerRNA *ptr_src,
                                              PointerRNA *ptr_storage,
@@ -683,6 +683,7 @@ static bool rna_Object_parent_override_apply(Main *UNUSED(bmain),
   else {
     ob->parent = parent_src;
   }
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
@@ -1667,11 +1668,11 @@ static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, Poi
   return new_con;
 }
 
-bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
+bool rna_Object_constraints_override_apply(Main *bmain,
                                            PointerRNA *ptr_dst,
                                            PointerRNA *ptr_src,
                                            PointerRNA *UNUSED(ptr_storage),
-                                           PropertyRNA *UNUSED(prop_dst),
+                                           PropertyRNA *prop_dst,
                                            PropertyRNA *UNUSED(prop_src),
                                            PropertyRNA *UNUSED(prop_storage),
                                            const int UNUSED(len_dst),
@@ -1716,6 +1717,7 @@ bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
   BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
 
   //  printf("%s: We inserted a constraint...\n", __func__);
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
@@ -1786,7 +1788,7 @@ bool rna_Object_modifiers_override_apply(Main *bmain,
                                          PointerRNA *ptr_dst,
                                          PointerRNA *ptr_src,
                                          PointerRNA *UNUSED(ptr_storage),
-                                         PropertyRNA *UNUSED(prop_dst),
+                                         PropertyRNA *prop_dst,
                                          PropertyRNA *UNUSED(prop_src),
                                          PropertyRNA *UNUSED(prop_storage),
                                          const int UNUSED(len_dst),
@@ -1847,6 +1849,7 @@ bool rna_Object_modifiers_override_apply(Main *bmain,
   BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
 
   //  printf("%s: We inserted a modifier '%s'...\n", __func__, mod_dst->name);
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
@@ -1883,7 +1886,7 @@ bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
                                                       PointerRNA *ptr_dst,
                                                       PointerRNA *ptr_src,
                                                       PointerRNA *UNUSED(ptr_storage),
-                                                      PropertyRNA *UNUSED(prop_dst),
+                                                      PropertyRNA *prop_dst,
                                                       PropertyRNA *UNUSED(prop_src),
                                                       PropertyRNA *UNUSED(prop_storage),
                                                       const int UNUSED(len_dst),
@@ -1932,6 +1935,7 @@ bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
   BLI_insertlinkafter(&ob_dst->greasepencil_modifiers, mod_anchor, mod_dst);
 
   //  printf("%s: We inserted a gpencil modifier '%s'...\n", __func__, mod_dst->name);
+  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
   return true;
 }
 
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 8b59962d858..2390fdd72f0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makes

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list