From ef26e5d313dceb2d416877233a72c6e48c8a772d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 27 Jul 2023 18:33:42 +0200 Subject: [PATCH] Cleanup: Rename 'override' variables and parameters to 'liboverride'. `override` is a reserved keyword in C++. Pull Request: https://projects.blender.org/blender/blender/pulls/110534 --- source/blender/blenkernel/BKE_lib_override.h | 59 ++--- .../blender/blenkernel/intern/lib_override.cc | 215 +++++++++--------- .../intern/rna_access_compare_override.cc | 28 +-- .../makesrna/intern/rna_internal_types.h | 10 +- source/blender/makesrna/intern/rna_rna.cc | 46 ++-- 5 files changed, 182 insertions(+), 176 deletions(-) diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index e2c93bb6a13..a7625a359c0 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -52,13 +52,13 @@ struct IDOverrideLibrary *BKE_lib_override_library_init(struct ID *local_id, */ void BKE_lib_override_library_copy(struct ID *dst_id, const struct ID *src_id, bool do_full_copy); /** - * Clear any overriding data from given \a override. + * Clear any overriding data from given \a liboverride. */ -void BKE_lib_override_library_clear(struct IDOverrideLibrary *override, bool do_id_user); +void BKE_lib_override_library_clear(struct IDOverrideLibrary *liboverride, bool do_id_user); /** - * Free given \a override. + * Free given \a liboverride. */ -void BKE_lib_override_library_free(struct IDOverrideLibrary **override, bool do_id_user); +void BKE_lib_override_library_free(struct IDOverrideLibrary **liboverride, bool do_id_user); /** * Return the actual #IDOverrideLibrary data 'controlling' the given `id`, and the actual ID owning @@ -89,14 +89,15 @@ bool BKE_lib_override_library_is_system_defined(const struct Main *bmain, const * Check if given Override Property for given ID is animated (through a F-Curve in an Action, or * from a driver). * - * \param override_rna_prop: if not NULL, the RNA property matching the given path in the - * `override_prop`. + * \param liboverride_rna_prop: if not NULL, the RNA property matching the given path in the + * `liboverride_prop`. * \param rnaprop_index: Array in the RNA property, 0 if unknown or irrelevant. */ -bool BKE_lib_override_library_property_is_animated(const ID *id, - const IDOverrideLibraryProperty *override_prop, - const struct PropertyRNA *override_rna_prop, - const int rnaprop_index); +bool BKE_lib_override_library_property_is_animated( + const ID *id, + const IDOverrideLibraryProperty *liboverride_prop, + const struct PropertyRNA *override_rna_prop, + const int rnaprop_index); /** * Check if given ID is a leaf in its liboverride hierarchy (i.e. if it does not use any other @@ -300,16 +301,16 @@ struct IDOverrideLibraryProperty *BKE_lib_override_library_property_find( struct IDOverrideLibraryProperty *BKE_lib_override_library_property_get( struct IDOverrideLibrary *override, const char *rna_path, bool *r_created); /** - * Remove and free given \a override_property from given ID \a override. + * Remove and free given \a liboverride_property from given ID \a liboverride. */ -void BKE_lib_override_library_property_delete(struct IDOverrideLibrary *override, - struct IDOverrideLibraryProperty *override_property); +void BKE_lib_override_library_property_delete( + struct IDOverrideLibrary *liboverride, struct IDOverrideLibraryProperty *liboverride_property); /** - * Delete a property override from the given ID \a override, if it exists. + * Delete a property override from the given ID \a liboverride, if it exists. * * \return True when the property was found (and thus deleted), false if it wasn't found. */ -bool BKE_lib_override_library_property_search_and_delete(struct IDOverrideLibrary *override, +bool BKE_lib_override_library_property_search_and_delete(struct IDOverrideLibrary *liboverride, const char *rna_path); /** @@ -346,7 +347,7 @@ bool BKE_lib_override_rna_property_find(struct PointerRNA *idpoin, * Find override property operation from given sub-item(s), if it exists. */ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_find( - struct IDOverrideLibraryProperty *override_property, + struct IDOverrideLibraryProperty *liboverride_property, const char *subitem_refname, const char *subitem_locname, int subitem_refindex, @@ -357,7 +358,7 @@ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_ope * Find override property operation from given sub-item(s), or create it if it does not exist. */ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_get( - struct IDOverrideLibraryProperty *override_property, + struct IDOverrideLibraryProperty *liboverride_property, short operation, const char *subitem_refname, const char *subitem_locname, @@ -367,17 +368,17 @@ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_ope bool *r_strict, bool *r_created); /** - * Remove and free given \a override_property_operation from given ID \a override_property. + * Remove and free given \a liboverride_property_operation from given ID \a liboverride_property. */ void BKE_lib_override_library_property_operation_delete( - struct IDOverrideLibraryProperty *override_property, - struct IDOverrideLibraryPropertyOperation *override_property_operation); + struct IDOverrideLibraryProperty *liboverride_property, + struct IDOverrideLibraryPropertyOperation *liboverride_property_operation); /** * Validate that required data for a given operation are available. */ bool BKE_lib_override_library_property_operation_operands_validate( - struct IDOverrideLibraryPropertyOperation *override_property_operation, + struct IDOverrideLibraryPropertyOperation *liboverride_property_operation, struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage, @@ -492,13 +493,12 @@ void BKE_lib_override_library_id_hierarchy_reset(struct Main *bmain, /** * Set or clear given tag in all operations in that override property data. */ -void BKE_lib_override_library_operations_tag(struct IDOverrideLibraryProperty *override_property, - short tag, - bool do_set); +void BKE_lib_override_library_operations_tag( + struct IDOverrideLibraryProperty *liboverride_property, short tag, bool do_set); /** * Set or clear given tag in all properties and operations in that override data. */ -void BKE_lib_override_library_properties_tag(struct IDOverrideLibrary *override, +void BKE_lib_override_library_properties_tag(struct IDOverrideLibrary *liboverride, short tag, bool do_set); /** @@ -532,7 +532,7 @@ bool BKE_lib_override_library_id_is_user_deletable(struct Main *bmain, struct ID /** * Debugging helper to show content of given liboverride data. */ -void BKE_lib_override_debug_print(struct IDOverrideLibrary *override, const char *intro_txt); +void BKE_lib_override_debug_print(struct IDOverrideLibrary *liboverride, const char *intro_txt); /* Storage (.blend file writing) part. */ @@ -550,14 +550,15 @@ OverrideLibraryStorage *BKE_lib_override_library_operations_store_init(void); * all extra data are stored in its temp \a storage_id copy. */ struct ID *BKE_lib_override_library_operations_store_start( - struct Main *bmain, OverrideLibraryStorage *override_storage, struct ID *local); + struct Main *bmain, OverrideLibraryStorage *liboverride_storage, struct ID *local); /** * Restore given ID modified by #BKE_lib_override_library_operations_store_start, to its * original state. */ -void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage *override_storage, +void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage *liboverride_storage, struct ID *local); -void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage); +void BKE_lib_override_library_operations_store_finalize( + OverrideLibraryStorage *liboverride_storage); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc index 8a8731f4992..394e4d54b86 100644 --- a/source/blender/blenkernel/intern/lib_override.cc +++ b/source/blender/blenkernel/intern/lib_override.cc @@ -84,12 +84,13 @@ static void lib_override_library_property_clear(IDOverrideLibraryProperty *op); static void lib_override_library_property_operation_clear( IDOverrideLibraryPropertyOperation *opop); -BLI_INLINE IDOverrideLibraryRuntime *override_library_runtime_ensure(IDOverrideLibrary *override) +BLI_INLINE IDOverrideLibraryRuntime *override_library_runtime_ensure( + IDOverrideLibrary *liboverride) { - if (override->runtime == nullptr) { - override->runtime = MEM_cnew(__func__); + if (liboverride->runtime == nullptr) { + liboverride->runtime = MEM_cnew(__func__); } - return override->runtime; + return liboverride->runtime; } /** Helper to preserve Pose mode on override objects. @@ -229,39 +230,40 @@ void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id, const bool do_f dst_id->tag &= ~LIB_TAG_LIBOVERRIDE_REFOK; } -void BKE_lib_override_library_clear(IDOverrideLibrary *override, const bool do_id_user) +void BKE_lib_override_library_clear(IDOverrideLibrary *liboverride, const bool do_id_user) { - BLI_assert(override != nullptr); + BLI_assert(liboverride != nullptr); - if (!ELEM(nullptr, override->runtime, override->runtime->rna_path_to_override_properties)) { - BLI_ghash_clear(override->runtime->rna_path_to_override_properties, nullptr, nullptr); + if (!ELEM(nullptr, liboverride->runtime, liboverride->runtime->rna_path_to_override_properties)) + { + BLI_ghash_clear(liboverride->runtime->rna_path_to_override_properties, nullptr, nullptr); } - LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &liboverride->properties) { lib_override_library_property_clear(op); } - BLI_freelistN(&override->properties); + BLI_freelistN(&liboverride->properties); if (do_id_user) { - id_us_min(override->reference); + id_us_min(liboverride->reference); /* override->storage should never be refcounted... */ } } -void BKE_lib_override_library_free(IDOverrideLibrary **override, const bool do_id_user) +void BKE_lib_override_library_free(IDOverrideLibrary **liboverride, const bool do_id_user) { - BLI_assert(*override != nullptr); + BLI_assert(*liboverride != nullptr); - if ((*override)->runtime != nullptr) { - if ((*override)->runtime->rna_path_to_override_properties != nullptr) { - BLI_ghash_free((*override)->runtime->rna_path_to_override_properties, nullptr, nullptr); + if ((*liboverride)->runtime != nullptr) { + if ((*liboverride)->runtime->rna_path_to_override_properties != nullptr) { + BLI_ghash_free((*liboverride)->runtime->rna_path_to_override_properties, nullptr, nullptr); } - MEM_SAFE_FREE((*override)->runtime); + MEM_SAFE_FREE((*liboverride)->runtime); } - BKE_lib_override_library_clear(*override, do_id_user); - MEM_freeN(*override); - *override = nullptr; + BKE_lib_override_library_clear(*liboverride, do_id_user); + MEM_freeN(*liboverride); + *liboverride = nullptr; } static ID *lib_override_library_create_from(Main *bmain, @@ -359,26 +361,27 @@ bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id) return false; } -bool BKE_lib_override_library_property_is_animated(const ID *id, - const IDOverrideLibraryProperty *override_prop, - const PropertyRNA *override_rna_prop, - const int rnaprop_index) +bool BKE_lib_override_library_property_is_animated( + const ID *id, + const IDOverrideLibraryProperty *liboverride_prop, + const PropertyRNA *override_rna_prop, + const int rnaprop_index) { AnimData *anim_data = BKE_animdata_from_id(id); if (anim_data != nullptr) { FCurve *fcurve; char *index_token_start = const_cast( - RNA_path_array_index_token_find(override_prop->rna_path, override_rna_prop)); + RNA_path_array_index_token_find(liboverride_prop->rna_path, override_rna_prop)); if (index_token_start != nullptr) { const char index_token_start_backup = *index_token_start; *index_token_start = '\0'; fcurve = BKE_animadata_fcurve_find_by_rna_path( - anim_data, override_prop->rna_path, rnaprop_index, nullptr, nullptr); + anim_data, liboverride_prop->rna_path, rnaprop_index, nullptr, nullptr); *index_token_start = index_token_start_backup; } else { fcurve = BKE_animadata_fcurve_find_by_rna_path( - anim_data, override_prop->rna_path, 0, nullptr, nullptr); + anim_data, liboverride_prop->rna_path, 0, nullptr, nullptr); } if (fcurve != nullptr) { return true; @@ -3598,44 +3601,44 @@ void BKE_lib_override_library_make_local(ID *id) } /* We only build override GHash on request. */ -BLI_INLINE GHash *override_library_rna_path_mapping_ensure(IDOverrideLibrary *override) +BLI_INLINE GHash *override_library_rna_path_mapping_ensure(IDOverrideLibrary *liboverride) { - IDOverrideLibraryRuntime *override_runtime = override_library_runtime_ensure(override); - if (override_runtime->rna_path_to_override_properties == nullptr) { - override_runtime->rna_path_to_override_properties = BLI_ghash_new( + IDOverrideLibraryRuntime *liboverride_runtime = override_library_runtime_ensure(liboverride); + if (liboverride_runtime->rna_path_to_override_properties == nullptr) { + liboverride_runtime->rna_path_to_override_properties = BLI_ghash_new( BLI_ghashutil_strhash_p_murmur, BLI_ghashutil_strcmp, __func__); for (IDOverrideLibraryProperty *op = - static_cast(override->properties.first); + static_cast(liboverride->properties.first); op != nullptr; op = op->next) { - BLI_ghash_insert(override_runtime->rna_path_to_override_properties, op->rna_path, op); + BLI_ghash_insert(liboverride_runtime->rna_path_to_override_properties, op->rna_path, op); } } - return override_runtime->rna_path_to_override_properties; + return liboverride_runtime->rna_path_to_override_properties; } -IDOverrideLibraryProperty *BKE_lib_override_library_property_find(IDOverrideLibrary *override, +IDOverrideLibraryProperty *BKE_lib_override_library_property_find(IDOverrideLibrary *liboverride, const char *rna_path) { - GHash *override_runtime = override_library_rna_path_mapping_ensure(override); - return static_cast(BLI_ghash_lookup(override_runtime, rna_path)); + GHash *liboverride_runtime = override_library_rna_path_mapping_ensure(liboverride); + return static_cast(BLI_ghash_lookup(liboverride_runtime, rna_path)); } -IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibrary *override, +IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibrary *liboverride, const char *rna_path, bool *r_created) { - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path); + IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride, rna_path); if (op == nullptr) { op = MEM_cnew(__func__); op->rna_path = BLI_strdup(rna_path); - BLI_addtail(&override->properties, op); + BLI_addtail(&liboverride->properties, op); - GHash *override_runtime = override_library_rna_path_mapping_ensure(override); - BLI_ghash_insert(override_runtime, op->rna_path, op); + GHash *liboverride_runtime = override_library_rna_path_mapping_ensure(liboverride); + BLI_ghash_insert(liboverride_runtime, op->rna_path, op); if (r_created) { *r_created = true; @@ -3687,70 +3690,70 @@ void lib_override_library_property_clear(IDOverrideLibraryProperty *op) BLI_freelistN(&op->operations); } -bool BKE_lib_override_library_property_rna_path_change(IDOverrideLibrary *override, +bool BKE_lib_override_library_property_rna_path_change(IDOverrideLibrary *liboverride, const char *old_rna_path, const char *new_rna_path) { /* Find the override property by its old RNA path. */ - GHash *override_runtime = override_library_rna_path_mapping_ensure(override); - IDOverrideLibraryProperty *override_property = static_cast( - BLI_ghash_popkey(override_runtime, old_rna_path, nullptr)); + GHash *liboverride_runtime = override_library_rna_path_mapping_ensure(liboverride); + IDOverrideLibraryProperty *liboverride_property = static_cast( + BLI_ghash_popkey(liboverride_runtime, old_rna_path, nullptr)); - if (override_property == nullptr) { + if (liboverride_property == nullptr) { return false; } /* Switch over the RNA path. */ - MEM_SAFE_FREE(override_property->rna_path); - override_property->rna_path = BLI_strdup(new_rna_path); + MEM_SAFE_FREE(liboverride_property->rna_path); + liboverride_property->rna_path = BLI_strdup(new_rna_path); /* Put property back into the lookup mapping, using the new RNA path. */ - BLI_ghash_insert(override_runtime, override_property->rna_path, override_property); + BLI_ghash_insert(liboverride_runtime, liboverride_property->rna_path, liboverride_property); return true; } -static void lib_override_library_property_delete(IDOverrideLibrary *override, - IDOverrideLibraryProperty *override_property, +static void lib_override_library_property_delete(IDOverrideLibrary *liboverride, + IDOverrideLibraryProperty *liboverride_property, const bool do_runtime_updates) { if (do_runtime_updates && - !ELEM(nullptr, override->runtime, override->runtime->rna_path_to_override_properties)) + !ELEM(nullptr, liboverride->runtime, liboverride->runtime->rna_path_to_override_properties)) { - BLI_ghash_remove(override->runtime->rna_path_to_override_properties, - override_property->rna_path, + BLI_ghash_remove(liboverride->runtime->rna_path_to_override_properties, + liboverride_property->rna_path, nullptr, nullptr); } - lib_override_library_property_clear(override_property); - BLI_freelinkN(&override->properties, override_property); + lib_override_library_property_clear(liboverride_property); + BLI_freelinkN(&liboverride->properties, liboverride_property); } -bool BKE_lib_override_library_property_search_and_delete(IDOverrideLibrary *override, +bool BKE_lib_override_library_property_search_and_delete(IDOverrideLibrary *liboverride, const char *rna_path) { /* Find the override property by its old RNA path. */ - GHash *override_runtime = override_library_rna_path_mapping_ensure(override); - IDOverrideLibraryProperty *override_property = static_cast( - BLI_ghash_popkey(override_runtime, rna_path, nullptr)); + GHash *liboverride_runtime = override_library_rna_path_mapping_ensure(liboverride); + IDOverrideLibraryProperty *liboverride_property = static_cast( + BLI_ghash_popkey(liboverride_runtime, rna_path, nullptr)); - if (override_property == nullptr) { + if (liboverride_property == nullptr) { return false; } /* The key (rna_path) was already popped out of the runtime mapping above. */ - lib_override_library_property_delete(override, override_property, false); + lib_override_library_property_delete(liboverride, liboverride_property, false); return true; } -void BKE_lib_override_library_property_delete(IDOverrideLibrary *override, - IDOverrideLibraryProperty *override_property) +void BKE_lib_override_library_property_delete(IDOverrideLibrary *liboverride, + IDOverrideLibraryProperty *liboverride_property) { - lib_override_library_property_delete(override, override_property, true); + lib_override_library_property_delete(liboverride, liboverride_property, true); } IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_find( - IDOverrideLibraryProperty *override_property, + IDOverrideLibraryProperty *liboverride_property, const char *subitem_refname, const char *subitem_locname, const int subitem_refindex, @@ -3767,7 +3770,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ if (subitem_locname != nullptr) { opop = static_cast( - BLI_findstring_ptr(&override_property->operations, + BLI_findstring_ptr(&liboverride_property->operations, subitem_locname, offsetof(IDOverrideLibraryPropertyOperation, subitem_local_name))); @@ -3786,7 +3789,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ if (subitem_refname != nullptr) { opop = static_cast( - BLI_findstring_ptr(&override_property->operations, + BLI_findstring_ptr(&liboverride_property->operations, subitem_refname, offsetof(IDOverrideLibraryPropertyOperation, subitem_reference_name))); @@ -3804,7 +3807,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ } if ((opop = static_cast(BLI_listbase_bytes_find( - &override_property->operations, + &liboverride_property->operations, &subitem_locindex, sizeof(subitem_locindex), offsetof(IDOverrideLibraryPropertyOperation, subitem_local_index))))) @@ -3813,7 +3816,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ } if ((opop = static_cast(BLI_listbase_bytes_find( - &override_property->operations, + &liboverride_property->operations, &subitem_refindex, sizeof(subitem_refindex), offsetof(IDOverrideLibraryPropertyOperation, subitem_reference_index))))) @@ -3825,7 +3828,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ */ if (!strict && (subitem_locindex != subitem_defindex) && (opop = static_cast(BLI_listbase_bytes_find( - &override_property->operations, + &liboverride_property->operations, &subitem_defindex, sizeof(subitem_defindex), offsetof(IDOverrideLibraryPropertyOperation, subitem_local_index))))) @@ -3840,7 +3843,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ } IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_get( - IDOverrideLibraryProperty *override_property, + IDOverrideLibraryProperty *liboverride_property, const short operation, const char *subitem_refname, const char *subitem_locname, @@ -3851,7 +3854,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ bool *r_created) { IDOverrideLibraryPropertyOperation *opop = BKE_lib_override_library_property_operation_find( - override_property, + liboverride_property, subitem_refname, subitem_locname, subitem_refindex, @@ -3871,7 +3874,7 @@ IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_ opop->subitem_local_index = subitem_locindex; opop->subitem_reference_index = subitem_refindex; - BLI_addtail(&override_property->operations, opop); + BLI_addtail(&liboverride_property->operations, opop); if (r_created) { *r_created = true; @@ -3906,15 +3909,15 @@ void lib_override_library_property_operation_clear(IDOverrideLibraryPropertyOper } void BKE_lib_override_library_property_operation_delete( - IDOverrideLibraryProperty *override_property, - IDOverrideLibraryPropertyOperation *override_property_operation) + IDOverrideLibraryProperty *liboverride_property, + IDOverrideLibraryPropertyOperation *liboverride_property_operation) { - lib_override_library_property_operation_clear(override_property_operation); - BLI_freelinkN(&override_property->operations, override_property_operation); + lib_override_library_property_operation_clear(liboverride_property_operation); + BLI_freelinkN(&liboverride_property->operations, liboverride_property_operation); } bool BKE_lib_override_library_property_operation_operands_validate( - IDOverrideLibraryPropertyOperation *override_property_operation, + IDOverrideLibraryPropertyOperation *liboverride_property_operation, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, @@ -3922,7 +3925,7 @@ bool BKE_lib_override_library_property_operation_operands_validate( PropertyRNA *prop_src, PropertyRNA *prop_storage) { - switch (override_property_operation->operation) { + switch (liboverride_property_operation->operation) { case LIBOVERRIDE_OP_NOOP: return true; case LIBOVERRIDE_OP_ADD: @@ -4106,7 +4109,7 @@ bool BKE_lib_override_library_status_check_reference(Main *bmain, ID *local) static void lib_override_library_operations_create(Main *bmain, ID *local, - const eRNAOverrideMatch override_match_flags, + const eRNAOverrideMatch liboverride_match_flags, eRNAOverrideMatchResult *r_report_flags) { BLI_assert(!ID_IS_LINKED(local)); @@ -4146,7 +4149,7 @@ static void lib_override_library_operations_create(Main *bmain, nullptr, 0, local->override_library, - override_match_flags, + liboverride_match_flags, &local_report_flags); if (local_report_flags & RNA_OVERRIDE_MATCH_RESULT_RESTORED) { @@ -4413,9 +4416,9 @@ static bool lib_override_library_id_reset_do(Main *bmain, if (was_op_deleted) { DEG_id_tag_update_ex(bmain, id_root, ID_RECALC_COPY_ON_WRITE); - IDOverrideLibraryRuntime *override_runtime = override_library_runtime_ensure( + IDOverrideLibraryRuntime *liboverride_runtime = override_library_runtime_ensure( id_root->override_library); - override_runtime->tag |= LIBOVERRIDE_TAG_NEEDS_RELOAD; + liboverride_runtime->tag |= LIBOVERRIDE_TAG_NEEDS_RELOAD; } return was_op_deleted; @@ -4507,19 +4510,20 @@ void BKE_lib_override_library_id_hierarchy_reset(Main *bmain, FOREACH_MAIN_ID_END; } -void BKE_lib_override_library_operations_tag(IDOverrideLibraryProperty *override_property, +void BKE_lib_override_library_operations_tag(IDOverrideLibraryProperty *liboverride_property, const short tag, const bool do_set) { - if (override_property != nullptr) { + if (liboverride_property != nullptr) { if (do_set) { - override_property->tag |= tag; + liboverride_property->tag |= tag; } else { - override_property->tag &= ~tag; + liboverride_property->tag &= ~tag; } - LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &override_property->operations) { + LISTBASE_FOREACH ( + IDOverrideLibraryPropertyOperation *, opop, &liboverride_property->operations) { if (do_set) { opop->tag |= tag; } @@ -4530,12 +4534,12 @@ void BKE_lib_override_library_operations_tag(IDOverrideLibraryProperty *override } } -void BKE_lib_override_library_properties_tag(IDOverrideLibrary *override, +void BKE_lib_override_library_properties_tag(IDOverrideLibrary *liboverride, const short tag, const bool do_set) { - if (override != nullptr) { - LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { + if (liboverride != nullptr) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &liboverride->properties) { BKE_lib_override_library_operations_tag(op, tag, do_set); } } @@ -4784,7 +4788,7 @@ bool BKE_lib_override_library_id_is_user_deletable(Main *bmain, ID *id) return true; } -void BKE_lib_override_debug_print(IDOverrideLibrary *override, const char *intro_txt) +void BKE_lib_override_debug_print(IDOverrideLibrary *liboverride, const char *intro_txt) { const char *line_prefix = ""; if (intro_txt != nullptr) { @@ -4792,7 +4796,7 @@ void BKE_lib_override_debug_print(IDOverrideLibrary *override, const char *intro line_prefix = "\t"; } - LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &liboverride->properties) { std::cout << line_prefix << op->rna_path << " ["; if (op->tag & LIBOVERRIDE_PROP_OP_TAG_UNUSED) { std::cout << " UNUSED "; @@ -4843,7 +4847,7 @@ OverrideLibraryStorage *BKE_lib_override_library_operations_store_init() } ID *BKE_lib_override_library_operations_store_start(Main *bmain, - OverrideLibraryStorage *override_storage, + OverrideLibraryStorage *liboverride_storage, ID *local) { if (ID_IS_OVERRIDE_LIBRARY_TEMPLATE(local) || ID_IS_OVERRIDE_LIBRARY_VIRTUAL(local)) { @@ -4854,8 +4858,8 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain, } BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(local)); - BLI_assert(override_storage != nullptr); - UNUSED_VARS_NDEBUG(override_storage); + BLI_assert(liboverride_storage != nullptr); + UNUSED_VARS_NDEBUG(liboverride_storage); /* Forcefully ensure we know about all needed override operations. */ BKE_lib_override_library_operations_create(bmain, local, nullptr); @@ -4880,7 +4884,7 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain, * (and possibly all over Blender code). * Not impossible to do, but would rather see first is extra useless usual user handling is * actually a (performances) issue here, before doing it. */ - storage_id = BKE_id_copy(reinterpret_cast
(override_storage), local); + storage_id = BKE_id_copy(reinterpret_cast
(liboverride_storage), local); if (storage_id != nullptr) { PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage; @@ -4907,8 +4911,8 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain, return storage_id; } -void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage * /*override_storage*/, - ID *local) +void BKE_lib_override_library_operations_store_end( + OverrideLibraryStorage * /*liboverride_storage*/, ID *local) { BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(local)); @@ -4917,16 +4921,17 @@ void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage * /*ov local->override_library->storage = nullptr; } -void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage) +void BKE_lib_override_library_operations_store_finalize( + OverrideLibraryStorage *liboverride_storage) { /* We cannot just call BKE_main_free(override_storage), not until we have option to make * 'ghost' copies of IDs without increasing user-count of used data-blocks. */ ID *id; - FOREACH_MAIN_ID_BEGIN (override_storage, id) { - BKE_id_free_ex(override_storage, id, LIB_ID_FREE_NO_UI_USER, true); + FOREACH_MAIN_ID_BEGIN (liboverride_storage, id) { + BKE_id_free_ex(liboverride_storage, id, LIB_ID_FREE_NO_UI_USER, true); } FOREACH_MAIN_ID_END; - BKE_main_free(override_storage); + BKE_main_free(liboverride_storage); } diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index 6e01a11db23..b113928dcd6 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -259,7 +259,7 @@ static int rna_property_override_diff(Main *bmain, const char *rna_path, const size_t rna_path_len, eRNACompareMode mode, - IDOverrideLibrary *override, + IDOverrideLibrary *liboverride, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags); @@ -327,7 +327,7 @@ static int rna_property_override_diff(Main *bmain, const char *rna_path, const size_t rna_path_len, eRNACompareMode mode, - IDOverrideLibrary *override, + IDOverrideLibrary *liboverride, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags) { @@ -426,10 +426,10 @@ static int rna_property_override_diff(Main *bmain, rnadiff_ctx.prop_b = prop_b; rnadiff_ctx.mode = mode; - rnadiff_ctx.override = override; + rnadiff_ctx.liboverride = liboverride; rnadiff_ctx.rna_path = rna_path; rnadiff_ctx.rna_path_len = rna_path_len; - rnadiff_ctx.override_flags = diff_flags; + rnadiff_ctx.liboverride_flags = diff_flags; override_diff(bmain, rnadiff_ctx); if (r_report_flags) { @@ -635,7 +635,7 @@ bool RNA_struct_override_matches(Main *bmain, PointerRNA *ptr_reference, const char *root_path, const size_t root_path_len, - IDOverrideLibrary *override, + IDOverrideLibrary *liboverride, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags) { @@ -784,7 +784,7 @@ bool RNA_struct_override_matches(Main *bmain, CLOG_INFO(&LOG, 5, "Override Checking %s", rna_path); - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path); + IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride, rna_path); if (ignore_overridden && op != nullptr) { BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, false); @@ -807,7 +807,7 @@ bool RNA_struct_override_matches(Main *bmain, rna_path, rna_path_len, RNA_EQ_STRICT, - override, + liboverride, flags, &report_flags); @@ -826,7 +826,7 @@ bool RNA_struct_override_matches(Main *bmain, if (diff != 0) { /* XXX TODO: refine this for per-item overriding of arrays... */ - op = BKE_lib_override_library_property_find(override, rna_path); + op = BKE_lib_override_library_property_find(liboverride, rna_path); IDOverrideLibraryPropertyOperation *opop = static_cast( op ? op->operations.first : nullptr); @@ -874,7 +874,7 @@ bool RNA_struct_override_matches(Main *bmain, else { if (op == nullptr) { /* An override property is needed, create a temp one if necessary. */ - op = BKE_lib_override_library_property_get(override, rna_path, nullptr); + op = BKE_lib_override_library_property_get(liboverride, rna_path, nullptr); BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, true); } IDOverrideLibraryPropertyOperation *opop_restore = @@ -892,7 +892,7 @@ bool RNA_struct_override_matches(Main *bmain, * a NOOP operation to enforce no change on that property, etc.). */ op->tag |= LIBOVERRIDE_PROP_TAG_NEEDS_RETORE; opop_restore->tag |= LIBOVERRIDE_PROP_TAG_NEEDS_RETORE; - override->runtime->tag |= LIBOVERRIDE_TAG_NEEDS_RESTORE; + liboverride->runtime->tag |= LIBOVERRIDE_TAG_NEEDS_RESTORE; if (r_report_flags) { *r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED; @@ -964,14 +964,14 @@ bool RNA_struct_override_store(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, - IDOverrideLibrary *override) + IDOverrideLibrary *liboverride) { bool changed = false; #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_store); #endif - LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &liboverride->properties) { /* Simplified for now! */ PointerRNA data_reference, data_local; PropertyRNA *prop_reference, *prop_local; @@ -1434,7 +1434,7 @@ void RNA_struct_override_apply(Main *bmain, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, - IDOverrideLibrary *override, + IDOverrideLibrary *liboverride, const eRNAOverrideApplyFlag flag) { #ifdef DEBUG_OVERRIDE_TIMEIT @@ -1447,7 +1447,7 @@ void RNA_struct_override_apply(Main *bmain, */ bool do_insert = false; for (int i = 0; i < (do_restore_only ? 1 : 2); i++, do_insert = true) { - LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &liboverride->properties) { if (do_restore_only && (op->tag % LIBOVERRIDE_PROP_TAG_NEEDS_RETORE) == 0) { continue; } diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index f0f83ab60dd..1d0cd59a821 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -196,13 +196,13 @@ typedef struct PropertyRNAOrID { } PropertyRNAOrID; /** - * If \a override is NULL, merely do comparison between prop_a and prop_b, + * If \a liboverride is NULL, merely do comparison between prop_a and prop_b, * following comparison mode given. - * If \a override and \a rna_path are not NULL, it will add a new override operation for + * If \a liboverride and \a rna_path are not NULL, it will add a new override operation for * overridable properties that differ and have not yet been overridden * (and set accordingly \a r_override_changed if given). * - * \note \a override and \a rna_path may be NULL pointers. + * \note \a liboverride and \a rna_path may be NULL pointers. */ struct RNAPropertyOverrideDiffContext { /** General diffing parameters. */ @@ -219,10 +219,10 @@ struct RNAPropertyOverrideDiffContext { eRNACompareMode mode = RNA_EQ_COMPARE; /** LibOverride specific parameters. */ - struct IDOverrideLibrary *override = nullptr; + struct IDOverrideLibrary *liboverride = nullptr; const char *rna_path = nullptr; size_t rna_path_len = 0; - eRNAOverrideMatch override_flags = eRNAOverrideMatch(0); + eRNAOverrideMatch liboverride_flags = eRNAOverrideMatch(0); /** Results. */ diff --git a/source/blender/makesrna/intern/rna_rna.cc b/source/blender/makesrna/intern/rna_rna.cc index 89108900f2c..4fe7d544eda 100644 --- a/source/blender/makesrna/intern/rna_rna.cc +++ b/source/blender/makesrna/intern/rna_rna.cc @@ -1389,8 +1389,8 @@ static void rna_property_override_diff_propptr(Main *bmain, eRNACompareMode mode = ptrdiff_ctx.rnadiff_ctx.mode; const bool no_ownership = ptrdiff_ctx.no_ownership; - IDOverrideLibrary *override = ptrdiff_ctx.rnadiff_ctx.override; - const eRNAOverrideMatch override_flags = ptrdiff_ctx.rnadiff_ctx.override_flags; + IDOverrideLibrary *liboverride = ptrdiff_ctx.rnadiff_ctx.liboverride; + const eRNAOverrideMatch liboverride_flags = ptrdiff_ctx.rnadiff_ctx.liboverride_flags; const char *rna_path = ptrdiff_ctx.rnadiff_ctx.rna_path; size_t rna_path_len = ptrdiff_ctx.rnadiff_ctx.rna_path_len; const PropertyType property_type = ptrdiff_ctx.property_type; @@ -1402,8 +1402,8 @@ static void rna_property_override_diff_propptr(Main *bmain, BLI_assert(ELEM(property_type, PROP_POINTER, PROP_COLLECTION)); - const bool do_create = override != nullptr && - (override_flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && + const bool do_create = liboverride != nullptr && + (liboverride_flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != nullptr; rna_property_override_diff_propptr_validate_diffing(ptrdiff_ctx); @@ -1430,7 +1430,7 @@ static void rna_property_override_diff_propptr(Main *bmain, UNUSED_VARS_NDEBUG(id); } - if (override) { + if (liboverride) { if (no_ownership || is_null || is_type_diff || !is_valid_for_diffing) { /* In case this pointer prop does not own its data (or one is nullptr), do not compare * structs! This is a quite safe path to infinite loop, among other nasty issues. Instead, @@ -1440,7 +1440,7 @@ static void rna_property_override_diff_propptr(Main *bmain, if (do_create && ptrdiff_ctx.rnadiff_ctx.comparison != 0) { bool created = false; IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + liboverride, rna_path, &created); /* If not yet overridden, or if we are handling sub-items (inside a collection)... */ if (op != nullptr) { @@ -1500,7 +1500,7 @@ static void rna_property_override_diff_propptr(Main *bmain, ID *id_b = static_cast(propptr_b->data); if (ELEM(nullptr, id_a, id_b)) { /* In case one of the pointer is nullptr and not the other, we consider that the - * override is not matching its reference anymore. */ + * liboverride is not matching its reference anymore. */ opop->flag &= ~LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE; } else if ((owner_id_a->tag & LIB_TAG_LIBOVERRIDE_NEED_RESYNC) != 0 || @@ -1612,8 +1612,8 @@ static void rna_property_override_diff_propptr(Main *bmain, propptr_b, extended_rna_path, extended_rna_path_len, - override, - override_flags, + liboverride, + liboverride_flags, &ptrdiff_ctx.rnadiff_ctx.report_flag); ptrdiff_ctx.rnadiff_ctx.comparison = !match; @@ -1654,17 +1654,17 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont const uint len_a = prop_a->array_len; const uint len_b = prop_b->array_len; - IDOverrideLibrary *override = rnadiff_ctx.override; + IDOverrideLibrary *liboverride = rnadiff_ctx.liboverride; const char *rna_path = rnadiff_ctx.rna_path; - const int override_flags = rnadiff_ctx.override_flags; + const int liboverride_flags = rnadiff_ctx.liboverride_flags; BLI_assert(len_a == len_b); /* NOTE: at this point, we are sure that when len_a is zero, * we are not handling an (empty) array. */ - const bool do_create = override != nullptr && - (override_flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && + const bool do_create = liboverride != nullptr && + (liboverride_flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != nullptr; const bool no_ownership = (prop_a->rnaprop->flag & PROP_PTR_NO_OWNERSHIP) != 0; @@ -1699,7 +1699,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont if (do_create && rnadiff_ctx.comparison != 0) { /* XXX TODO: this will have to be refined to handle array items. */ - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { BKE_lib_override_library_property_operation_get( @@ -1724,7 +1724,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont rnadiff_ctx.comparison = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && rnadiff_ctx.comparison != 0) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1755,7 +1755,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont if (do_create && rnadiff_ctx.comparison != 0) { /* XXX TODO: this will have to be refined to handle array items. */ - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { BKE_lib_override_library_property_operation_get( @@ -1782,7 +1782,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont rnadiff_ctx.comparison = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && rnadiff_ctx.comparison != 0) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1813,7 +1813,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont if (do_create && rnadiff_ctx.comparison != 0) { /* XXX TODO: this will have to be refined to handle array items. */ - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { BKE_lib_override_library_property_operation_get( @@ -1838,7 +1838,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont rnadiff_ctx.comparison = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && rnadiff_ctx.comparison != 0) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1856,7 +1856,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont rnadiff_ctx.comparison = value_a != value_b; if (do_create && rnadiff_ctx.comparison != 0) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1885,7 +1885,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont rnadiff_ctx.comparison = strcmp(value_a, value_b); if (do_create && rnadiff_ctx.comparison != 0) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); if (op != nullptr && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1942,7 +1942,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont if (use_collection_insertion) { /* We need to clean up all possible existing insertion operations, and then re-generate * them, otherwise we'd end up with a mess of opop's every time something changes. */ - op = BKE_lib_override_library_property_find(override, rna_path); + op = BKE_lib_override_library_property_find(liboverride, rna_path); if (op != nullptr) { LISTBASE_FOREACH_MUTABLE (IDOverrideLibraryPropertyOperation *, opop, &op->operations) { if (ELEM(opop->operation, LIBOVERRIDE_OP_INSERT_AFTER, LIBOVERRIDE_OP_INSERT_BEFORE)) { @@ -2019,7 +2019,7 @@ void rna_property_override_diff_default(Main *bmain, RNAPropertyOverrideDiffCont * an item in the linked reference data, but it can also be another local-only item added * by a previous INSERT operation. */ if (is_valid_for_insertion && use_collection_insertion) { - op = BKE_lib_override_library_property_get(override, rna_path, &created); + op = BKE_lib_override_library_property_get(liboverride, rna_path, &created); BKE_lib_override_library_property_operation_get( op,