Fix missing depsgraph tags after removing an object from a collection

Follow up to fix for #127213, resolving the bug in other contexts.
This commit is contained in:
Campbell Barton
2024-09-06 12:05:33 +10:00
committed by Philipp Oeser
parent f5882d0c31
commit fc23ff3fb4
3 changed files with 8 additions and 1 deletions
@@ -433,6 +433,9 @@ bool BKE_light_linking_unlink_id_from_collection(Main *bmain,
}
DEG_id_tag_update(&collection->id, ID_RECALC_HIERARCHY);
if (id_type == ID_OB) {
DEG_id_tag_update(&collection->id, ID_RECALC_SYNC_TO_EVAL);
}
DEG_relations_tag_update(bmain);
@@ -1640,7 +1640,10 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob, const bo
* when we remove them from RB simulation. */
BKE_collection_object_add(bmain, scene->master_collection, ob);
}
BKE_collection_object_remove(bmain, rbw->group, ob, free_us);
if (rbw->group) {
BKE_collection_object_remove(bmain, rbw->group, ob, free_us);
DEG_id_tag_update(&rbw->group->id, ID_RECALC_SYNC_TO_EVAL);
}
/* flag cache as outdated */
BKE_rigidbody_cache_reset(rbw);
@@ -471,6 +471,7 @@ static void unlink_object_fn(bContext *C,
if (BKE_collection_has_object(collection, ob)) {
BKE_collection_object_remove(bmain, collection, ob, true);
DEG_id_tag_update(&collection->id, ID_RECALC_HIERARCHY);
DEG_id_tag_update(&collection->id, ID_RECALC_SYNC_TO_EVAL);
}
}
FOREACH_SCENE_COLLECTION_END;