Fix T66641: Certain drivers fail to copy when copying a full scene.

The core of the issue here is that 'make single user' functions still
does its own, manual and quite partial, remapping of IDs, which covers
all most common cases but cannot consider *all* possible ID usages
(especially when it comes to drivers or custom properties, that can
essentially point to any kind of data-blocks).

This fix is merely a band-aid, there is no way to fully solve this
without a complete rewrite of that area of code to make use of modern ID
management code.
This commit is contained in:
Bastien Montagne 2019-10-01 14:48:33 +02:00
parent f983606063
commit cba1bdc400
Notes: blender-bot 2023-02-14 03:29:37 +01:00
Referenced by issue #66641, Certain drivers fail to copy when copying a full scene
1 changed files with 7 additions and 0 deletions

View File

@ -2050,6 +2050,13 @@ void ED_object_single_users(Main *bmain,
single_obdata_users(bmain, scene, NULL, NULL, 0);
single_object_action_users(bmain, scene, NULL, NULL, 0);
single_mat_users_expand(bmain);
/* Duplicating obdata and other IDs may require another update of the collections and objects
* pointers, especially reguarding drivers and custom props, see T66641.
* Note that this whole scene duplication code and 'make single user' functions have te be
* rewritten at some point to make use of proper modern ID management code,
* but that is no small task.
* For now we are doomed to that kind of band-aid to try to cover most of remapping cases. */
libblock_relink_collection(scene->master_collection);
}
/* Relink nodetrees' pointers that have been duplicated. */