Merge branch 'master' into blender2.8

This commit is contained in:
Sergey Sharybin
2017-06-14 10:48:20 +02:00
2 changed files with 30 additions and 23 deletions

View File

@@ -65,6 +65,7 @@ struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_
/* library_remap.c (keep here since they're general functions) */
void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL();
void BKE_libblock_free_datablock(struct ID *id) ATTR_NONNULL();
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_us(struct Main *bmain, void *idv) ATTR_NONNULL();
void BKE_libblock_free_data(struct Main *bmain, struct ID *id, const bool do_id_user) ATTR_NONNULL();

View File

@@ -759,30 +759,9 @@ void BKE_libblock_free_data(Main *UNUSED(bmain), ID *id, const bool do_id_user)
}
}
/**
* 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)
void BKE_libblock_free_datablock(ID *id)
{
ID *id = idv;
short type = GS(id->name);
ListBase *lb = which_libbase(bmain, type);
DEG_id_type_tag(bmain, type);
#ifdef WITH_PYTHON
BPY_id_release(id);
#endif
if (do_id_user) {
BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
}
const short type = GS(id->name);
switch (type) {
case ID_SCE:
BKE_scene_free((Scene *)id);
@@ -894,6 +873,33 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b
BKE_workspace_free((WorkSpace *)id);
break;
}
}
/**
* 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
BPY_id_release(id);
#endif
if (do_id_user) {
BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
}
BKE_libblock_free_datablock(id);
/* avoid notifying on removed data */
BKE_main_lock(bmain);