diff options
author | Bastien Montagne <bastien@blender.org> | 2021-11-19 11:33:52 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-11-19 17:41:53 +0300 |
commit | 33c5e7bcd5e5b790ee95caaa0c4d917996341266 (patch) | |
tree | 9bce351ce98200b7313bb136fac443eb9d98c9a7 /source/blender/makesrna/intern/rna_rna.c | |
parent | d6ea881a741a254b6f4e931ea25047d3f51686d0 (diff) |
LibOverrides: Refactor how diffing of RNA collections is handled.
Original implementation was a quick prototype which should have never
landed as-is in master. It had very limiting constraints and did not
allow for any real further development.
This commit fixes the internal implementation to make more sensible,
maintainable and evolutive.
NOTE: This commit introduces another forward-incompatibility in the
Blender file format: Files saved after this commit won't open properly
in older versions of blender regarding local inserted constraints or
modifiers into overrides of linked data.
NOTE: Technical details: The 'anchor' item name/index is now stored in
`subitem_reference_` members, and the actual 'source' item name/index is
stored in `subitem_local_` members of the override property operation
data.
Previously, only the `subitem_local_` members were used, storing the
anchor item name/index, and assuming the 'source' item was always the
next in the list.
Milestone I of T82160.
Maniphest Tasks: T82160
Differential Revision: https://developer.blender.org/D13282
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 12fb7a40d13..e5009305fe5 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1916,16 +1916,21 @@ int rna_property_override_diff_default(Main *bmain, /* Collections do not support replacement of their data (except for collections of ID * pointers), since they do not support removing, only in *some* cases, insertion. We - * 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. + * + * NOTE: In insertion case, both 'local' and 'reference' (aka anchor) sub-item + * identifiers refer to collection items in the local override. The 'reference' may match + * 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); BKE_lib_override_library_property_operation_get(op, IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, - NULL, no_prop_name ? NULL : prev_propname_a, - -1, + no_prop_name ? NULL : propname_a, idx_a - 1, + idx_a, true, NULL, NULL); |