Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_access_compare_override.c
| Show All 18 Lines | |||||
| */ | */ | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "BLI_blenlib.h" | |||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| // #define DEBUG_OVERRIDE_TIMEIT | // #define DEBUG_OVERRIDE_TIMEIT | ||||
| #ifdef DEBUG_OVERRIDE_TIMEIT | #ifdef DEBUG_OVERRIDE_TIMEIT | ||||
| # include "PIL_time_utildefines.h" | # include "PIL_time_utildefines.h" | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | printf("'%s' gives unmatching or NULL RNA store callbacks, should not happen (%d vs. %d).\n", | ||||
| op->rna_path, | op->rna_path, | ||||
| prop_local->magic == RNA_MAGIC, | prop_local->magic == RNA_MAGIC, | ||||
| prop_reference->magic == RNA_MAGIC); | prop_reference->magic == RNA_MAGIC); | ||||
| #endif | #endif | ||||
| BLI_assert(0); | BLI_assert(0); | ||||
| return changed; | return changed; | ||||
| } | } | ||||
| for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { | LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) { | ||||
| /* Only needed for diff operations. */ | /* Only needed for diff operations. */ | ||||
| if (!ELEM(opop->operation, | if (!ELEM(opop->operation, | ||||
| IDOVERRIDE_LIBRARY_OP_ADD, | IDOVERRIDE_LIBRARY_OP_ADD, | ||||
| IDOVERRIDE_LIBRARY_OP_SUBTRACT, | IDOVERRIDE_LIBRARY_OP_SUBTRACT, | ||||
| IDOVERRIDE_LIBRARY_OP_MULTIPLY)) { | IDOVERRIDE_LIBRARY_OP_MULTIPLY)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | bool RNA_struct_override_store(Main *bmain, | ||||
| PointerRNA *ptr_storage, | PointerRNA *ptr_storage, | ||||
| IDOverrideLibrary *override) | IDOverrideLibrary *override) | ||||
| { | { | ||||
| bool changed = false; | bool changed = false; | ||||
| #ifdef DEBUG_OVERRIDE_TIMEIT | #ifdef DEBUG_OVERRIDE_TIMEIT | ||||
| TIMEIT_START_AVERAGED(RNA_struct_override_store); | TIMEIT_START_AVERAGED(RNA_struct_override_store); | ||||
| #endif | #endif | ||||
| for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { | LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { | ||||
| /* Simplified for now! */ | /* Simplified for now! */ | ||||
| PointerRNA data_reference, data_local; | PointerRNA data_reference, data_local; | ||||
| PropertyRNA *prop_reference, *prop_local; | PropertyRNA *prop_reference, *prop_local; | ||||
| if (RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local) && | if (RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local) && | ||||
| RNA_path_resolve_property(ptr_reference, op->rna_path, &data_reference, &prop_reference)) { | RNA_path_resolve_property(ptr_reference, op->rna_path, &data_reference, &prop_reference)) { | ||||
| PointerRNA data_storage; | PointerRNA data_storage; | ||||
| PropertyRNA *prop_storage = NULL; | PropertyRNA *prop_storage = NULL; | ||||
| Show All 31 Lines | static void rna_property_override_apply_ex(Main *bmain, | ||||
| PropertyRNA *prop_src, | PropertyRNA *prop_src, | ||||
| PropertyRNA *prop_storage, | PropertyRNA *prop_storage, | ||||
| PointerRNA *ptr_item_dst, | PointerRNA *ptr_item_dst, | ||||
| PointerRNA *ptr_item_src, | PointerRNA *ptr_item_src, | ||||
| PointerRNA *ptr_item_storage, | PointerRNA *ptr_item_storage, | ||||
| IDOverrideLibraryProperty *op, | IDOverrideLibraryProperty *op, | ||||
| const bool do_insert) | 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, | if (!do_insert != !ELEM(opop->operation, | ||||
| IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, | IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, | ||||
| IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { | IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { | ||||
| if (!do_insert) { | if (!do_insert) { | ||||
| printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path); | printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path); | ||||
| } | } | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | #ifdef DEBUG_OVERRIDE_TIMEIT | ||||
| TIMEIT_START_AVERAGED(RNA_struct_override_apply); | TIMEIT_START_AVERAGED(RNA_struct_override_apply); | ||||
| #endif | #endif | ||||
| /* Note: Applying insert operations in a separate pass is mandatory. | /* Note: Applying insert operations in a separate pass is mandatory. | ||||
| * We could optimize this later, but for now, as inefficient as it is, | * We could optimize this later, but for now, as inefficient as it is, | ||||
| * don't think this is a critical point. | * don't think this is a critical point. | ||||
| */ | */ | ||||
| bool do_insert = false; | bool do_insert = false; | ||||
| for (int i = 0; i < 2; i++, do_insert = true) { | 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! */ | /* Simplified for now! */ | ||||
| PointerRNA data_src, data_dst; | PointerRNA data_src, data_dst; | ||||
| PointerRNA data_item_src, data_item_dst; | PointerRNA data_item_src, data_item_dst; | ||||
| PropertyRNA *prop_src, *prop_dst; | PropertyRNA *prop_src, *prop_dst; | ||||
| if (RNA_path_resolve_property_and_item_pointer( | if (RNA_path_resolve_property_and_item_pointer( | ||||
| ptr_dst, op->rna_path, &data_dst, &prop_dst, &data_item_dst) && | ptr_dst, op->rna_path, &data_dst, &prop_dst, &data_item_dst) && | ||||
| RNA_path_resolve_property_and_item_pointer( | RNA_path_resolve_property_and_item_pointer( | ||||
| ▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines | |||||