Cleanup: Rename `BKE_library_override_` functions to `BKE_lib_override_library_`

pqrt of T72604.
This commit is contained in:
Bastien Montagne 2020-02-10 18:05:19 +01:00
parent c6e28f6513
commit e75e29ee47
16 changed files with 163 additions and 160 deletions

View File

@ -45,27 +45,28 @@ struct IDOverrideLibraryProperty;
struct IDOverrideLibraryPropertyOperation;
struct Main;
void BKE_override_library_enable(const bool do_enable);
bool BKE_override_library_is_enabled(void);
void BKE_lib_override_library_enable(const bool do_enable);
bool BKE_lib_override_library_is_enabled(void);
struct IDOverrideLibrary *BKE_override_library_init(struct ID *local_id, struct ID *reference_id);
void BKE_override_library_copy(struct ID *dst_id, const struct ID *src_id);
void BKE_override_library_clear(struct IDOverrideLibrary *override, const bool do_id_user);
void BKE_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user);
struct IDOverrideLibrary *BKE_lib_override_library_init(struct ID *local_id,
struct ID *reference_id);
void BKE_lib_override_library_copy(struct ID *dst_id, const struct ID *src_id);
void BKE_lib_override_library_clear(struct IDOverrideLibrary *override, const bool do_id_user);
void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user);
struct ID *BKE_override_library_create_from_id(struct Main *bmain,
struct ID *reference_id,
const bool do_tagged_remap);
bool BKE_override_library_create_from_tag(struct Main *bmain);
struct ID *BKE_lib_override_library_create_from_id(struct Main *bmain,
struct ID *reference_id,
const bool do_tagged_remap);
bool BKE_lib_override_library_create_from_tag(struct Main *bmain);
struct IDOverrideLibraryProperty *BKE_override_library_property_find(
struct IDOverrideLibraryProperty *BKE_lib_override_library_property_find(
struct IDOverrideLibrary *override, const char *rna_path);
struct IDOverrideLibraryProperty *BKE_override_library_property_get(
struct IDOverrideLibraryProperty *BKE_lib_override_library_property_get(
struct IDOverrideLibrary *override, const char *rna_path, bool *r_created);
void BKE_override_library_property_delete(struct IDOverrideLibrary *override,
struct IDOverrideLibraryProperty *override_property);
void BKE_lib_override_library_property_delete(struct IDOverrideLibrary *override,
struct IDOverrideLibraryProperty *override_property);
struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_find(
struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_find(
struct IDOverrideLibraryProperty *override_property,
const char *subitem_refname,
const char *subitem_locname,
@ -73,7 +74,7 @@ struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operati
const int subitem_locindex,
const bool strict,
bool *r_strict);
struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_get(
struct IDOverrideLibraryProperty *override_property,
const short operation,
const char *subitem_refname,
@ -83,32 +84,31 @@ struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operati
const bool strict,
bool *r_strict,
bool *r_created);
void BKE_override_library_property_operation_delete(
void BKE_lib_override_library_property_operation_delete(
struct IDOverrideLibraryProperty *override_property,
struct IDOverrideLibraryPropertyOperation *override_property_operation);
bool BKE_override_library_status_check_local(struct Main *bmain, struct ID *local);
bool BKE_override_library_status_check_reference(struct Main *bmain, struct ID *local);
bool BKE_lib_override_library_status_check_local(struct Main *bmain, struct ID *local);
bool BKE_lib_override_library_status_check_reference(struct Main *bmain, struct ID *local);
bool BKE_override_library_operations_create(struct Main *bmain,
struct ID *local,
const bool force_auto);
void BKE_main_override_library_operations_create(struct Main *bmain, const bool force_auto);
bool BKE_lib_override_library_operations_create(struct Main *bmain,
struct ID *local,
const bool force_auto);
void BKE_lib_override_library_main_operations_create(struct Main *bmain, const bool force_auto);
void BKE_override_library_update(struct Main *bmain, struct ID *local);
void BKE_main_override_library_update(struct Main *bmain);
void BKE_lib_override_library_update(struct Main *bmain, struct ID *local);
void BKE_lib_override_library_main_update(struct Main *bmain);
/* Storage (.blend file writing) part. */
/* For now, we just use a temp main list. */
typedef struct Main OverrideLibraryStorage;
OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void);
struct ID *BKE_override_library_operations_store_start(struct Main *bmain,
OverrideLibraryStorage *override_storage,
struct ID *local);
void BKE_override_library_operations_store_end(OverrideLibraryStorage *override_storage,
struct ID *local);
void BKE_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage);
OverrideLibraryStorage *BKE_lib_override_library_operations_store_initialize(void);
struct ID *BKE_lib_override_library_operations_store_start(
struct Main *bmain, OverrideLibraryStorage *override_storage, struct ID *local);
void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage *override_storage,
struct ID *local);
void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage);
#endif /* __BKE_LIB_OVERRIDE_H__ */

