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.
This commit is contained in:
parent
cf7a2c93e3
commit
5b6ead05bd
Notes:
blender-bot
2023-02-14 06:42:57 +01:00
Referenced by issue #52324, Metaball disappears when deleting first metaball object
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue