diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_access_compare_override.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access_compare_override.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index 22d018c6025..fbd86d78472 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -24,6 +24,7 @@ #include "DNA_constraint_types.h" #include "DNA_modifier_types.h" +#include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -437,7 +438,7 @@ static bool rna_property_override_operation_store(Main *bmain, return changed; } - for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) { /* Only needed for diff operations. */ if (!ELEM(opop->operation, IDOVERRIDE_LIBRARY_OP_ADD, @@ -480,28 +481,13 @@ static bool rna_property_override_operation_apply(Main *bmain, const short override_op = opop->operation; - if (override_op == IDOVERRIDE_LIBRARY_OP_NOOP) { - return true; - } - - if (ELEM(override_op, - IDOVERRIDE_LIBRARY_OP_ADD, - IDOVERRIDE_LIBRARY_OP_SUBTRACT, - IDOVERRIDE_LIBRARY_OP_MULTIPLY) && - !ptr_storage) { - /* We cannot apply 'diff' override operations without some reference storage. - * This should typically only happen at read time of .blend file... */ + if (!BKE_lib_override_library_property_operation_operands_validate( + opop, ptr_dst, ptr_src, ptr_storage, prop_dst, prop_src, prop_storage)) { return false; } - if (ELEM(override_op, - IDOVERRIDE_LIBRARY_OP_ADD, - IDOVERRIDE_LIBRARY_OP_SUBTRACT, - IDOVERRIDE_LIBRARY_OP_MULTIPLY) && - !prop_storage) { - /* We cannot apply 'diff' override operations without some reference storage. - * This should typically only happen at read time of .blend file... */ - return false; + if (override_op == IDOVERRIDE_LIBRARY_OP_NOOP) { + return true; } RNAPropOverrideApply override_apply = NULL; @@ -691,7 +677,9 @@ bool RNA_struct_override_matches(Main *bmain, // printf("Override Checking %s\n", rna_path); - if (ignore_overridden && BKE_lib_override_library_property_find(override, rna_path) != NULL) { + IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path); + if (ignore_overridden && op != NULL) { + BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false); RNA_PATH_FREE; continue; } @@ -730,9 +718,13 @@ bool RNA_struct_override_matches(Main *bmain, if (diff != 0) { /* XXX TODO: refine this for per-item overriding of arrays... */ - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(override, rna_path); + op = BKE_lib_override_library_property_find(override, rna_path); IDOverrideLibraryPropertyOperation *opop = op ? op->operations.first : NULL; + if (op != NULL) { + BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false); + } + if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) { /* We are allowed to restore to reference's values. */ if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDE_LIBRARY_OP_NOOP) { @@ -831,7 +823,7 @@ bool RNA_struct_override_store(Main *bmain, #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_store); #endif - for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { /* Simplified for now! */ PointerRNA data_reference, data_local; PropertyRNA *prop_reference, *prop_local; @@ -879,7 +871,7 @@ static void rna_property_override_apply_ex(Main *bmain, IDOverrideLibraryProperty *op, const bool do_insert) { - for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) { if (!do_insert != !ELEM(opop->operation, IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { @@ -998,7 +990,7 @@ void RNA_struct_override_apply(Main *bmain, */ bool do_insert = false; for (int i = 0; i < 2; i++, do_insert = true) { - for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { /* Simplified for now! */ PointerRNA data_src, data_dst; PointerRNA data_item_src, data_item_dst; |