diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 13:46:16 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 13:46:16 +0300 |
commit | 646412004b1da5d6b7b831a5a49022d1fd138e0b (patch) | |
tree | c3e2ba99cd4eb8ea312a59efd4ed7a8e9c1c7f28 /source/blender/blenkernel | |
parent | b6b7c83dd8e4838d4819c25d95dd01cacf81c8d8 (diff) | |
parent | 2fe528424d168f124efca5d94c6b0363be49dbf3 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_screen.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_space.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/generic/bpy_internal_import.h
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/gpu_offscreen.c
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 28bc254f25a..aaf53a2396b 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -208,6 +208,8 @@ void BKE_library_make_local( void BKE_id_tag_set_atomic(struct ID *id, int tag); void BKE_id_tag_clear_atomic(struct ID *id, int tag); +bool BKE_id_is_in_gobal_main(struct ID *id); + /* use when "" is given to new_id() */ #define ID_FALLBACK_NAME N_("Untitled") diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c45903aa1fa..fa9432213f9 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -2558,3 +2558,11 @@ 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) { + /* We do not want to fail when id is NULL here, even though this is a bit strange behavior... */ + return (id == NULL || BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1); +} + |