BKE_library: Add func to check an ID is actually in G_MAIN database.
This commit is contained in:
parent
a0dce6810d
commit
1870a1adc7
@ -200,6 +200,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")
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user