diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-28 15:25:18 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-28 15:28:31 +0300 |
commit | 3c37354c97872c1d29af9dab14afe81a54060ca7 (patch) | |
tree | ea90775646df77641b8376cd10c5e9600201d0f0 /source/blender/makesrna | |
parent | e35d95686056c60fd3c5f121c178a334bafcd904 (diff) |
Static Override: fix diffing logic for ietms ID pointers case.
I.e. we can now use REPLACE operation directly on items of an RNA
collection, when those items are ID pointers.
Again, mandatory to support new Collection's objects/children override.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 7bb024c349a..2777f87d0d2 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1617,14 +1617,15 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b, #if 0 if (rna_path) { - printf("Checking %s, %s [%d] vs %s [%d]; diffing: %d; insert: %d (could be used: %d, do_create: %d)\n", + printf("Checking %s, %s [%d] vs %s [%d]; is_id: %d, diffing: %d; " + "insert: %d (could be used: %d, do_create: %d)\n", rna_path, propname_a ? propname_a : "", idx_a, propname_b ? propname_b : "", idx_b, - is_valid_for_diffing, is_valid_for_insertion, + is_id, is_valid_for_diffing, is_valid_for_insertion, (RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) != 0, do_create); } #endif - if (!(is_valid_for_diffing || is_valid_for_insertion)) { + if (!(is_id || is_valid_for_diffing || is_valid_for_insertion)) { /* Differences we cannot handle, we can break here * (we do not support replacing ID pointers in collections e.g.). */ equals = false; @@ -1635,7 +1636,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b, /* There may be a propname defined in some cases, while no actual name set * (e.g. happens with point cache), in that case too we want to fall back to index. * Note that we do not need the RNA path for insertion operations. */ - if (is_valid_for_diffing) { + if (is_id || is_valid_for_diffing) { if ((propname_a != NULL && propname_a[0] != '\0') && (propname_b != NULL && propname_b[0] != '\0')) { @@ -1686,7 +1687,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b, NULL, prev_propname_a, -1, idx_a - 1, true, NULL, NULL); // printf("%s: Adding insertion op override after '%s'/%d\n", rna_path, prev_propname_a, idx_a - 1); } - else if (is_valid_for_diffing) { + else if (is_id || is_valid_for_diffing) { if (equals || do_create) { const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0; const int eq = rna_property_override_diff_propptr( @@ -1723,7 +1724,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b, break; } - if (!(use_insertion && !is_valid_for_diffing)) { + if (!(use_insertion && !(is_id || is_valid_for_diffing))) { break; } |