diff options
author | Bastien Montagne <bastien@blender.org> | 2022-06-10 15:44:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-06-10 16:56:55 +0300 |
commit | 07341d7b3215d1ad4029fffbb1550479da89ada1 (patch) | |
tree | 21a09d0e7574b3c5d0fd3c16edda25e1ec513a54 /source/blender | |
parent | 9cad614ad59e0d2ea890e4399b2ca3266f23c4d5 (diff) |
Liboverride: Add rna array index return value to `BKE_lib_override_rna_property_find`.
Very useful e.g. for dealing with FCurves search.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_override.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.cc | 8 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/tree/tree_element_overrides.cc | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index 86630a6ab44..533bfa6b0bc 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -281,11 +281,14 @@ void BKE_lib_override_library_property_delete(struct IDOverrideLibrary *override * * \param idpoin: Pointer to the override ID. * \param library_prop: The library override property to find the matching RNA property for. + * \param r_index: The RNA array flat index (i.e. flatened index in case of multi-dimensional array + * properties). See #RNA_path_resolve_full familly of functions for details. */ bool BKE_lib_override_rna_property_find(struct PointerRNA *idpoin, const struct IDOverrideLibraryProperty *library_prop, struct PointerRNA *r_override_poin, - struct PropertyRNA **r_override_prop); + struct PropertyRNA **r_override_prop, + int *r_index); /** * Find override property operation from given sub-item(s), if it exists. diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc index aa43ca94c99..56d0308a033 100644 --- a/source/blender/blenkernel/intern/lib_override.cc +++ b/source/blender/blenkernel/intern/lib_override.cc @@ -312,7 +312,6 @@ bool BKE_lib_override_library_is_user_edited(const ID *id) bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id) { - if (ID_IS_OVERRIDE_LIBRARY(id)) { const ID *override_owner_id; lib_override_get(bmain, id, &override_owner_id); @@ -2677,11 +2676,12 @@ IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibra bool BKE_lib_override_rna_property_find(PointerRNA *idpoin, const IDOverrideLibraryProperty *library_prop, PointerRNA *r_override_poin, - PropertyRNA **r_override_prop) + PropertyRNA **r_override_prop, + int *r_index) { BLI_assert(RNA_struct_is_ID(idpoin->type) && ID_IS_OVERRIDE_LIBRARY(idpoin->data)); - return RNA_path_resolve_property( - idpoin, library_prop->rna_path, r_override_poin, r_override_prop); + return RNA_path_resolve_property_full( + idpoin, library_prop->rna_path, r_override_poin, r_override_prop, r_index); } void lib_override_library_property_copy(IDOverrideLibraryProperty *op_dst, diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc index 53e7b88c923..51ca2eff9ee 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc @@ -67,8 +67,10 @@ void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const for (auto *override_prop : ListBaseWrapper<IDOverrideLibraryProperty>(id.override_library->properties)) { + int rnaprop_index = 0; const bool is_rna_path_valid = BKE_lib_override_rna_property_find( - &idpoin, override_prop, &override_rna_ptr, &override_rna_prop); + &idpoin, override_prop, &override_rna_ptr, &override_rna_prop, &rnaprop_index); + if (is_rna_path_valid && !show_system_overrides && ELEM(override_prop->rna_prop_type, PROP_POINTER, PROP_COLLECTION) && RNA_struct_is_ID(RNA_property_pointer_type(&override_rna_ptr, override_rna_prop))) { |