Fix (unreported) bad handling of embedded IDs on owner copying.

Completely forgot in rBcd49fee74114 to handle the owner ID copying case
(this code now also needs to re-assign to `owner_id` pointer of the
newly copied embedded IDs to their rightful owner).
This commit is contained in:
Bastien Montagne 2022-09-06 14:57:44 +02:00
parent 6f80c60ce6
commit e3afead9aa
7 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,7 @@ static void light_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
BKE_id_copy_ex(
bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag_private_id_data);
}
la_dst->nodetree->owner_id = &la_dst->id;
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {

View File

@ -72,6 +72,7 @@ static void linestyle_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const
(ID *)linestyle_src->nodetree,
(ID **)&linestyle_dst->nodetree,
flag_private_id_data);
linestyle_dst->nodetree->owner_id = &linestyle_dst->id;
}
LineStyleModifier *linestyle_modifier;

View File

@ -102,6 +102,7 @@ static void material_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const
(ID **)&material_dst->nodetree,
flag_private_id_data);
}
material_dst->nodetree->owner_id = &material_dst->id;
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {

View File

@ -250,6 +250,7 @@ static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
(ID *)scene_src->master_collection,
(ID **)&scene_dst->master_collection,
flag_private_id_data);
scene_dst->master_collection->owner_id = &scene_dst->id;
}
/* View Layers */
@ -275,6 +276,7 @@ static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
(void *)(&scene_src->id),
&scene_dst->id,
ID_REMAP_SKIP_NEVER_NULL_USAGE | ID_REMAP_SKIP_USER_CLEAR);
scene_dst->nodetree->owner_id = &scene_dst->id;
}
if (scene_src->rigidbody_world) {

View File

@ -67,6 +67,7 @@ static void simulation_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons
(ID *)simulation_src->nodetree,
(ID **)&simulation_dst->nodetree,
flag_private_id_data);
simulation_dst->nodetree->owner_id = &simulation_dst->id;
}
}

View File

@ -96,6 +96,7 @@ static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const i
BKE_id_copy_ex(
bmain, (ID *)texture_src->nodetree, (ID **)&texture_dst->nodetree, flag_private_id_data);
}
texture_dst->nodetree->owner_id = &texture_dst->id;
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {

View File

@ -98,6 +98,7 @@ static void world_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
BKE_id_copy_ex(
bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag_private_id_data);
}
wrld_dst->nodetree->owner_id = &wrld_dst->id;
}
BLI_listbase_clear(&wrld_dst->gpumaterial);