Commit: a634ee733fa441fc9084cc19d93f857b427123f9
Author: Bastien Montagne
Date:   Mon Jan 2 14:45:17 2017 +0100
Branches: id_override_static
https://developer.blender.org/rBa634ee733fa441fc9084cc19d93f857b427123f9

ID override static: Various minor fixes and tweaks.

===================================================================

M       source/blender/blenkernel/BKE_library_override.h
M       source/blender/blenkernel/intern/library_override.c
M       source/blender/makesrna/intern/rna_access.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_library_override.h 
b/source/blender/blenkernel/BKE_library_override.h
index 03b8d55..ae68a9e 100644
--- a/source/blender/blenkernel/BKE_library_override.h
+++ b/source/blender/blenkernel/BKE_library_override.h
@@ -41,6 +41,8 @@ struct IDOverride *BKE_override_init(struct ID *local_id, 
struct ID *reference_i
 void BKE_override_clear(struct IDOverride *override);
 void BKE_override_free(struct IDOverride **override);
 
+struct IDOverrideProperty *BKE_override_property_find(struct IDOverride 
*override, const char *rna_path);
+
 bool BKE_override_status_check_local(struct ID *local);
 bool BKE_override_status_check_reference(struct ID *local);
 
diff --git a/source/blender/blenkernel/intern/library_override.c 
b/source/blender/blenkernel/intern/library_override.c
index ee2a122..fed8b3f 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -91,6 +91,14 @@ void BKE_override_free(struct IDOverride **override)
        *override = NULL;
 }
 
+/**
+ * Find override property from given RNA path, if it exists.
+ */
+IDOverrideProperty *BKE_override_property_find(IDOverride *override, const 
char *rna_path)
+{
+       /* XXX TODO we'll most likely want a runtime ghash to store taht 
mapping at some point. */
+       return BLI_findstring_ptr(&override->properties, rna_path, 
offsetof(IDOverrideProperty, rna_path));
+}
 
 /**
  * Check that status of local data-block is still valid against current 
reference one.
@@ -218,7 +226,7 @@ void BKE_override_update(ID *local)
        /* Again, horribly innefficient in our case, we need something off-Main 
(aka moar generic nolib copy/free stuff)! */
        BKE_libblock_free_ex(G.main, tmp_id, true, false);
 
-       local->flag |= LIB_TAG_OVERRIDE_OK;
+       local->tag |= LIB_TAG_OVERRIDE_OK;
 }
 
 /** Update all overrides from given \a bmain. */
diff --git a/source/blender/makesrna/intern/rna_access.c 
b/source/blender/makesrna/intern/rna_access.c
index cde407d..5c6882c 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -50,6 +50,7 @@
 #include "BKE_idcode.h"
 #include "BKE_idprop.h"
 #include "BKE_fcurve.h"
+#include "BKE_library_override.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
 
@@ -7110,7 +7111,7 @@ bool RNA_struct_override_matches(
                if (ignore_overridden) {
                        /* XXX TODO this will have to be refined to handle 
collections insertions, and array items */
                        char *rna_path = RNA_path_from_ID_to_property(local, 
prop);
-                       if (BLI_findstring_ptr(&override->properties, rna_path, 
offsetof(IDOverrideProperty, rna_path)) != NULL) {
+                       if (BKE_override_property_find(override, rna_path) != 
NULL) {
                                MEM_SAFE_FREE(rna_path);
                                continue;
                        }
@@ -7131,9 +7132,13 @@ bool RNA_struct_override_matches(
 void RNA_property_override_apply(PointerRNA *dst, PointerRNA *src, PropertyRNA 
*prop, IDOverrideProperty *op)
 {
        for (IDOverridePropertyOperation *opop = op->operations.first; opop; 
opop = opop->next) {
+               const int sub_index = opop->subitem_local_index;
                switch (opop->operation) {
+                       case IDOVERRIDE_NOOP:
+                               /* Dummy place-holder, nothing to do. */
+                               break;
                        case IDOVERRIDE_REPLACE:
-                               RNA_property_copy(dst, src, prop, -1);
+                               RNA_property_copy(dst, src, prop, sub_index);
                                break;
                        /* TODO other cases! */
                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to