Fix T49014: Append does not work in some cases.

There were actually two issues, one in recent changes and one existing... forever?

I) id_make_local() would never proceed over indirectly linked data, which is required in specific 'append' context.
II) BKE_image_copy() was not setting id->newid pointer of newly copied ID.

About II: don't really know why image copy does its own cooking instead of using generaic ID copy helpers.
Think this should be changed, but that would be after 2.78 now.
This commit is contained in:
Bastien Montagne 2016-08-05 14:45:21 +02:00
parent c5eb400b7c
commit a0e72a0996
Notes: blender-bot 2023-02-14 07:43:12 +01:00
Referenced by issue #49014, Copy Paste is inconsistant with datablocks
2 changed files with 4 additions and 1 deletions

View File

@ -436,6 +436,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
Image *BKE_image_copy(Main *bmain, Image *ima)
{
Image *nima = image_alloc(bmain, ima->id.name + 2, ima->source, ima->type);
ima->id.newid = &nima->id;
BLI_strncpy(nima->name, ima->name, sizeof(ima->name));

View File

@ -332,8 +332,10 @@ void BKE_id_make_local_generic(Main *bmain, ID *id, const bool id_in_mainlist, c
*/
bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
{
if (id->tag & LIB_TAG_INDIRECT)
/* We don't care whether ID is directly or indirectly linked in case we are making a whole lib local... */
if (!lib_local && (id->tag & LIB_TAG_INDIRECT)) {
return false;
}
switch ((ID_Type)GS(id->name)) {
case ID_SCE: