Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-22 12:37:08 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-22 12:37:08 +0300
commit1870a1adc75dece1e9eac3aa632da6e903780c86 (patch)
tree2cf12f98d0540b3901081bbd3184cb4c8b376bbf /source/blender/blenkernel/intern/library.c
parenta0dce6810d8bafd0205e6847fea3febfc08a7bd7 (diff)
BKE_library: Add func to check an ID is actually in G_MAIN database.
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 37d7004192d..444e155f5ac 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2414,3 +2414,10 @@ void BKE_id_tag_clear_atomic(ID *id, int tag)
{
atomic_fetch_and_and_int32(&id->tag, ~tag);
}
+
+/** Check that given ID pointer actually is in G_MAIN.
+ * Main intended use is for debug asserts in places we cannot easily get rid of G_Main... */
+bool BKE_id_is_in_gobal_main(ID *id) {
+ return (BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1);
+}
+