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 IDOverrideLibraryPropertyOperation;
struct Main; struct Main;
void BKE_override_library_enable(const bool do_enable); void BKE_lib_override_library_enable(const bool do_enable);
bool BKE_override_library_is_enabled(void); bool BKE_lib_override_library_is_enabled(void);
struct IDOverrideLibrary *BKE_override_library_init(struct ID *local_id, struct ID *reference_id); struct IDOverrideLibrary *BKE_lib_override_library_init(struct ID *local_id,
void BKE_override_library_copy(struct ID *dst_id, const struct ID *src_id); struct ID *reference_id);
void BKE_override_library_clear(struct IDOverrideLibrary *override, const bool do_id_user); void BKE_lib_override_library_copy(struct ID *dst_id, const struct ID *src_id);
void BKE_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user); 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 *BKE_lib_override_library_create_from_id(struct Main *bmain,
struct ID *reference_id, struct ID *reference_id,
const bool do_tagged_remap); const bool do_tagged_remap);
bool BKE_override_library_create_from_tag(struct Main *bmain); 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 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); struct IDOverrideLibrary *override, const char *rna_path, bool *r_created);
void BKE_override_library_property_delete(struct IDOverrideLibrary *override, void BKE_lib_override_library_property_delete(struct IDOverrideLibrary *override,
struct IDOverrideLibraryProperty *override_property); 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, struct IDOverrideLibraryProperty *override_property,
const char *subitem_refname, const char *subitem_refname,
const char *subitem_locname, const char *subitem_locname,
@ -73,7 +74,7 @@ struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operati
const int subitem_locindex, const int subitem_locindex,
const bool strict, const bool strict,
bool *r_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, struct IDOverrideLibraryProperty *override_property,
const short operation, const short operation,
const char *subitem_refname, const char *subitem_refname,
@ -83,32 +84,31 @@ struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operati
const bool strict, const bool strict,
bool *r_strict, bool *r_strict,
bool *r_created); bool *r_created);
void BKE_override_library_property_operation_delete( void BKE_lib_override_library_property_operation_delete(
struct IDOverrideLibraryProperty *override_property, struct IDOverrideLibraryProperty *override_property,
struct IDOverrideLibraryPropertyOperation *override_property_operation); struct IDOverrideLibraryPropertyOperation *override_property_operation);
bool BKE_override_library_status_check_local(struct Main *bmain, struct ID *local); bool BKE_lib_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_reference(struct Main *bmain, struct ID *local);
bool BKE_override_library_operations_create(struct Main *bmain, bool BKE_lib_override_library_operations_create(struct Main *bmain,
struct ID *local, struct ID *local,
const bool force_auto); const bool force_auto);
void BKE_main_override_library_operations_create(struct Main *bmain, 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_lib_override_library_update(struct Main *bmain, struct ID *local);
void BKE_main_override_library_update(struct Main *bmain); void BKE_lib_override_library_main_update(struct Main *bmain);
/* Storage (.blend file writing) part. */ /* Storage (.blend file writing) part. */
/* For now, we just use a temp main list. */ /* For now, we just use a temp main list. */
typedef struct Main OverrideLibraryStorage; typedef struct Main OverrideLibraryStorage;
OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void); OverrideLibraryStorage *BKE_lib_override_library_operations_store_initialize(void);
struct ID *BKE_override_library_operations_store_start(struct Main *bmain, struct ID *BKE_lib_override_library_operations_store_start(
OverrideLibraryStorage *override_storage, struct Main *bmain, OverrideLibraryStorage *override_storage, struct ID *local);
struct ID *local); void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage *override_storage,
void BKE_override_library_operations_store_end(OverrideLibraryStorage *override_storage, struct ID *local);
struct ID *local); void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage);
void BKE_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage);
#endif /* __BKE_LIB_OVERRIDE_H__ */ #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) { 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, /* 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. */ #define OVERRIDE_AUTO_CHECK_DELAY 0.2 /* 200ms between auto-override checks. */
static void bke_override_property_copy(IDOverrideLibraryProperty *op_dst, static void lib_override_library_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src); IDOverrideLibraryProperty *op_src);
static void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst, static void lib_override_library_property_operation_copy(
IDOverrideLibraryPropertyOperation *opop_src); IDOverrideLibraryPropertyOperation *opop_dst, IDOverrideLibraryPropertyOperation *opop_src);
static void bke_override_property_clear(IDOverrideLibraryProperty *op); static void lib_override_library_property_clear(IDOverrideLibraryProperty *op);
static void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *opop); static void lib_override_library_property_operation_clear(
IDOverrideLibraryPropertyOperation *opop);
/* Temp, for until library override is ready and tested enough to go 'public', /* Temp, for until library override is ready and tested enough to go 'public',
* we hide it by default in UI and such. */ * 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. */ /** 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. /* If reference_id is NULL, we are creating an override template for purely local data.
* Else, reference *must* be linked 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) { if (ancestor_id != NULL && ancestor_id->override_library != NULL) {
/* Original ID has a template, use it! */ /* 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) { if (local_id->override_library->reference != reference_id) {
id_us_min(local_id->override_library->reference); id_us_min(local_id->override_library->reference);
local_id->override_library->reference = reference_id; 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. */ /** 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); BLI_assert(src_id->override_library != NULL);
if (dst_id->override_library != NULL) { if (dst_id->override_library != NULL) {
if (src_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; return;
} }
else { 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) { else if (src_id->override_library == NULL) {
return; return;
} }
else { 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. /* 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_src = src_id->override_library->properties.first;
op_dst; op_dst;
op_dst = op_dst->next, op_src = op_src->next) { 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; dst_id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK;
} }
/** Clear any overriding data from given \a override. */ /** 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); 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) { 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); BLI_freelistN(&override->properties);
@ -167,7 +168,7 @@ void BKE_override_library_clear(IDOverrideLibrary *override, const bool do_id_us
} }
/** Free given \a override. */ /** 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); BLI_assert(*override != NULL);
@ -176,12 +177,12 @@ void BKE_override_library_free(struct IDOverrideLibrary **override, const bool d
(*override)->runtime = NULL; (*override)->runtime = NULL;
} }
BKE_override_library_clear(*override, do_id_user); BKE_lib_override_library_clear(*override, do_id_user);
MEM_freeN(*override); MEM_freeN(*override);
*override = NULL; *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; ID *local_id;
@ -190,19 +191,21 @@ static ID *override_library_create_from(Main *bmain, ID *reference_id)
} }
id_us_min(local_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; local_id->override_library->flag |= OVERRIDE_LIBRARY_AUTO;
return local_id; return local_id;
} }
/** Create an overridden local copy of linked reference. */ /** 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 != NULL);
BLI_assert(reference_id->lib != 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) { if (do_tagged_remap) {
ID *other_id; 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. * \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; ID *reference_id;
bool ret = true; bool ret = true;
@ -257,7 +260,7 @@ bool BKE_override_library_create_from_tag(Main *bmain)
/* Override the IDs. */ /* Override the IDs. */
for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) { for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) {
reference_id = todo_id_iter->data; 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; ret = false;
} }
else { else {
@ -315,8 +318,8 @@ BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_mapping_ensure(
/** /**
* Find override property from given RNA path, if it exists. * Find override property from given RNA path, if it exists.
*/ */
IDOverrideLibraryProperty *BKE_override_library_property_find(IDOverrideLibrary *override, IDOverrideLibraryProperty *BKE_lib_override_library_property_find(IDOverrideLibrary *override,
const char *rna_path) const char *rna_path)
{ {
IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_mapping_ensure(override); IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_mapping_ensure(override);
return BLI_ghash_lookup(override_runtime, rna_path); 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. * Find override property from given RNA path, or create it if it does not exist.
*/ */
IDOverrideLibraryProperty *BKE_override_library_property_get(IDOverrideLibrary *override, IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibrary *override,
const char *rna_path, const char *rna_path,
bool *r_created) 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) { if (op == NULL) {
op = MEM_callocN(sizeof(IDOverrideLibraryProperty), __func__); op = MEM_callocN(sizeof(IDOverrideLibraryProperty), __func__);
@ -351,8 +354,8 @@ IDOverrideLibraryProperty *BKE_override_library_property_get(IDOverrideLibrary *
return op; return op;
} }
void bke_override_property_copy(IDOverrideLibraryProperty *op_dst, void lib_override_library_property_copy(IDOverrideLibraryProperty *op_dst,
IDOverrideLibraryProperty *op_src) IDOverrideLibraryProperty *op_src)
{ {
op_dst->rna_path = BLI_strdup(op_src->rna_path); op_dst->rna_path = BLI_strdup(op_src->rna_path);
BLI_duplicatelist(&op_dst->operations, &op_src->operations); 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_src = op_src->operations.first;
opop_dst; opop_dst;
opop_dst = opop_dst->next, opop_src = opop_src->next) { 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); BLI_assert(op->rna_path != NULL);
MEM_freeN(op->rna_path); MEM_freeN(op->rna_path);
for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { 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); 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. * Remove and free given \a override_property from given ID \a override.
*/ */
void BKE_override_library_property_delete(IDOverrideLibrary *override, void BKE_lib_override_library_property_delete(IDOverrideLibrary *override,
IDOverrideLibraryProperty *override_property) IDOverrideLibraryProperty *override_property)
{ {
bke_override_property_clear(override_property); lib_override_library_property_clear(override_property);
if (override->runtime != NULL) { if (override->runtime != NULL) {
BLI_ghash_remove(override->runtime, override_property->rna_path, NULL, 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. * 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, IDOverrideLibraryProperty *override_property,
const char *subitem_refname, const char *subitem_refname,
const char *subitem_locname, 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. * 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, IDOverrideLibraryProperty *override_property,
const short operation, const short operation,
const char *subitem_refname, const char *subitem_refname,
@ -492,7 +495,7 @@ IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
bool *r_strict, bool *r_strict,
bool *r_created) bool *r_created)
{ {
IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find( IDOverrideLibraryPropertyOperation *opop = BKE_lib_override_library_property_operation_find(
override_property, override_property,
subitem_refname, subitem_refname,
subitem_locname, subitem_locname,
@ -526,8 +529,8 @@ IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get(
return opop; return opop;
} }
void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst, void lib_override_library_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst,
IDOverrideLibraryPropertyOperation *opop_src) IDOverrideLibraryPropertyOperation *opop_src)
{ {
if (opop_src->subitem_reference_name) { if (opop_src->subitem_reference_name) {
opop_dst->subitem_reference_name = BLI_strdup(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) { if (opop->subitem_reference_name) {
MEM_freeN(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. * 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, IDOverrideLibraryProperty *override_property,
IDOverrideLibraryPropertyOperation *override_property_operation) 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); 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. * #IDOverrideProperty (of #IDOverridePropertyOperation) has to be added.
* *
* \return true if status is OK, false otherwise. */ * \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); 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. * needs to be updated against it.
* *
* \return true if status is OK, false otherwise. */ * \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); 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)); BLI_assert(GS(local->name) == GS(reference->name));
if (reference->override_library && (reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) { 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, /* If reference is also override of another data-block, and its status is not OK,
* then this override is not OK either. * then this override is not OK either.
* Note that this should only happen when reloading libraries... */ * 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. * Generating diff values and applying overrides are much cheaper.
* *
* \return true if new overriding op was created, or some local data was reset. */ * \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); BLI_assert(local->override_library != NULL);
const bool is_template = (local->override_library->reference == 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. */ /** 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; ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) { FOREACH_MAIN_ID_BEGIN (bmain, id) {
if ((ID_IS_OVERRIDE_LIBRARY(id) && force_auto) || if ((ID_IS_OVERRIDE_LIBRARY(id) && force_auto) ||
(ID_IS_OVERRIDE_LIBRARY_AUTO(id) && (id->tag & LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH))) { (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; 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). */ /** 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) { if (local->override_library == NULL || local->override_library->reference == NULL) {
return; return;
@ -775,7 +778,7 @@ void BKE_override_library_update(Main *bmain, ID *local)
/* Recursively do 'ancestors' overrides first, if any. */ /* Recursively do 'ancestors' overrides first, if any. */
if (local->override_library->reference->override_library && if (local->override_library->reference->override_library &&
(local->override_library->reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) { (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 /* 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. */ /** 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; ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) { FOREACH_MAIN_ID_BEGIN (bmain, id) {
if (id->override_library != NULL && id->lib == NULL) { 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; FOREACH_MAIN_ID_END;
@ -867,7 +870,7 @@ void BKE_main_override_library_update(Main *bmain)
*/ */
/** Initialize an override storage. */ /** 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(); 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, * Note that \a local ID is no more modified by this call,
* all extra data are stored in its temp \a storage_id copy. */ * all extra data are stored in its temp \a storage_id copy. */
ID *BKE_override_library_operations_store_start(Main *bmain, ID *BKE_lib_override_library_operations_store_start(Main *bmain,
OverrideLibraryStorage *override_storage, OverrideLibraryStorage *override_storage,
ID *local) ID *local)
{ {
BLI_assert(local->override_library != NULL); BLI_assert(local->override_library != NULL);
BLI_assert(override_storage != 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. */ /* 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; ID *storage_id;
#ifdef DEBUG_OVERRIDE_TIMEIT #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. */ /** 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), void BKE_lib_override_library_operations_store_end(
ID *local) OverrideLibraryStorage *UNUSED(override_storage), ID *local)
{ {
BLI_assert(local->override_library != NULL); 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; 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' /* 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. */ * 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 /* Might not be final place for this to be called - probably only want to call it from some
* undo handlers, not all of them? */ * undo handlers, not all of them? */
if (BKE_override_library_is_enabled()) { if (BKE_lib_override_library_is_enabled()) {
BKE_main_override_library_operations_create(G_MAIN, false); BKE_lib_override_library_main_operations_create(G_MAIN, false);
} }
/* Remove all undos after (also when 'ustack->step_active == NULL'). */ /* 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. */ * we can re-generate overrides from their references. */
if (fd->memfile == NULL) { if (fd->memfile == NULL) {
/* Do not apply in undo case! */ /* 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); BKE_collections_after_lib_link(bfd->main);

View File

@ -3782,7 +3782,7 @@ static bool write_file_handle(Main *mainvar,
mywrite_flush(wd); mywrite_flush(wd);
OverrideLibraryStorage *override_storage = 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, /* This outer loop allows to save first data-blocks from real mainvar,
* then the temp ones from override process, * 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; const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_library;
if (do_override) { 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)) { switch ((ID_Type)GS(id->name)) {
@ -3927,7 +3927,7 @@ static bool write_file_handle(Main *mainvar,
} }
if (do_override) { 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)); } while ((bmain != override_storage) && (bmain = override_storage));
if (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; override_storage = NULL;
} }

View File

@ -650,7 +650,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
bool is_strict_find; bool is_strict_find;
/* Remove override operation for given item, /* Remove override operation for given item,
* add singular operations for the other items as needed. */ * 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); oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL); BLI_assert(opop != NULL);
if (!is_strict_find) { if (!is_strict_find) {
@ -659,22 +659,22 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
* before removing generic one. */ * before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--;) { for (int idx = RNA_property_array_length(&ptr, prop); idx--;) {
if (idx != index) { 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); 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) { if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, index); RNA_property_copy(bmain, &ptr, &src, prop, index);
} }
if (BLI_listbase_is_empty(&oprop->operations)) { 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 { else {
/* Just remove whole generic override operation of this property. */ /* 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) { if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, -1); 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: case UI_ID_LOCAL:
if (id) { if (id) {
Main *bmain = CTX_data_main(C); 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)) { if (ID_IS_OVERRIDABLE_LIBRARY(id)) {
/* Only remap that specific ID usage to overriding local data-block. */ /* 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) { if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain); BKE_main_id_clear_newpoins(bmain);
@ -570,7 +570,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break; break;
case UI_ID_OVERRIDE: case UI_ID_OVERRIDE:
if (id && id->override_library) { 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 */ /* reassign to get get proper updates/notifiers */
idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); 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, 0,
0, 0,
BKE_override_library_is_enabled() ? BKE_lib_override_library_is_enabled() ?
TIP_("Direct linked library data-block, click to make local, " TIP_("Direct linked library data-block, click to make local, "
"Shift + Click to create a library override") : "Shift + Click to create a library override") :
TIP_("Direct linked library data-block, click to make local")); 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; 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. */ /* Instantiate our newly overridden objects in scene, if not yet done. */
Scene *scene = CTX_data_scene(C); 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; new_ob->id.override_library->flag &= ~OVERRIDE_LIBRARY_AUTO;
} }
/* We still want to store all objects' current override status (i.e. change of parent). */ /* 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; 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); 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 /* Also, we'd likely want to lock by default things like
* transformations of implicitly overridden objects? */ * transformations of implicitly overridden objects? */
@ -2533,7 +2533,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
else { else {
/* For now, remapp all local usages of linked ID to local override one here. */ /* For now, remapp all local usages of linked ID to local override one here. */
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true); 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); 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 *obact = CTX_data_active_object(C);
/* Object must be directly linked to be overridable. */ /* 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->id.tag & LIB_TAG_EXTERN) ||
(!ID_IS_LINKED(obact) && obact->instance_collection != NULL && (!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
ID_IS_LINKED(obact->instance_collection)))); 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); Main *bmain = CTX_data_main(C);
/* For now, remapp all local usages of linked ID to local override one here. */ /* For now, remapp all local usages of linked ID to local override one here. */
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true); 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) { if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain); BKE_main_id_clear_newpoins(bmain);
} }
@ -1539,7 +1539,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
switch (enum_value) { switch (enum_value) {
case OUTLINER_IDOP_OVERRIDE_LIBRARY: case OUTLINER_IDOP_OVERRIDE_LIBRARY:
return BKE_override_library_is_enabled(); return BKE_lib_override_library_is_enabled();
case OUTLINER_IDOP_SINGLE: case OUTLINER_IDOP_SINGLE:
if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) { if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
return true; return true;
@ -1652,7 +1652,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break; break;
} }
case OUTLINER_IDOP_OVERRIDE_LIBRARY: { case OUTLINER_IDOP_OVERRIDE_LIBRARY: {
if (BKE_override_library_is_enabled()) { if (BKE_lib_override_library_is_enabled()) {
/* make local */ /* make local */
outliner_do_libdata_operation( outliner_do_libdata_operation(
C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL); 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) 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; 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); 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) { if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); 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 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) 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); // 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; RNA_PATH_FREE;
continue; continue;
} }
@ -730,7 +730,7 @@ bool RNA_struct_override_matches(Main *bmain,
if (diff != 0) { if (diff != 0) {
/* XXX TODO: refine this for per-item overriding of arrays... */ /* 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; IDOverrideLibraryPropertyOperation *opop = op ? op->operations.first : NULL;
if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) { 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); char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (rna_path) { 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); rna_path);
MEM_freeN(rna_path); MEM_freeN(rna_path);
return op; 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); char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (rna_path) { 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); id->override_library, rna_path, r_created);
MEM_freeN(rna_path); MEM_freeN(rna_path);
return op; return op;
@ -1096,7 +1096,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_fin
return NULL; 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); op, NULL, NULL, index, index, strict, r_strict);
} }
@ -1115,7 +1115,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get
return NULL; 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); 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; int override_status = 0;
if (!BKE_override_library_is_enabled()) { if (!BKE_lib_override_library_is_enabled()) {
return override_status; return override_status;
} }

View File

@ -1290,13 +1290,13 @@ static int rna_property_override_diff_propptr(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
/* If not yet overridden, or if we are handling sub-items (inside a collection)... */ /* 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 || if (op != NULL && (created || rna_itemname_a != NULL || rna_itemname_b != NULL ||
rna_itemindex_a != -1 || rna_itemindex_b != -1)) { 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, IDOVERRIDE_LIBRARY_OP_REPLACE,
rna_itemname_b, rna_itemname_b,
rna_itemname_a, rna_itemname_a,
@ -1421,11 +1421,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */ /* XXX TODO this will have to be refined to handle array items */
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1452,11 +1452,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */ 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1486,11 +1486,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */ /* XXX TODO this will have to be refined to handle array items */
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1517,11 +1517,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */ 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1551,11 +1551,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */ /* XXX TODO this will have to be refined to handle array items */
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1582,11 +1582,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */ 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1605,11 +1605,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */ 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *r_override_changed = created;
@ -1639,11 +1639,11 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) { if (do_create && comp != 0) {
bool created = false; bool created = false;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */ 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); op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) { if (r_override_changed) {
*r_override_changed = created; *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. */ * also assume then that _a data is the one where things are inserted. */
if (is_valid_for_insertion && use_insertion) { if (is_valid_for_insertion && use_insertion) {
bool created; bool created;
IDOverrideLibraryProperty *op = BKE_override_library_property_get( IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get(
override, rna_path, &created); override, rna_path, &created);
if (is_first_insert) { if (is_first_insert) {
@ -1806,14 +1806,14 @@ int rna_property_override_diff_default(Main *bmain,
if (ELEM(opop->operation, if (ELEM(opop->operation,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { 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; opop = opop_next;
} }
is_first_insert = false; is_first_insert = false;
} }
BKE_override_library_property_operation_get(op, BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
NULL, NULL,
prev_propname_a, 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."); "Boolean, whether library override is exposed in UI or not.");
static PyObject *bpy_app_use_override_library_get(PyObject *UNUSED(self), void *UNUSED(closure)) 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), 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; return -1;
} }
BKE_override_library_enable((const bool)param); BKE_lib_override_library_enable((const bool)param);
return 0; 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); BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE);
/* Enforce full override check/generation on file save. */ /* 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 */ /* blend file thumbnail */
/* Save before exit_editmode, otherwise derivedmeshes for shared data corrupt T27765. */ /* 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), const char **UNUSED(argv),
void *UNUSED(data)) void *UNUSED(data))
{ {
BKE_override_library_enable(false); BKE_lib_override_library_enable(false);
return 0; return 0;
} }