[Bf-blender-cvs] [0e41f5c158d] id_override_static: Rename override operation defines, add some operation flags.

Bastien Montagne noreply at git.blender.org
Wed Jun 14 15:31:40 CEST 2017


Commit: 0e41f5c158ddc892d4ff70a797b16effc57b845f
Author: Bastien Montagne
Date:   Tue Jun 13 12:50:01 2017 +0200
Branches: id_override_static
https://developer.blender.org/rB0e41f5c158ddc892d4ff70a797b16effc57b845f

Rename override operation defines, add some operation flags.

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

M	source/blender/editors/interface/interface_ops.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesrna/intern/rna_access.c

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

diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index ca130d95383..e299db02a46 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -377,19 +377,19 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
 
 	switch(op_type) {
 		case UIOverride_Type_NOOP:
-			operation = IDOVERRIDE_NOOP;
+			operation = IDOVERRIDE_OP_NOOP;
 			break;
 		case UIOverride_Type_Replace:
-			operation = IDOVERRIDE_REPLACE;
+			operation = IDOVERRIDE_OP_REPLACE;
 			break;
 		case UIOverride_Type_Difference:
-			operation = IDOVERRIDE_ADD;  /* override code will automatically switch to subtract if needed. */
+			operation = IDOVERRIDE_OP_ADD;  /* override code will automatically switch to subtract if needed. */
 			break;
 		case UIOverride_Type_Factor:
-			operation = IDOVERRIDE_MULTIPLY;
+			operation = IDOVERRIDE_OP_MULTIPLY;
 			break;
 		default:
-			operation = IDOVERRIDE_REPLACE;
+			operation = IDOVERRIDE_OP_REPLACE;
 			BLI_assert(0);
 			break;
 	}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index dc8e48a3d26..f5eacfe35b0 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -112,7 +112,8 @@ typedef struct IDOverridePropertyOperation {
 
 	/* Type of override. */
 	short operation;
-	short pad_s1[3];
+	short flag;
+	short pad_s1[2];
 
 	/* Sub-item references, if needed (for arrays or collections only).
 	 * We need both reference and local values to allow e.g. insertion into collections (constraints, modifiers...).
@@ -128,21 +129,28 @@ typedef struct IDOverridePropertyOperation {
 /* IDOverridePropertyOperation->operation. */
 enum {
 	/* Basic operations. */
-	IDOVERRIDE_NOOP          =   0,  /* Special value, forbids any overriding. */
+	IDOVERRIDE_OP_NOOP          =   0,  /* Special value, forbids any overriding. */
 
-	IDOVERRIDE_REPLACE       =   1,  /* Fully replace local value by reference one. */
+	IDOVERRIDE_OP_REPLACE       =   1,  /* Fully replace local value by reference one. */
 
 	/* Numeric-only operations. */
-	IDOVERRIDE_ADD           = 101,  /* Add local value to reference one. */
-	IDOVERRIDE_SUBTRACT      = 102,  /* Subtract local value from reference one (needed due to unsigned values etc.). */
-	IDOVERRIDE_MULTIPLY      = 103,  /* Multiply reference value by local one (more useful than diff for scales and the like). */
+	IDOVERRIDE_OP_ADD           = 101,  /* Add local value to reference one. */
+	IDOVERRIDE_OP_SUBTRACT      = 102,  /* Subtract local value from reference one (needed due to unsigned values etc.). */
+	IDOVERRIDE_OP_MULTIPLY      = 103,  /* Multiply reference value by local one (more useful than diff for scales and the like). */
 
 	/* Collection-only operations. */
-	IDOVERRIDE_INSERT_AFTER  = 201,  /* Insert after given reference's subitem. */
-	IDOVERRIDE_INSERT_BEFORE = 202,  /* Insert before given reference's subitem. */
+	IDOVERRIDE_OP_INSERT_AFTER  = 201,  /* Insert after given reference's subitem. */
+	IDOVERRIDE_OP_INSERT_BEFORE = 202,  /* Insert before given reference's subitem. */
 	/* We can add more if needed (move, delete, ...). */
 };
 
+/* IDOverridePropertyOperation->flag. */
+enum {
+	/* Basic operations. */
+	IDOVERRIDE_FLAG_MANDATORY     =   1 << 0,  /* User cannot remove that override operation. */
+	IDOVERRIDE_FLAG_LOCKED        =   1 << 1,  /* User cannot change that override operation. */
+};
+
 /* A single overriden property, contain all operations on this one. */
 typedef struct IDOverrideProperty {
 	struct IDOverrideProperty *next, *prev;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index e19b015f24d..d8b3b03e72e 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -6812,7 +6812,7 @@ static bool rna_property_override_operation_apply(
 
 bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
 {
-	return rna_property_override_operation_apply(ptr, fromptr, NULL, prop, index, IDOVERRIDE_REPLACE);
+	return rna_property_override_operation_apply(ptr, fromptr, NULL, prop, index, IDOVERRIDE_OP_REPLACE);
 }
 
 /* use RNA_warning macro which includes __func__ suffix */
@@ -6915,7 +6915,7 @@ static bool rna_property_override_equals_propptr(
 			IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 			if (op != NULL && created) {  /* If not yet overridden... */
-				BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+				BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 				if (r_override_changed) {
 					*r_override_changed = created;
 				}
@@ -6992,7 +6992,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {
-						BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+						BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
 						}
@@ -7016,7 +7016,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {  /* If not yet overridden... */
-						BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+						BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
 						}
@@ -7047,7 +7047,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {
-						BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+						BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
 						}
@@ -7071,7 +7071,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {  /* If not yet overridden... */
-						BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+						BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
 						}
@@ -7103,7 +7103,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {
-						BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_MULTIPLY : IDOVERRIDE_REPLACE,
+						BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_OP_MULTIPLY : IDOVERRIDE_OP_REPLACE,
 						                                    NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
@@ -7128,7 +7128,7 @@ static bool rna_property_override_equals(
 					IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 					if (op != NULL && created) {  /* If not yet overridden... */
-						BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_MULTIPLY : IDOVERRIDE_REPLACE,
+						BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_OP_MULTIPLY : IDOVERRIDE_OP_REPLACE,
 						                                    NULL, NULL, -1, -1, true, NULL, NULL);
 						if (r_override_changed) {
 							*r_override_changed = created;
@@ -7150,7 +7150,7 @@ static bool rna_property_override_equals(
 				IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 				if (op != NULL && created) {  /* If not yet overridden... */
-					BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+					BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 					if (r_override_changed) {
 						*r_override_changed = created;
 					}
@@ -7173,7 +7173,7 @@ static bool rna_property_override_equals(
 				IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
 
 				if (op != NULL && created) {  /* If not yet overridden... */
-					BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+					BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
 					if (r_override_changed) {
 						*r_override_changed = created;
 					}
@@ -7287,11 +7287,11 @@ static bool rna_property_override_operation_apply(
 	PropertyRNA *fromprop = prop;
 	PropertyRNA *storageprop = prop;
 
-	if (override_op == IDOVERRIDE_NOOP) {
+	if (override_op == IDOVERRIDE_OP_NOOP) {
 		return true;
 	}
 
-	if (ELEM(override_op, IDOVERRIDE_ADD, IDOVERRIDE_SUBTRACT, IDOVERRIDE_MULTIPLY) && !storage) {
+	if (ELEM(override_op, IDOVERRIDE_OP_ADD, IDOVERRIDE_OP_SUBTRACT, IDOVERRIDE_OP_MULTIPLY) && !storage) {
 		/* We cannot apply 'diff' override operations without some refference storage.
 		 * This should typically only happen at read time of .blend file... */
 		return false;
@@ -7313,7 +7313,7 @@ static bool rna_property_override_operation_apply(
 		}
 	}
 
-	if (ELEM(override_op, IDOVERRIDE_ADD, IDOVERRIDE_SUBTRACT, IDOVERRIDE_MULTIPLY) && !storageprop) {
+	if (ELEM(override_op, IDOVERRIDE_OP_ADD, IDOVERRIDE_OP_SUBTRACT, IDOVERRIDE_OP_MULTIPLY) && !storageprop) {
 		/* We cannot apply 'diff' override operations without some refference storage.
 		 * This should typically only happen at read time of .blend file... */
 		return false;
@@ -7344,7 +7344,7 @@ static bool rna_property_override_operation_apply(
 					RNA_property_boolea

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list