[Bf-blender-cvs] [72346e61141] id_override_static: Rename destination and source parameters in override_apply.

Bastien Montagne noreply at git.blender.org
Thu Nov 16 10:26:19 CET 2017


Commit: 72346e611417cc59f402740659ed0be7f3529e8f
Author: Bastien Montagne
Date:   Thu Nov 16 10:24:03 2017 +0100
Branches: id_override_static
https://developer.blender.org/rB72346e611417cc59f402740659ed0be7f3529e8f

Rename destination and source parameters in override_apply.

local and reference are awfully confusing names here, since destination
is a copy of reference that will become local override once applied, and
source is .blend-file-written version of local override...

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

M	source/blender/makesrna/intern/rna_animation.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_internal_types.h
M	source/blender/makesrna/intern/rna_rna.c

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

diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 06527817ffe..182253efdeb 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -586,26 +586,26 @@ static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *d
 }
 
 bool rna_AnimaData_override_apply(
-        PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
-        PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *UNUSED(prop_storage),
-        const int len_local, const int len_reference, const int len_storage,
+        PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
+        PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *UNUSED(prop_storage),
+        const int len_dst, const int len_src, const int len_storage,
         IDOverridePropertyOperation *opop)
 {
-	BLI_assert(len_local == len_reference && (!ptr_storage || len_local == len_storage));
+	BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
 	BLI_assert(opop->operation == IDOVERRIDE_OP_REPLACE && "Unsupported RNA override operation on animdata pointer");
 
 	/* AnimData is a special case, since you cannot edit/replace it, it's either existent or not. */
-	AnimData *adt_local = RNA_property_pointer_get(ptr_local, prop_local).data;
-	AnimData *adt_reference = RNA_property_pointer_get(ptr_reference, prop_reference).data;
+	AnimData *adt_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data;
+	AnimData *adt_src = RNA_property_pointer_get(ptr_src, prop_src).data;
 
-	if (adt_local == NULL && adt_reference != NULL) {
+	if (adt_dst == NULL && adt_src != NULL) {
 		/* Copy anim data from reference into final local ID. */
-		BKE_animdata_copy_id(NULL, ptr_local->id.data, ptr_reference->id.data, false);
+		BKE_animdata_copy_id(NULL, ptr_dst->id.data, ptr_src->id.data, false);
 		return true;
 	}
-	else if (adt_local != NULL && adt_reference == NULL) {
+	else if (adt_dst != NULL && adt_src == NULL) {
 		/* Override has cleared/removed anim data from its reference. */
-		BKE_animdata_free(ptr_local->id.data, true);
+		BKE_animdata_free(ptr_dst->id.data, true);
 		return true;
 	}
 
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index a39610e7315..c56bb27bd9d 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -396,9 +396,10 @@ bool rna_property_override_store_default(
         const int len_local, const int len_reference, const int len_storage,
         struct IDOverridePropertyOperation *opop);
 
-bool rna_property_override_apply_default(struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
-        struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
-        const int len_local, const int len_reference, const int len_storage,
+bool rna_property_override_apply_default(
+        struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
+        struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
+        const int len_dst, const int len_src, const int len_storage,
         struct IDOverridePropertyOperation *opop);
 
 
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index bd3a3eab285..445d496d034 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -162,16 +162,16 @@ typedef bool (*RNAPropOverrideStore)(
         struct IDOverridePropertyOperation *opop);
 
 /**
- * Apply given override operation from reference to local (using value from storage as second operand
+ * Apply given override operation from src to dst (using value from storage as second operand
  * for differential operations).
  *
  * \note Given PropertyRNA are final (in case of IDProps...).
  * \note In non-array cases, \a len values are 0.
  */
 typedef bool (*RNAPropOverrideApply)(
-        struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
-        struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
-        const int len_local, const int len_reference, const int len_storage,
+        struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
+        struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
+        const int len_dst, const int len_src, const int len_storage,
         struct IDOverridePropertyOperation *opop);
 
 /* Container - generic abstracted container of RNA properties */
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 683bd75ab48..8f7a2ccc83b 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -1760,30 +1760,30 @@ bool rna_property_override_store_default(
 }
 
 bool rna_property_override_apply_default(
-        PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
-        PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
-        const int len_local, const int len_reference, const int len_storage,
+        PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
+        PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage,
+        const int len_dst, const int len_src, const int len_storage,
         IDOverridePropertyOperation *opop)
 {
-	BLI_assert(len_local == len_reference && (!ptr_storage || len_local == len_storage));
+	BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage));
 
 	const int index = opop->subitem_reference_index;
 	const short override_op = opop->operation;
 
-	switch (RNA_property_type(prop_local)) {
+	switch (RNA_property_type(prop_dst)) {
 		case PROP_BOOLEAN:
-			if (len_local) {
+			if (len_dst) {
 				if (index == -1) {
 					int fixed_a[16];
 					int *array_a;
 
-					array_a = (len_local > 16) ? MEM_mallocN(sizeof(*array_a) * len_local, __func__) : fixed_a;
+					array_a = (len_dst > 16) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : fixed_a;
 
-					RNA_property_boolean_get_array(ptr_reference, prop_reference, array_a);
+					RNA_property_boolean_get_array(ptr_src, prop_src, array_a);
 
 					switch (override_op) {
 						case IDOVERRIDE_OP_REPLACE:
-							RNA_property_boolean_set_array(ptr_local, prop_local, array_a);
+							RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a);
 							break;
 						default:
 							BLI_assert(0 && "Unsupported RNA override operation on boolean");
@@ -1793,11 +1793,11 @@ bool rna_property_override_apply_default(
 					if (array_a != fixed_a) MEM_freeN(array_a);
 				}
 				else {
-					const int value = RNA_property_boolean_get_index(ptr_reference, prop_reference, index);
+					const int value = RNA_property_boolean_get_index(ptr_src, prop_src, index);
 
 					switch (override_op) {
 						case IDOVERRIDE_OP_REPLACE:
-							RNA_property_boolean_set_index(ptr_local, prop_local, index, value);
+							RNA_property_boolean_set_index(ptr_dst, prop_dst, index, value);
 							break;
 						default:
 							BLI_assert(0 && "Unsupported RNA override operation on boolean");
@@ -1806,11 +1806,11 @@ bool rna_property_override_apply_default(
 				}
 			}
 			else {
-				const int value = RNA_property_boolean_get(ptr_reference, prop_reference);
+				const int value = RNA_property_boolean_get(ptr_src, prop_src);
 
 				switch (override_op) {
 					case IDOVERRIDE_OP_REPLACE:
-						RNA_property_boolean_set(ptr_local, prop_local, value);
+						RNA_property_boolean_set(ptr_dst, prop_dst, value);
 						break;
 					default:
 						BLI_assert(0 && "Unsupported RNA override operation on boolean");
@@ -1819,30 +1819,30 @@ bool rna_property_override_apply_default(
 			}
 			return true;
 		case PROP_INT:
-			if (len_local) {
+			if (len_dst) {
 				if (index == -1) {
 					int fixed_a[16], fixed_b[16];
 					int *array_a, *array_b;
 
-					array_a = (len_local > 16) ? MEM_mallocN(sizeof(*array_a) * len_local, __func__) : fixed_a;
+					array_a = (len_dst > 16) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : fixed_a;
 
 					switch (override_op) {
 						case IDOVERRIDE_OP_REPLACE:
-							RNA_property_int_get_array(ptr_reference, prop_reference, array_a);
-							RNA_property_int_set_array(ptr_local, prop_local, array_a);
+							RNA_property_int_get_array(ptr_src, prop_src, array_a);
+							RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
 							break;
 						case IDOVERRIDE_OP_ADD:
 						case IDOVERRIDE_OP_SUBTRACT:
-							RNA_property_int_get_array(ptr_local, prop_local, array_a);
-							array_b = (len_local > 16) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : fixed_b;
+							RNA_property_int_get_array(ptr_dst, prop_dst, array_a);
+							array_b = (len_dst > 16) ? MEM_mallocN(sizeof(*array_b) * len_dst, __func__) : fixed_b;
 							RNA_property_int_get_array(ptr_storage, prop_storage, array_b);
 							if (override_op == IDOVERRIDE_OP_ADD) {
-								for (int i = len_local; i--;) array_a[i] += array_b[i];
+								for (int i = len_dst; i--;) array_a[i] += array_b[i];
 							}
 							else {
-								for (int i = len_local; i--;) array_a[i] -= array_b[i];
+								for (int i = len_dst; i--;) array_a[i] -= array_b[i];
 							}
-							RNA_property_int_set_array(ptr_local, prop_local, array_a);
+							RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
 							if (array_b != fixed_b) MEM_freeN(array_b);
 							break;
 						default:
@@ -1857,16 +1857,16 @@ bool rna_property_override_apply_default(
 
 					switch (override_op) {
 						case IDOVERRIDE_OP_REPLACE:
-							RNA_property_int_set_index(ptr_local, prop_local, index,
-							                           RNA_property_int_get_index(ptr_reference, prop_reference, index));
+							RNA_property_int_set_index(ptr_dst, prop_dst, index,
+							                        

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list