View File

@ -119,7 +119,7 @@ void BKE_libblock_free_data(ID *id, const bool do_id_user)
}
if (id->override_library) {
BKE_override_library_free(&id->override_library, do_id_user);
BKE_lib_override_library_free(&id->override_library, do_id_user);
}
/* XXX TODO remove animdata handling from each type's freeing func,

View File

@ -50,30 +50,31 @@
#define OVERRIDE_AUTO_CHECK_DELAY 0.2 /* 200ms between auto-override checks. */
static void bke_override_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src);
static void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst,
IDOverrideLibraryPropertyOperation *opop_src);
static void lib_override_library_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src);
static void lib_override_library_property_operation_copy(
IDOverrideLibraryPropertyOperation *opop_dst, IDOverrideLibraryPropertyOperation *opop_src);
static void bke_override_property_clear(IDOverrideLibraryProperty *op);
static void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *opop);
static void lib_override_library_property_clear(IDOverrideLibraryProperty *op);
static void lib_override_library_property_operation_clear(
IDOverrideLibraryPropertyOperation *opop);
/* Temp, for until library override is ready and tested enough to go 'public',
* we hide it by default in UI and such. */
static bool _override_library_enabled = true;
static bool _lib_override_library_enabled = true;
void BKE_override_library_enable(const bool do_enable)
void BKE_lib_override_library_enable(const bool do_enable)
{
_override_library_enabled = do_enable;
_lib_override_library_enabled = do_enable;
}
bool BKE_override_library_is_enabled()
bool BKE_lib_override_library_is_enabled()
{
return _override_library_enabled;
return _lib_override_library_enabled;
}
/** Initialize empty overriding of \a reference_id by \a local_id. */
IDOverrideLibrary *BKE_override_library_init(ID *local_id, ID *reference_id)
IDOverrideLibrary *BKE_lib_override_library_init(ID *local_id, ID *reference_id)
{
/* If reference_id is NULL, we are creating an override template for purely local data.
* Else, reference *must* be linked data. */
@ -89,7 +90,7 @@ IDOverrideLibrary *BKE_override_library_init(ID *local_id, ID *reference_id)
if (ancestor_id != NULL && ancestor_id->override_library != NULL) {
/* Original ID has a template, use it! */
BKE_override_library_copy(local_id, ancestor_id);
BKE_lib_override_library_copy(local_id, ancestor_id);
if (local_id->override_library->reference != reference_id) {
id_us_min(local_id->override_library->reference);
local_id->override_library->reference = reference_id;
@ -108,24 +109,24 @@ IDOverrideLibrary *BKE_override_library_init(ID *local_id, ID *reference_id)
}
/** Deep copy of a whole override from \a src_id to \a dst_id. */
void BKE_override_library_copy(ID *dst_id, const ID *src_id)
void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id)
{
BLI_assert(src_id->override_library != NULL);
if (dst_id->override_library != NULL) {
if (src_id->override_library == NULL) {
BKE_override_library_free(&dst_id->override_library, true);
BKE_lib_override_library_free(&dst_id->override_library, true);
return;
}
else {
BKE_override_library_clear(dst_id->override_library, true);
BKE_lib_override_library_clear(dst_id->override_library, true);
}
}
else if (src_id->override_library == NULL) {
return;
}
else {
BKE_override_library_init(dst_id, NULL);
BKE_lib_override_library_init(dst_id, NULL);
}
/* Source is already overriding data, we copy it but reuse its reference for dest ID.
@ -140,14 +141,14 @@ void BKE_override_library_copy(ID *dst_id, const ID *src_id)
*op_src = src_id->override_library->properties.first;
op_dst;
op_dst = op_dst->next, op_src = op_src->next) {
bke_override_property_copy(op_dst, op_src);
lib_override_library_property_copy(op_dst, op_src);
}
dst_id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK;
}
/** Clear any overriding data from given \a override. */
void BKE_override_library_clear(IDOverrideLibrary *override, const bool do_id_user)
void BKE_lib_override_library_clear(IDOverrideLibrary *override, const bool do_id_user)
{
BLI_assert(override != NULL);
@ -156,7 +157,7 @@ void BKE_override_library_clear(IDOverrideLibrary *override, const bool do_id_us
}
for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) {
bke_override_property_clear(op);
lib_override_library_property_clear(op);
}
BLI_freelistN(&override->properties);
@ -167,7 +168,7 @@ void BKE_override_library_clear(IDOverrideLibrary *override, const bool do_id_us
}
/** Free given \a override. */
void BKE_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user)
void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user)
{
BLI_assert(*override != NULL);
@ -176,12 +177,12 @@ void BKE_override_library_free(struct IDOverrideLibrary **override, const bool d
(*override)->runtime = NULL;
}
BKE_override_library_clear(*override, do_id_user);
BKE_lib_override_library_clear(*override, do_id_user);
MEM_freeN(*override);
*override = NULL;
}
static ID *override_library_create_from(Main *bmain, ID *reference_id)
static ID *lib_override_library_create_from(Main *bmain, ID *reference_id)
{
ID *local_id;
@ -190,19 +191,21 @@ static ID *override_library_create_from(Main *bmain, ID *reference_id)
}
id_us_min(local_id);
BKE_override_library_init(local_id, reference_id);
BKE_lib_override_library_init(local_id, reference_id);
local_id->override_library->flag |= OVERRIDE_LIBRARY_AUTO;
return local_id;
}
/** Create an overridden local copy of linked reference. */
ID *BKE_override_library_create_from_id(Main *bmain, ID *reference_id, const bool do_tagged_remap)
ID *BKE_lib_override_library_create_from_id(Main *bmain,
ID *reference_id,
const bool do_tagged_remap)
{
BLI_assert(reference_id != NULL);
BLI_assert(reference_id->lib != NULL);
ID *local_id = override_library_create_from(bmain, reference_id);
ID *local_id = lib_override_library_create_from(bmain, reference_id);
if (do_tagged_remap) {
ID *other_id;
@ -236,7 +239,7 @@ ID *BKE_override_library_create_from_id(Main *bmain, ID *reference_id, const boo
*
* \return \a true on success, \a false otherwise.
*/
bool BKE_override_library_create_from_tag(Main *bmain)
bool BKE_lib_override_library_create_from_tag(Main *bmain)
{
ID *reference_id;
bool ret = true;
@ -257,7 +260,7 @@ bool BKE_override_library_create_from_tag(Main *bmain)
/* Override the IDs. */
for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) {
reference_id = todo_id_iter->data;
if ((reference_id->newid = override_library_create_from(bmain, reference_id)) == NULL) {
if ((reference_id->newid = lib_override_library_create_from(bmain, reference_id)) == NULL) {
ret = false;
}
else {
@ -315,8 +318,8 @@ BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_mapping_ensure(
/**
* Find override property from given RNA path, if it exists.
*/
IDOverrideLibraryProperty *BKE_override_library_property_find(IDOverrideLibrary *override,
const char *rna_path)
IDOverrideLibraryProperty *BKE_lib_override_library_property_find(IDOverrideLibrary *override,
const char *rna_path)
{
IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_mapping_ensure(override);
return BLI_ghash_lookup(override_runtime, rna_path);
@ -325,11 +328,11 @@ IDOverrideLibraryProperty *BKE_override_library_property_find(IDOverrideLibrary
/**
* Find override property from given RNA path, or create it if it does not exist.
*/
IDOverrideLibraryProperty *BKE_override_library_property_get(IDOverrideLibrary *override,
const char *rna_path,
bool *r_created)
IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibrary *override,
const char *rna_path,
bool *r_created)
{
IDOverrideLibraryProperty *op = BKE_override_library_property_find(override, rna_path);
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path);
if (op == NULL) {
op = MEM_callocN(sizeof(IDOverrideLibraryProperty), __func__);
@ -351,8 +354,8 @@ IDOverrideLibraryProperty *BKE_override_library_property_get(IDOverrideLibrary *
return op;
}
void bke_override_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src)
void lib_override_library_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src)
{
op_dst->rna_path = BLI_strdup(op_src->rna_path);
BLI_duplicatelist(&op_dst->operations, &op_src->operations);
@ -361,18 +364,18 @@ void bke_override_property_copy(IDOverrideLibraryProperty *op_dst,
*opop_src = op_src->operations.first;
opop_dst;
opop_dst = opop_dst->next, opop_src = opop_src->next) {
bke_override_property_operation_copy(opop_dst, opop_src);
lib_override_library_property_operation_copy(opop_dst, opop_src);
}
}
void bke_override_property_clear(IDOverrideLibraryProperty *op)
void lib_override_library_property_clear(IDOverrideLibraryProperty *op)
{
BLI_assert(op->rna_path != NULL);
MEM_freeN(op->rna_path);
for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
bke_override_property_operation_clear(opop);
lib_override_library_property_operation_clear(opop);
}
BLI_freelistN(&op->operations);
}
@ -380,10 +383,10 @@ void bke_override_property_clear(IDOverrideLibraryProperty *op)
/**
* Remove and free given \a override_property from given ID \a override.
*/
void BKE_override_library_property_delete(IDOverrideLibrary *override,
IDOverrideLibraryProperty *override_property)
void BKE_lib_override_library_property_delete(IDOverrideLibrary *override,
IDOverrideLibraryProperty *override_property)
{
bke_override_property_clear(override_property);
lib_override_library_property_clear(override_property);
if (override->runtime != NULL) {
BLI_ghash_remove(override->runtime, override_property->rna_path, NULL, NULL);
}
@ -393,7 +396,7 @@ void BKE_override_library_property_delete(IDOverrideLibrary *override,
/**
* Find override property operation from given sub-item(s), if it exists.
*/
IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_find(
IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_find(
IDOverrideLibraryProperty *override_property,
const char *subitem_refname,
const char *subitem_locname,
@ -481,7 +484,7 @@ IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_find
/**
* Find override property operation from given sub-item(s), or create it if it does not exist.
*/
IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_get(
IDOverrideLibraryProperty *override_property,
const short operation,
const char *subitem_refname,
@ -492,7 +495,7 @@ IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
bool *r_strict,
bool *r_created)
{
IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find(
IDOverrideLibraryPropertyOperation *opop = BKE_lib_override_library_property_operation_find(
override_property,
subitem_refname,
subitem_locname,
@ -526,8 +529,8 @@ IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
return opop;
}
void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst,
IDOverrideLibraryPropertyOperation *opop_src)
void lib_override_library_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst,
IDOverrideLibraryPropertyOperation *opop_src)
{
if (opop_src->subitem_reference_name) {
opop_dst->subitem_reference_name = BLI_strdup(opop_src->subitem_reference_name);
@ -537,7 +540,7 @@ void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *op
}
}
void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *opop)
void lib_override_library_property_operation_clear(IDOverrideLibraryPropertyOperation *opop)
{
if (opop->subitem_reference_name) {
MEM_freeN(opop->subitem_reference_name);
@ -550,11 +553,11 @@ void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *o
/**
* Remove and free given \a override_property_operation from given ID \a override_property.
*/
void BKE_override_library_property_operation_delete(
void BKE_lib_override_library_property_operation_delete(
IDOverrideLibraryProperty *override_property,
IDOverrideLibraryPropertyOperation *override_property_operation)
{
bke_override_property_operation_clear(override_property_operation);
lib_override_library_property_operation_clear(override_property_operation);
BLI_freelinkN(&override_property->operations, override_property_operation);
}
@ -568,7 +571,7 @@ void BKE_override_library_property_operation_delete(
* #IDOverrideProperty (of #IDOverridePropertyOperation) has to be added.
*
* \return true if status is OK, false otherwise. */
bool BKE_override_library_status_check_local(Main *bmain, ID *local)
bool BKE_lib_override_library_status_check_local(Main *bmain, ID *local)
{
BLI_assert(local->override_library != NULL);
@ -623,7 +626,7 @@ bool BKE_override_library_status_check_local(Main *bmain, ID *local)
* needs to be updated against it.
*
* \return true if status is OK, false otherwise. */
bool BKE_override_library_status_check_reference(Main *bmain, ID *local)
bool BKE_lib_override_library_status_check_reference(Main *bmain, ID *local)
{
BLI_assert(local->override_library != NULL);
@ -637,7 +640,7 @@ bool BKE_override_library_status_check_reference(Main *bmain, ID *local)
BLI_assert(GS(local->name) == GS(reference->name));
if (reference->override_library && (reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) {
if (!BKE_override_library_status_check_reference(bmain, reference)) {
if (!BKE_lib_override_library_status_check_reference(bmain, reference)) {
/* If reference is also override of another data-block, and its status is not OK,
* then this override is not OK either.
* Note that this should only happen when reloading libraries... */
@ -688,7 +691,7 @@ bool BKE_override_library_status_check_reference(Main *bmain, ID *local)
* Generating diff values and applying overrides are much cheaper.
*
* \return true if new overriding op was created, or some local data was reset. */
bool BKE_override_library_operations_create(Main *bmain, ID *local, const bool force_auto)
bool BKE_lib_override_library_operations_create(Main *bmain, ID *local, const bool force_auto)
{
BLI_assert(local->override_library != NULL);
const bool is_template = (local->override_library->reference == NULL);
@ -744,14 +747,14 @@ bool BKE_override_library_operations_create(Main *bmain, ID *local, const bool f
}
/** Check all overrides from given \a bmain and create/update overriding operations as needed. */
void BKE_main_override_library_operations_create(Main *bmain, const bool force_auto)
void BKE_lib_override_library_main_operations_create(Main *bmain, const bool force_auto)
{
ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if ((ID_IS_OVERRIDE_LIBRARY(id) && force_auto) ||
(ID_IS_OVERRIDE_LIBRARY_AUTO(id) && (id->tag & LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH))) {
BKE_override_library_operations_create(bmain, id, force_auto);
BKE_lib_override_library_operations_create(bmain, id, force_auto);
id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH;
}
}
@ -759,7 +762,7 @@ void BKE_main_override_library_operations_create(Main *bmain, const bool force_a
}
/** Update given override from its reference (re-applying overridden properties). */
void BKE_override_library_update(Main *bmain, ID *local)
void BKE_lib_override_library_update(Main *bmain, ID *local)
{
if (local->override_library == NULL || local->override_library->reference == NULL) {
return;
@ -775,7 +778,7 @@ void BKE_override_library_update(Main *bmain, ID *local)
/* Recursively do 'ancestors' overrides first, if any. */
if (local->override_library->reference->override_library &&
(local->override_library->reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) {
BKE_override_library_update(bmain, local->override_library->reference);
BKE_lib_override_library_update(bmain, local->override_library->reference);
}
/* We want to avoid having to remap here, however creating up-to-date override is much simpler
@ -837,13 +840,13 @@ void BKE_override_library_update(Main *bmain, ID *local)
}
/** Update all overrides from given \a bmain. */
void BKE_main_override_library_update(Main *bmain)
void BKE_lib_override_library_main_update(Main *bmain)
{
ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if (id->override_library != NULL && id->lib == NULL) {
BKE_override_library_update(bmain, id);
BKE_lib_override_library_update(bmain, id);
}
}
FOREACH_MAIN_ID_END;
@ -867,7 +870,7 @@ void BKE_main_override_library_update(Main *bmain)
*/
/** Initialize an override storage. */
OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void)
OverrideLibraryStorage *BKE_lib_override_library_operations_store_initialize(void)
{
return BKE_main_new();
}
@ -877,9 +880,9 @@ OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void)
*
* Note that \a local ID is no more modified by this call,
* all extra data are stored in its temp \a storage_id copy. */
ID *BKE_override_library_operations_store_start(Main *bmain,
OverrideLibraryStorage *override_storage,
ID *local)
ID *BKE_lib_override_library_operations_store_start(Main *bmain,
OverrideLibraryStorage *override_storage,
ID *local)
{
BLI_assert(local->override_library != NULL);
BLI_assert(override_storage != NULL);
@ -891,7 +894,7 @@ ID *BKE_override_library_operations_store_start(Main *bmain,
}
/* Forcefully ensure we know about all needed override operations. */
BKE_override_library_operations_create(bmain, local, false);
BKE_lib_override_library_operations_create(bmain, local, false);
ID *storage_id;
#ifdef DEBUG_OVERRIDE_TIMEIT
@ -929,8 +932,8 @@ ID *BKE_override_library_operations_store_start(Main *bmain,
}
/** Restore given ID modified by \a BKE_override_operations_store_start, to its original state. */
void BKE_override_library_operations_store_end(OverrideLibraryStorage *UNUSED(override_storage),
ID *local)
void BKE_lib_override_library_operations_store_end(
OverrideLibraryStorage *UNUSED(override_storage), ID *local)
{
BLI_assert(local->override_library != NULL);
@ -939,7 +942,7 @@ void BKE_override_library_operations_store_end(OverrideLibraryStorage *UNUSED(ov
local->override_library->storage = NULL;
}
void BKE_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage)
void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage)
{
/* We cannot just call BKE_main_free(override_storage), not until we have option to make 'ghost'
* copies of IDs without increasing usercount of used data-blocks. */

View File

@ -504,8 +504,8 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack,
/* Might not be final place for this to be called - probably only want to call it from some
* undo handlers, not all of them? */
if (BKE_override_library_is_enabled()) {
BKE_main_override_library_operations_create(G_MAIN, false);
if (BKE_lib_override_library_is_enabled()) {
BKE_lib_override_library_main_operations_create(G_MAIN, false);
}
/* Remove all undos after (also when 'ustack->step_active == NULL'). */

View File

@ -9783,7 +9783,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
* we can re-generate overrides from their references. */
if (fd->memfile == NULL) {
/* Do not apply in undo case! */
BKE_main_override_library_update(bfd->main);
BKE_lib_override_library_main_update(bfd->main);
}
BKE_collections_after_lib_link(bfd->main);

View File

@ -3782,7 +3782,7 @@ static bool write_file_handle(Main *mainvar,
mywrite_flush(wd);
OverrideLibraryStorage *override_storage =
wd->use_memfile ? NULL : BKE_override_library_operations_store_initialize();
wd->use_memfile ? NULL : BKE_lib_override_library_operations_store_initialize();
/* This outer loop allows to save first data-blocks from real mainvar,
* then the temp ones from override process,
@ -3807,7 +3807,7 @@ static bool write_file_handle(Main *mainvar,
const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_library;
if (do_override) {
BKE_override_library_operations_store_start(bmain, override_storage, id);
BKE_lib_override_library_operations_store_start(bmain, override_storage, id);
}
switch ((ID_Type)GS(id->name)) {
@ -3927,7 +3927,7 @@ static bool write_file_handle(Main *mainvar,
}
if (do_override) {
BKE_override_library_operations_store_end(override_storage, id);
BKE_lib_override_library_operations_store_end(override_storage, id);
}
}
@ -3936,7 +3936,7 @@ static bool write_file_handle(Main *mainvar,
} while ((bmain != override_storage) && (bmain = override_storage));
if (override_storage) {
BKE_override_library_operations_store_finalize(override_storage);
BKE_lib_override_library_operations_store_finalize(override_storage);
override_storage = NULL;
}

View File

@ -650,7 +650,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
bool is_strict_find;
/* Remove override operation for given item,
* add singular operations for the other items as needed. */
IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find(
IDOverrideLibraryPropertyOperation *opop = BKE_lib_override_library_property_operation_find(
oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
@ -659,22 +659,22 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
* before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--;) {
if (idx != index) {
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL);
}
}
}
BKE_override_library_property_operation_delete(oprop, opop);
BKE_lib_override_library_property_operation_delete(oprop, opop);
if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, index);
}
if (BLI_listbase_is_empty(&oprop->operations)) {
BKE_override_library_property_delete(id->override_library, oprop);
BKE_lib_override_library_property_delete(id->override_library, oprop);
}
}
else {
/* Just remove whole generic override operation of this property. */
BKE_override_library_property_delete(id->override_library, oprop);
BKE_lib_override_library_property_delete(id->override_library, oprop);
if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, -1);
}

View File

@ -544,10 +544,10 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
case UI_ID_LOCAL:
if (id) {
Main *bmain = CTX_data_main(C);
if (BKE_override_library_is_enabled() && CTX_wm_window(C)->eventstate->shift) {
if (BKE_lib_override_library_is_enabled() && CTX_wm_window(C)->eventstate->shift) {
if (ID_IS_OVERRIDABLE_LIBRARY(id)) {
/* Only remap that specific ID usage to overriding local data-block. */
ID *override_id = BKE_override_library_create_from_id(bmain, id, false);
ID *override_id = BKE_lib_override_library_create_from_id(bmain, id, false);
if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain);
@ -570,7 +570,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_OVERRIDE:
if (id && id->override_library) {
BKE_override_library_free(&id->override_library, true);
BKE_lib_override_library_free(&id->override_library, true);
/* reassign to get get proper updates/notifiers */
idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL);
@ -894,7 +894,7 @@ static void template_ID(bContext *C,
0,
0,
0,
BKE_override_library_is_enabled() ?
BKE_lib_override_library_is_enabled() ?
TIP_("Direct linked library data-block, click to make local, "
"Shift + Click to create a library override") :
TIP_("Direct linked library data-block, click to make local"));

View File

@ -2453,7 +2453,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
success = BKE_override_library_create_from_tag(bmain);
success = BKE_lib_override_library_create_from_tag(bmain);
/* Instantiate our newly overridden objects in scene, if not yet done. */
Scene *scene = CTX_data_scene(C);
@ -2485,7 +2485,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
new_ob->id.override_library->flag &= ~OVERRIDE_LIBRARY_AUTO;
}
/* We still want to store all objects' current override status (i.e. change of parent). */
BKE_override_library_operations_create(bmain, &new_ob->id, true);
BKE_lib_override_library_operations_create(bmain, &new_ob->id, true);
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
@ -2520,7 +2520,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
make_override_library_tag_object(obact, ob);
}
success = BKE_override_library_create_from_tag(bmain);
success = BKE_lib_override_library_create_from_tag(bmain);
/* Also, we'd likely want to lock by default things like
* transformations of implicitly overridden objects? */
@ -2533,7 +2533,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
else {
/* For now, remapp all local usages of linked ID to local override one here. */
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
success = (BKE_override_library_create_from_id(bmain, &obact->id, true) != NULL);
success = (BKE_lib_override_library_create_from_id(bmain, &obact->id, true) != NULL);
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
}
@ -2547,7 +2547,7 @@ static bool make_override_library_poll(bContext *C)
Object *obact = CTX_data_active_object(C);
/* Object must be directly linked to be overridable. */
return (BKE_override_library_is_enabled() && ED_operator_objectmode(C) && obact != NULL &&
return (BKE_lib_override_library_is_enabled() && ED_operator_objectmode(C) && obact != NULL &&
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
(!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
ID_IS_LINKED(obact->instance_collection))));

View File

@ -719,7 +719,7 @@ static void id_override_library_cb(bContext *C,
Main *bmain = CTX_data_main(C);
/* For now, remapp all local usages of linked ID to local override one here. */
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
ID *override_id = BKE_override_library_create_from_id(bmain, tselem->id, true);
ID *override_id = BKE_lib_override_library_create_from_id(bmain, tselem->id, true);
if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain);
}
@ -1539,7 +1539,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
switch (enum_value) {
case OUTLINER_IDOP_OVERRIDE_LIBRARY:
return BKE_override_library_is_enabled();
return BKE_lib_override_library_is_enabled();
case OUTLINER_IDOP_SINGLE:
if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
return true;
@ -1652,7 +1652,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
case OUTLINER_IDOP_OVERRIDE_LIBRARY: {
if (BKE_override_library_is_enabled()) {
if (BKE_lib_override_library_is_enabled()) {
/* make local */
outliner_do_libdata_operation(
C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL);

View File

@ -494,7 +494,7 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
{
if (!BKE_override_library_is_enabled() || !ID_IS_OVERRIDABLE_LIBRARY(id)) {
if (!BKE_lib_override_library_is_enabled() || !ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
}
@ -502,7 +502,7 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
}
ID *local_id = BKE_override_library_create_from_id(bmain, id, remap_local_usages);
ID *local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages);
if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);

View File

@ -109,7 +109,7 @@ bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop)
return false;
}
return (BKE_override_library_property_find(id->override_library, rna_path) != NULL);
return (BKE_lib_override_library_property_find(id->override_library, rna_path) != NULL);
}
bool RNA_property_comparable(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
@ -691,7 +691,7 @@ bool RNA_struct_override_matches(Main *bmain,
// printf("Override Checking %s\n", rna_path);
if (ignore_overridden && BKE_override_library_property_find(override, rna_path) != NULL) {
if (ignore_overridden && BKE_lib_override_library_property_find(override, rna_path) != NULL) {
RNA_PATH_FREE;
continue;
}
@ -730,7 +730,7 @@ bool RNA_struct_override_matches(Main *bmain,
if (diff != 0) {
/* XXX TODO: refine this for per-item overriding of arrays... */
IDOverrideLibraryProperty *op = BKE_override_library_property_find(override, rna_path);
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path);
IDOverrideLibraryPropertyOperation *opop = op ? op->operations.first : NULL;
if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) {
@ -1059,7 +1059,7 @@ IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr,
char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (rna_path) {
IDOverrideLibraryProperty *op = BKE_override_library_property_find(id->override_library,
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(id->override_library,
rna_path);
MEM_freeN(rna_path);
return op;
@ -1079,7 +1079,7 @@ IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr,
char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (rna_path) {
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
id->override_library, rna_path, r_created);
MEM_freeN(rna_path);
return op;
@ -1096,7 +1096,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_fin
return NULL;
}
return BKE_override_library_property_operation_find(
return BKE_lib_override_library_property_operation_find(
op, NULL, NULL, index, index, strict, r_strict);
}
@ -1115,7 +1115,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get
return NULL;
}
return BKE_override_library_property_operation_get(
return BKE_lib_override_library_property_operation_get(
op, operation, NULL, NULL, index, index, strict, r_strict, r_created);
}
@ -1125,7 +1125,7 @@ eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr,
{
int override_status = 0;
if (!BKE_override_library_is_enabled()) {
if (!BKE_lib_override_library_is_enabled()) {
return override_status;
}

View File

@ -1290,13 +1290,13 @@ static int rna_property_override_diff_propptr(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
/* If not yet overridden, or if we are handling sub-items (inside a collection)... */
if (op != NULL && (created || rna_itemname_a != NULL || rna_itemname_b != NULL ||
rna_itemindex_a != -1 || rna_itemindex_b != -1)) {
BKE_override_library_property_operation_get(op,
BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_REPLACE,
rna_itemname_b,
rna_itemname_a,
@ -1421,11 +1421,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) {
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1452,11 +1452,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1486,11 +1486,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) {
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1517,11 +1517,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1551,11 +1551,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) {
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1582,11 +1582,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1605,11 +1605,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1639,11 +1639,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
BKE_override_library_property_operation_get(
BKE_lib_override_library_property_operation_get(
op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
@ -1794,7 +1794,7 @@ int rna_property_override_diff_default(Main *bmain,
* also assume then that _a data is the one where things are inserted. */
if (is_valid_for_insertion && use_insertion) {
bool created;
IDOverrideLibraryProperty *op = BKE_override_library_property_get(
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created);
if (is_first_insert) {
@ -1806,14 +1806,14 @@ int rna_property_override_diff_default(Main *bmain,
if (ELEM(opop->operation,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) {
BKE_override_library_property_operation_delete(op, opop);
BKE_lib_override_library_property_operation_delete(op, opop);
}
opop = opop_next;
}
is_first_insert = false;
}
BKE_override_library_property_operation_get(op,
BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
NULL,
prev_propname_a,

View File

@ -396,7 +396,7 @@ PyDoc_STRVAR(bpy_app_use_override_library_doc,
"Boolean, whether library override is exposed in UI or not.");
static PyObject *bpy_app_use_override_library_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
return PyBool_FromLong((long)BKE_override_library_is_enabled());
return PyBool_FromLong((long)BKE_lib_override_library_is_enabled());
}
static int bpy_app_use_override_library_set(PyObject *UNUSED(self),
@ -410,7 +410,7 @@ static int bpy_app_use_override_library_set(PyObject *UNUSED(self),
return -1;
}
BKE_override_library_enable((const bool)param);
BKE_lib_override_library_enable((const bool)param);
return 0;
}

View File

@ -1366,7 +1366,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE);
/* Enforce full override check/generation on file save. */
BKE_main_override_library_operations_create(bmain, true);
BKE_lib_override_library_main_operations_create(bmain, true);
/* blend file thumbnail */
/* Save before exit_editmode, otherwise derivedmeshes for shared data corrupt T27765. */

View File

@ -1115,7 +1115,7 @@ static int arg_handle_disable_override_library(int UNUSED(argc),
const char **UNUSED(argv),
void *UNUSED(data))
{
BKE_override_library_enable(false);
BKE_lib_override_library_enable(false);
return 0;
}