Files
test2/source/blender/blenkernel/BKE_library.hh
Bastien Montagne 1dca5af712 Core: Libraries: Fix library parenting when libraries are deleted.
So far, when deleting a library (either explicitely, or through e.g.
relocation), its dependencies would get a `nullptr` parent, and
therefore become 'directly used' libraries.

This commit adds a new util to rebuild the libraries hieararchy, and
calls it when a Library ID is deleted.

NOTE: While logic is somewhat similar to what liboverride resync does to
sort the libraries by indirect levels
(`lib_override_libraries_index_define`), there are some key differences
here, notably the fact that if a library has a valid `parent` pointer,
it is not replaced, even if a 'better' parent (less indirect library)
could be found.
2024-02-22 19:25:59 +01:00

24 lines
608 B
C++

/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bke
*
* API to manage `Library` data-blocks.
*/
#include "BLI_compiler_attrs.h"
struct Library;
struct Main;
void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath);
/**
* Rebuild the hierarchy of libraries, after e.g. deleting or relocating one, often some indirectly
* linked libraries lose their 'parent' pointer, making them wrongly directly used ones.
*/
void BKE_library_main_rebuild_hierarchy(Main *bmain);