Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-12-18 12:13:43 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-12-18 12:13:43 +0300
commit7ab8c906865dddf2ef6164b6271e4469a3a95319 (patch)
tree7604626d0d6c56f6fcf5ca3233ec29bec4c623be /source/blender/blenkernel/intern/library_override.c
parent994648a6741087ae40227037ee87395aa18f5b18 (diff)
Serious cleanup/refactor/fixing of new RNA comparison code.
Code also handling auto-generation of static overrides. Aside from some naming consistency cleanup, this commit: * Is the first step addressing the 'operator' issue with static overrides, by implementing a first version of the 'restore from reference' behavior. * Fixes several issues that were discovered on the way in enhanced RNA comparision code, like the 'zero-length dynamic array' case, or some infinite looping caused by some non-ID pointers (that for some mysterious reasons did not show up previously...). * Factorizes a bit said RNA comparison code (auto-static override generation and comparison/check were essentially doing the same thing).
Diffstat (limited to 'source/blender/blenkernel/intern/library_override.c')
-rw-r--r--source/blender/blenkernel/intern/library_override.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 26aeca0564d..a65aea4c292 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -394,7 +394,10 @@ bool BKE_override_static_status_check_local(ID *local)
RNA_id_pointer_create(local, &rnaptr_local);
RNA_id_pointer_create(reference, &rnaptr_reference);
- if (!RNA_struct_override_matches(&rnaptr_local, &rnaptr_reference, local->override_static, true, true)) {
+ if (!RNA_struct_override_matches(
+ &rnaptr_local, &rnaptr_reference, NULL, local->override_static,
+ RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE | RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
+ {
local->tag &= ~LIB_TAG_OVERRIDESTATIC_OK;
return false;
}
@@ -438,7 +441,10 @@ bool BKE_override_static_status_check_reference(ID *local)
RNA_id_pointer_create(local, &rnaptr_local);
RNA_id_pointer_create(reference, &rnaptr_reference);
- if (!RNA_struct_override_matches(&rnaptr_local, &rnaptr_reference, local->override_static, false, true)) {
+ if (!RNA_struct_override_matches(
+ &rnaptr_local, &rnaptr_reference, NULL, local->override_static,
+ RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
+ {
local->tag &= ~LIB_TAG_OVERRIDESTATIC_OK;
return false;
}
@@ -469,8 +475,17 @@ bool BKE_override_static_operations_create(ID *local)
RNA_id_pointer_create(local, &rnaptr_local);
RNA_id_pointer_create(local->override_static->reference, &rnaptr_reference);
- ret = RNA_struct_auto_override(&rnaptr_local, &rnaptr_reference, local->override_static, NULL);
+ eRNAOverrideMatchResult report_flags = 0;
+ RNA_struct_override_matches(
+ &rnaptr_local, &rnaptr_reference, NULL, local->override_static,
+ RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE, &report_flags);
+ if (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) {
+ ret = true;
+ }
#ifndef NDEBUG
+ if (report_flags & RNA_OVERRIDE_MATCH_RESULT_RESTORED) {
+ printf("We did restore some properties of %s from its reference.\n", local->name);
+ }
if (ret) {
printf("We did generate static override rules for %s\n", local->name);
}