[Bf-blender-cvs] [6744f4d108a] blender-v2.82-release: Cleanup of previous rBac723db57fd8ba5 commit.
Bastien Montagne
noreply at git.blender.org
Fri Jan 17 20:05:00 CET 2020
Commit: 6744f4d108a8965425233527a3d65cc4a62848f4
Author: Bastien Montagne
Date: Fri Jan 17 19:34:05 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB6744f4d108a8965425233527a3d65cc4a62848f4
Cleanup of previous rBac723db57fd8ba5 commit.
Simplify a bit, and remove some now redundant remappings.
As a side note, rBac723db57fd8ba5 actually also fixed some unreported
issues (missing remappings to new objects/collections in new copied
scene, that were not previously handled by the 'custom' code).
There are almost certainly still some missing remappings around,
though...
===================================================================
M source/blender/editors/object/object_relations.c
===================================================================
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 1fc139ec997..b52c3f67b2f 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1721,14 +1721,6 @@ static void libblock_relink_collection(Collection *collection, const bool do_col
}
}
-static void libblock_relink_collections_from_scene(Scene *scene)
-{
- /* Will also handle the master collection. */
- BKE_libblock_relink_to_newid(&scene->id);
-
- libblock_relink_collection(scene->master_collection, false);
-}
-
static Collection *single_object_users_collection(Main *bmain,
Scene *scene,
Collection *collection,
@@ -1763,6 +1755,7 @@ static Collection *single_object_users_collection(Main *bmain,
child_next = child->next;
Collection *collection_child_new = single_object_users_collection(
bmain, scene, child->collection, flag, copy_collections, false);
+
if (is_master_collection && copy_collections && child->collection != collection_child_new) {
BKE_collection_child_add(bmain, collection, collection_child_new);
BLI_remlink(&collection->children, child);
@@ -1784,21 +1777,16 @@ static void single_object_users(
Collection *master_collection = scene->master_collection;
single_object_users_collection(bmain, scene, master_collection, flag, copy_collections, true);
- /* Collection and object pointers in collections */
- libblock_relink_collections_from_scene(scene);
+ /* Will also handle the master collection. */
+ BKE_libblock_relink_to_newid(&scene->id);
- /* collection pointers in scene */
- BKE_scene_groups_relink(scene);
+ /* Collection and object pointers in collections */
+ libblock_relink_collection(scene->master_collection, false);
- /* active camera */
- ID_NEW_REMAP(scene->camera);
+ /* We also have to handle runtime things in UI. */
if (v3d) {
ID_NEW_REMAP(v3d->camera);
}
- /* Camera pointers of markers. */
- for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
- ID_NEW_REMAP(marker->camera);
- }
/* Making single user may affect other scenes if they share
* with current one some collections in their ViewLayer. */
@@ -2028,13 +2016,19 @@ 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 regarding 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_collections_from_scene(scene);
+
+ /* Will also handle the master collection. */
+ BKE_libblock_relink_to_newid(&scene->id);
+
+ /* Collection and object pointers in collections */
+ libblock_relink_collection(scene->master_collection, false);
}
/* Relink nodetrees' pointers that have been duplicated. */
More information about the Bf-blender-cvs
mailing list