Cleanup: replace usages of deprecated BKE_libblock_free by BKE_id_free.
This commit is contained in:
@@ -443,9 +443,9 @@ bool BKE_blendfile_read_from_memfile(
|
||||
if (bfd) {
|
||||
/* remove the unused screens and wm */
|
||||
while (bfd->main->wm.first)
|
||||
BKE_libblock_free(bfd->main, bfd->main->wm.first);
|
||||
BKE_id_free(bfd->main, bfd->main->wm.first);
|
||||
while (bfd->main->screen.first)
|
||||
BKE_libblock_free(bfd->main, bfd->main->screen.first);
|
||||
BKE_id_free(bfd->main, bfd->main->screen.first);
|
||||
|
||||
setup_app_data(C, bfd, "<memory1>", params->is_startup, reports);
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ void BKE_image_merge(Main *bmain, Image *dest, Image *source)
|
||||
}
|
||||
BLI_spin_unlock(&image_spin);
|
||||
|
||||
BKE_libblock_free(bmain, source);
|
||||
BKE_id_free(bmain, source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2035,7 +2035,7 @@ void BKE_library_make_local(
|
||||
if (!is_lib) { /* Not used at all, we can free it! */
|
||||
BLI_assert(!"Unused linked data copy remaining from MakeLibLocal process, should not happen anymore");
|
||||
printf("\t%s (from %s)\n", id->name, id->lib->id.name);
|
||||
BKE_libblock_free(bmain, id);
|
||||
BKE_id_free(bmain, id);
|
||||
it->link = NULL;
|
||||
do_loop = true;
|
||||
}
|
||||
@@ -2093,7 +2093,7 @@ void BKE_library_make_local(
|
||||
BKE_libblock_free_ex(bmain, id, false, true);
|
||||
#else
|
||||
BKE_libblock_unlink(bmain, id, false, false);
|
||||
BKE_libblock_free(bmain, id);
|
||||
BKE_id_free(bmain, id);
|
||||
#endif
|
||||
((LinkNode *)it->link)->link = NULL; /* Not strictly necessary, but safer (see T49903)... */
|
||||
it->link = NULL;
|
||||
|
||||
@@ -973,7 +973,7 @@ void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
|
||||
if (id->us == 0) {
|
||||
BKE_libblock_unlink(bmain, id, false, false);
|
||||
|
||||
BKE_libblock_free(bmain, id);
|
||||
BKE_id_free(bmain, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,7 +1022,7 @@ void BKE_libblock_delete(Main *bmain, void *idv)
|
||||
#endif
|
||||
BLI_assert(id->us == 0);
|
||||
}
|
||||
BKE_libblock_free(bmain, id);
|
||||
BKE_id_free(bmain, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ void BKE_mesh_from_nurbs_displist(
|
||||
* the entire scene with associated depsgraph updates, which are
|
||||
* problematic for renderers exporting data. */
|
||||
id_us_min(&cu->id);
|
||||
BKE_libblock_free(bmain, cu);
|
||||
BKE_id_free(bmain, cu);
|
||||
}
|
||||
else {
|
||||
BKE_libblock_free_us(bmain, cu);
|
||||
@@ -921,11 +921,11 @@ Mesh *BKE_mesh_new_from_object(
|
||||
* if it didn't the curve did not have any segments or otherwise
|
||||
* would have generated an empty mesh */
|
||||
if (tmpobj->type != OB_MESH) {
|
||||
BKE_libblock_free(bmain, tmpobj);
|
||||
BKE_id_free(bmain, tmpobj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BKE_libblock_free(bmain, tmpobj);
|
||||
BKE_id_free(bmain, tmpobj);
|
||||
|
||||
/* XXX The curve to mesh conversion is convoluted... But essentially, BKE_mesh_from_nurbs_displist()
|
||||
* already transfers the ownership of materials from the temp copy of the Curve ID to the new
|
||||
|
||||
@@ -5237,14 +5237,14 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
|
||||
sound = BKE_sound_new_file(bmain, seq_load->path); /* handles relative paths */
|
||||
|
||||
if (sound->playback_handle == NULL) {
|
||||
BKE_libblock_free(bmain, sound);
|
||||
BKE_id_free(bmain, sound);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info = AUD_getInfo(sound->playback_handle);
|
||||
|
||||
if (info.specs.channels == AUD_CHANNELS_INVALID) {
|
||||
BKE_libblock_free(bmain, sound);
|
||||
BKE_id_free(bmain, sound);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
|
||||
|
||||
/**
|
||||
* The function that actually frees the workspace data (not workspace itself). It shouldn't be called
|
||||
* directly, instead #BKE_workspace_remove should be, which calls this through #BKE_libblock_free then.
|
||||
* directly, instead #BKE_workspace_remove should be, which calls this through #BKE_id_free then.
|
||||
*
|
||||
* Should something like a bke_internal.h be added, this should go there!
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ void BKE_workspace_free(WorkSpace *workspace)
|
||||
|
||||
/**
|
||||
* Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that
|
||||
* calls #BKE_workspace_free (through #BKE_libblock_free) to free the workspace data, and frees
|
||||
* calls #BKE_workspace_free (through #BKE_id_free) to free the workspace data, and frees
|
||||
* other data-blocks owned by \a workspace and its layouts (currently that is screens only).
|
||||
*
|
||||
* Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.
|
||||
@@ -184,7 +184,7 @@ void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
|
||||
layout_next = layout->next;
|
||||
BKE_workspace_layout_remove(bmain, workspace, layout);
|
||||
}
|
||||
BKE_libblock_free(bmain, workspace);
|
||||
BKE_id_free(bmain, workspace);
|
||||
}
|
||||
|
||||
WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain)
|
||||
@@ -247,7 +247,7 @@ void BKE_workspace_layout_remove(
|
||||
WorkSpace *workspace, WorkSpaceLayout *layout)
|
||||
{
|
||||
id_us_min(&layout->screen->id);
|
||||
BKE_libblock_free(bmain, layout->screen);
|
||||
BKE_id_free(bmain, layout->screen);
|
||||
BLI_freelinkN(&workspace->layouts, layout);
|
||||
}
|
||||
|
||||
|
||||
@@ -8682,7 +8682,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
|
||||
oldnewmap_clear(fd->datamap);
|
||||
|
||||
if (wrong_id) {
|
||||
BKE_libblock_free(main, id);
|
||||
BKE_id_free(main, id);
|
||||
}
|
||||
|
||||
return (bhead);
|
||||
|
||||
@@ -961,7 +961,7 @@ static int bake(
|
||||
RE_bake_pixels_populate(me_nores, pixel_array_low, num_pixels, &bake_images, uv_layer);
|
||||
|
||||
RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low->obmat);
|
||||
BKE_libblock_free(bmain, me_nores);
|
||||
BKE_id_free(bmain, me_nores);
|
||||
|
||||
if (md)
|
||||
md->mode = mode;
|
||||
@@ -1070,7 +1070,7 @@ cleanup:
|
||||
int i;
|
||||
for (i = 0; i < tot_highpoly; i++) {
|
||||
if (highpoly[i].me)
|
||||
BKE_libblock_free(bmain, highpoly[i].me);
|
||||
BKE_id_free(bmain, highpoly[i].me);
|
||||
}
|
||||
MEM_freeN(highpoly);
|
||||
}
|
||||
@@ -1094,10 +1094,10 @@ cleanup:
|
||||
MEM_freeN(result);
|
||||
|
||||
if (me_low)
|
||||
BKE_libblock_free(bmain, me_low);
|
||||
BKE_id_free(bmain, me_low);
|
||||
|
||||
if (me_cage)
|
||||
BKE_libblock_free(bmain, me_cage);
|
||||
BKE_id_free(bmain, me_cage);
|
||||
|
||||
DEG_graph_free(depsgraph);
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene)
|
||||
|
||||
id_us_clear_real(&scene->id);
|
||||
if (scene->id.us == 0) {
|
||||
BKE_libblock_free(bmain, scene);
|
||||
BKE_id_free(bmain, scene);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -238,7 +238,7 @@ bool ED_workspace_delete(
|
||||
|
||||
ED_workspace_change((prev != NULL) ? prev : next, C, wm, win);
|
||||
}
|
||||
BKE_libblock_free(bmain, workspace_id);
|
||||
BKE_id_free(bmain, workspace_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (sound->playback_handle == NULL) {
|
||||
if (op->customdata) MEM_freeN(op->customdata);
|
||||
BKE_libblock_free(bmain, sound);
|
||||
BKE_id_free(bmain, sound);
|
||||
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
|
||||
info = AUD_getInfo(sound->playback_handle);
|
||||
|
||||
if (info.specs.channels == AUD_CHANNELS_INVALID) {
|
||||
BKE_libblock_free(bmain, sound);
|
||||
BKE_id_free(bmain, sound);
|
||||
if (op->customdata) MEM_freeN(op->customdata);
|
||||
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
@@ -274,13 +274,13 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
|
||||
|
||||
/* free temp action too */
|
||||
if (waction) {
|
||||
BKE_libblock_free(bmain, waction);
|
||||
BKE_id_free(bmain, waction);
|
||||
wgroup->adt->action = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* free the group tree (takes care of user count) */
|
||||
BKE_libblock_free(bmain, wgroup);
|
||||
BKE_id_free(bmain, wgroup);
|
||||
|
||||
/* restore external links to and from the gnode */
|
||||
/* note: the nodes have been copied to intermediate wgroup first (so need to use new_node),
|
||||
|
||||
@@ -197,12 +197,12 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
|
||||
#endif
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
BKE_libblock_free(freestyle_bmain, ob);
|
||||
BKE_libblock_free(freestyle_bmain, data);
|
||||
BKE_id_free(freestyle_bmain, ob);
|
||||
BKE_id_free(freestyle_bmain, data);
|
||||
break;
|
||||
case OB_CAMERA:
|
||||
BKE_libblock_free(freestyle_bmain, ob);
|
||||
BKE_libblock_free(freestyle_bmain, data);
|
||||
BKE_id_free(freestyle_bmain, ob);
|
||||
BKE_id_free(freestyle_bmain, data);
|
||||
freestyle_scene->camera = NULL;
|
||||
break;
|
||||
default:
|
||||
@@ -220,7 +220,7 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
|
||||
{
|
||||
Material *ma = (Material*)lnk;
|
||||
lnk = lnk->next;
|
||||
BKE_libblock_free(freestyle_bmain, ma);
|
||||
BKE_id_free(freestyle_bmain, ma);
|
||||
}
|
||||
|
||||
BLI_ghash_free(_nodetree_hash, NULL, NULL);
|
||||
|
||||
@@ -167,7 +167,7 @@ static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
|
||||
}
|
||||
static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
|
||||
{
|
||||
/* don't call BKE_libblock_free(...) directly */
|
||||
/* don't call BKE_id_free(...) directly */
|
||||
Scene *scene = scene_ptr->data;
|
||||
Scene *scene_new;
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor
|
||||
bSound *sound = BKE_sound_new_file(bmain, file);
|
||||
|
||||
if (sound->playback_handle == NULL) {
|
||||
BKE_libblock_free(bmain, sound);
|
||||
BKE_id_free(bmain, sound);
|
||||
BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1346,7 +1346,7 @@ static void free_all_freestyle_renders(void)
|
||||
freestyle_scene = freestyle_render->scene;
|
||||
RE_FreeRender(freestyle_render);
|
||||
BKE_libblock_unlink(re1->freestyle_bmain, freestyle_scene, false, false);
|
||||
BKE_libblock_free(re1->freestyle_bmain, freestyle_scene);
|
||||
BKE_id_free(re1->freestyle_bmain, freestyle_scene);
|
||||
}
|
||||
}
|
||||
BLI_freelistN(&re1->freestyle_renders);
|
||||
|
||||
@@ -747,7 +747,7 @@ static void lib_relocate_do(
|
||||
ID *old_id = item->customdata;
|
||||
|
||||
if (old_id->us == 0) {
|
||||
BKE_libblock_free(bmain, old_id);
|
||||
BKE_id_free(bmain, old_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ static void lib_relocate_do(
|
||||
id_next = id->next;
|
||||
/* XXX That check may be a bit to generic/permissive? */
|
||||
if (id->lib && (id->flag & LIB_TAG_PRE_EXISTING) && id->us == 0) {
|
||||
BKE_libblock_free(bmain, id);
|
||||
BKE_id_free(bmain, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -782,7 +782,7 @@ static void lib_relocate_do(
|
||||
if (lib->id.tag & LIB_TAG_DOIT) {
|
||||
id_us_clear_real(&lib->id);
|
||||
if (lib->id.us == 0) {
|
||||
BKE_libblock_free(bmain, (ID *)lib);
|
||||
BKE_id_free(bmain, (ID *)lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user