[Bf-blender-cvs] [5b6ead05bd2] master: Fix T52324: Metaball disappears when deleting first metaball object.

Bastien Montagne noreply at git.blender.org
Thu Aug 10 12:34:23 CEST 2017


Commit: 5b6ead05bd2eb08b99e3440fd10b125bafe880ec
Author: Bastien Montagne
Date:   Thu Aug 10 12:32:50 2017 +0200
Branches: master
https://developer.blender.org/rB5b6ead05bd2eb08b99e3440fd10b125bafe880ec

Fix T52324: Metaball disappears when deleting first metaball object.

Lost specific MBall 'need update' case here in last year's refactor.

While technically not a regression, nice to have in 2.79.

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

M	source/blender/blenkernel/intern/library_remap.c

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

diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index ed9063e7640..1794d745767 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -241,7 +241,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
 	return IDWALK_RET_NOP;
 }
 
-/* Some reamapping unfortunately require extra and/or specific handling, tackle those here. */
+/* Some remapping unfortunately require extra and/or specific handling, tackle those here. */
 static void libblock_remap_data_preprocess_scene_base_unlink(
         IDRemap *r_id_remap_data, Scene *sce, Base *base, const bool skip_indirect, const bool is_indirect)
 {
@@ -318,7 +318,7 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
 	}
 }
 
-static void libblock_remap_data_postprocess_object_fromgroup_update(Main *bmain, Object *old_ob, Object *new_ob)
+static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *old_ob, Object *new_ob)
 {
 	if (old_ob->flag & OB_FROMGROUP) {
 		/* Note that for Scene's BaseObject->flag, either we:
@@ -337,6 +337,13 @@ static void libblock_remap_data_postprocess_object_fromgroup_update(Main *bmain,
 			new_ob->flag |= OB_FROMGROUP;
 		}
 	}
+	if (old_ob->type == OB_MBALL) {
+		for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+			if (ob->type == OB_MBALL && BKE_mball_is_basis_for(ob, old_ob)) {
+				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+			}
+		}
+	}
 }
 
 static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmain), Scene *sce, ID *old_id)
@@ -547,7 +554,7 @@ void BKE_libblock_remap_locked(
 	 */
 	switch (GS(old_id->name)) {
 		case ID_OB:
-			libblock_remap_data_postprocess_object_fromgroup_update(bmain, (Object *)old_id, (Object *)new_id);
+			libblock_remap_data_postprocess_object_update(bmain, (Object *)old_id, (Object *)new_id);
 			break;
 		case ID_GR:
 			if (!new_id) {  /* Only affects us in case group was unlinked. */
@@ -657,8 +664,7 @@ void BKE_libblock_relink_ex(
 				switch (GS(old_id->name)) {
 					case ID_OB:
 					{
-						libblock_remap_data_postprocess_object_fromgroup_update(
-						            bmain, (Object *)old_id, (Object *)new_id);
+						libblock_remap_data_postprocess_object_update(bmain, (Object *)old_id, (Object *)new_id);
 						break;
 					}
 					case ID_GR:
@@ -673,7 +679,7 @@ void BKE_libblock_relink_ex(
 			else {
 				/* No choice but to check whole objects/groups. */
 				for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
-					libblock_remap_data_postprocess_object_fromgroup_update(bmain, ob, NULL);
+					libblock_remap_data_postprocess_object_update(bmain, ob, NULL);
 				}
 				for (Group *grp = bmain->group.first; grp; grp = grp->id.next) {
 					libblock_remap_data_postprocess_group_scene_unlink(bmain, sce, NULL);




More information about the Bf-blender-cvs mailing list