[Bf-blender-cvs] [b7e84f3] master: Cleanup/simplify/fixes BKE_object_is_libdata and BKE_object_obdata_is_libdata.

Bastien Montagne noreply at git.blender.org
Wed Jul 6 14:45:26 CEST 2016


Commit: b7e84f32adb3b6e6189a9acc95804fdfb675c669
Author: Bastien Montagne
Date:   Wed Jul 6 14:37:03 2016 +0200
Branches: master
https://developer.blender.org/rBb7e84f32adb3b6e6189a9acc95804fdfb675c669

Cleanup/simplify/fixes BKE_object_is_libdata and BKE_object_obdata_is_libdata.

Removed checks for ob->proxy from the equation, you can totally have proxy objects
linked into another .blend file!

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

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

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 316e746..22ab232 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1273,27 +1273,18 @@ void BKE_object_make_local(Object *ob)
 	}
 }
 
-/*
- * Returns true if the Object is a from an external blend file (libdata)
- */
+/* Returns true if the Object is from an external blend file (libdata) */
 bool BKE_object_is_libdata(Object *ob)
 {
-	if (!ob) return false;
-	if (ob->proxy) return false;
-	if (ID_IS_LINKED_DATABLOCK(ob)) return true;
-	return false;
+	return (ob && ID_IS_LINKED_DATABLOCK(ob));
 }
 
-/* Returns true if the Object data is a from an external blend file (libdata) */
+/* Returns true if the Object data is from an external blend file (libdata) */
 bool BKE_object_obdata_is_libdata(Object *ob)
 {
-	if (!ob) return false;
-	if (ob->proxy && (ob->data == NULL || !ID_IS_LINKED_DATABLOCK(ob->data))) return false;
-	if (ID_IS_LINKED_DATABLOCK(ob)) return true;
-	if (ob->data == NULL) return false;
-	if (ID_IS_LINKED_DATABLOCK(ob->data)) return true;
-
-	return false;
+	/* Linked objects with local obdata are forbidden! */
+	BLI_assert(!ob || !ob->data || (ID_IS_LINKED_DATABLOCK(ob) ? ID_IS_LINKED_DATABLOCK(ob->data) : true));
+	return (ob && ob->data && ID_IS_LINKED_DATABLOCK(ob->data));
 }
 
 /* *************** PROXY **************** */




More information about the Bf-blender-cvs mailing list