[Bf-blender-cvs] [ac80793] render-layers: Include object unlinking in library_remap preprocessing

Dalai Felinto noreply at git.blender.org
Wed Jan 4 18:22:51 CET 2017


Commit: ac8079359286e7bb7f403262e9ea820063830e9a
Author: Dalai Felinto
Date:   Wed Jan 4 18:19:51 2017 +0100
Branches: render-layers
https://developer.blender.org/rBac8079359286e7bb7f403262e9ea820063830e9a

Include object unlinking in library_remap preprocessing

===================================================================

M	source/blender/blenkernel/intern/library_remap.c

===================================================================

diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index a68d29c..9f815e8 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -254,6 +254,22 @@ static void libblock_remap_data_preprocess_scene_base_unlink(
 	}
 }
 
+/* Some reamapping unfortunately require extra and/or specific handling, tackle those here. */
+static void libblock_remap_data_preprocess_scene_object_unlink(
+        IDRemap *r_id_remap_data, Scene *sce, Object *ob, const bool skip_indirect, const bool is_indirect)
+{
+	if (skip_indirect && is_indirect) {
+		r_id_remap_data->skipped_indirect++;
+		r_id_remap_data->skipped_refcounted++;
+	}
+	else {
+		BKE_collections_object_remove(sce, ob);
+		if (!is_indirect) {
+			r_id_remap_data->status |= ID_REMAP_IS_LINKED_DIRECT;
+		}
+	}
+}
+
 static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
 {
 	switch (GS(r_id_remap_data->id->name)) {
@@ -268,6 +284,15 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
 				/* In case we are unlinking... */
 				if (!r_id_remap_data->old_id) {
 					/* ... everything from scene. */
+					Object *ob_iter;
+					FOREACH_SCENE_OBJECT(sce, ob_iter)
+					{
+						libblock_remap_data_preprocess_scene_object_unlink(
+						            r_id_remap_data, sce, ob_iter, skip_indirect, is_indirect);
+					}
+					FOREACH_SCENE_OBJECT_END
+
+
 					Base *base, *base_next;
 					for (base = sce->base.first; base; base = base_next) {
 						base_next = base->next;
@@ -278,8 +303,11 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
 				else if (GS(r_id_remap_data->old_id->name) == ID_OB) {
 					/* ... a specific object from scene. */
 					Object *old_ob = (Object *)r_id_remap_data->old_id;
-					Base *base = BKE_scene_base_find(sce, old_ob);
 
+					libblock_remap_data_preprocess_scene_object_unlink(
+					            r_id_remap_data, sce, old_ob, skip_indirect, is_indirect);
+
+					Base *base = BKE_scene_base_find(sce, old_ob);
 					if (base) {
 						libblock_remap_data_preprocess_scene_base_unlink(
 						            r_id_remap_data, sce, base, skip_indirect, is_indirect);




More information about the Bf-blender-cvs mailing list