Cleanup: Remove deprecated BKE_libblock_free(_ex) functions, document BKE_id_free(_ex) ones.
This commit is contained in:
parent
cae3750ff9
commit
c710ca8933
@ -123,10 +123,7 @@ enum {
|
||||
|
||||
void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, const bool use_flag_from_idtag);
|
||||
void BKE_id_free(struct Main *bmain, void *idv);
|
||||
/* Those three naming are bad actually, should be BKE_id_free... (since it goes beyond mere datablock). */
|
||||
/* "Deprecated" old API */
|
||||
void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user) ATTR_NONNULL();
|
||||
void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL();
|
||||
|
||||
void BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
|
||||
|
||||
void BKE_libblock_management_main_add(struct Main *bmain, void *idv);
|
||||
|
@ -807,7 +807,17 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Complete ID freeing, extended version for corner cases.
|
||||
* Can override default (and safe!) freeing process, to gain some speed up.
|
||||
*
|
||||
* \param bmain Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
|
||||
* \param idv Pointer to ID to be freed.
|
||||
* \param flag Set of \a LIB_ID_FREE_... flags controlling/overriding usual freeing process,
|
||||
* 0 to get default safe behavior.
|
||||
* \param use_flag_from_idtag Still use freeing info flags from given ID datablock,
|
||||
* even if some overriding ones are passed in \a falg parameter.
|
||||
*/
|
||||
void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_idtag)
|
||||
{
|
||||
ID *id = idv;
|
||||
@ -891,68 +901,17 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete ID freeing, should be usable in most cases (even for out-of-Main IDs).
|
||||
*
|
||||
* \param bmain Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
|
||||
* \param idv Pointer to ID to be freed.
|
||||
*/
|
||||
void BKE_id_free(Main *bmain, void *idv)
|
||||
{
|
||||
BKE_id_free_ex(bmain, idv, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c
|
||||
*
|
||||
* \param do_id_user: if \a true, try to release other ID's 'references' hold by \a idv.
|
||||
* (only applies to main database)
|
||||
* \param do_ui_user: similar to do_id_user but makes sure UI does not hold references to
|
||||
* \a id.
|
||||
*/
|
||||
void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user)
|
||||
{
|
||||
ID *id = idv;
|
||||
short type = GS(id->name);
|
||||
ListBase *lb = which_libbase(bmain, type);
|
||||
|
||||
DEG_id_type_tag(bmain, type);
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
#ifdef WITH_PYTHON_SAFETY
|
||||
BPY_id_release(id);
|
||||
#endif
|
||||
if (id->py_instance) {
|
||||
BPY_DECREF_RNA_INVALIDATE(id->py_instance);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (do_id_user) {
|
||||
BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
|
||||
}
|
||||
|
||||
BKE_libblock_free_datablock(id, 0);
|
||||
|
||||
/* avoid notifying on removed data */
|
||||
BKE_main_lock(bmain);
|
||||
|
||||
if (do_ui_user) {
|
||||
if (free_notifier_reference_cb) {
|
||||
free_notifier_reference_cb(id);
|
||||
}
|
||||
|
||||
if (remap_editor_id_reference_cb) {
|
||||
remap_editor_id_reference_cb(id, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_remlink(lb, id);
|
||||
|
||||
BKE_libblock_free_data(id, do_id_user);
|
||||
BKE_main_unlock(bmain);
|
||||
|
||||
MEM_freeN(id);
|
||||
}
|
||||
|
||||
void BKE_libblock_free(Main *bmain, void *idv)
|
||||
{
|
||||
BKE_id_free(bmain, idv);
|
||||
}
|
||||
|
||||
void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
|
||||
{
|
||||
ID *id = idv;
|
||||
|
Loading…
Reference in New Issue
Block a user