[Bf-blender-cvs] [c48c9b7] mesh-transfer-data: cleanup: use max data-transfer define instead of checking all flags

Campbell Barton noreply at git.blender.org
Fri Nov 21 23:26:45 CET 2014


Commit: c48c9b716cbc4a2db38ff66dc43b3aa5cd0e471c
Author: Campbell Barton
Date:   Fri Nov 21 22:38:09 2014 +0100
Branches: mesh-transfer-data
https://developer.blender.org/rBc48c9b716cbc4a2db38ff66dc43b3aa5cd0e471c

cleanup: use max data-transfer define instead of checking all flags

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

M	source/blender/blenkernel/BKE_object_data_transfer.h
M	source/blender/blenkernel/intern/object_data_transfer.c

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

diff --git a/source/blender/blenkernel/BKE_object_data_transfer.h b/source/blender/blenkernel/BKE_object_data_transfer.h
index 6b69740..7aae964 100644
--- a/source/blender/blenkernel/BKE_object_data_transfer.h
+++ b/source/blender/blenkernel/BKE_object_data_transfer.h
@@ -61,6 +61,8 @@ enum {
 	DT_TYPE_UV                      = 1 << 24,
 	DT_TYPE_SHARP_FACE              = 1 << 25,
 	DT_TYPE_FREESTYLE_FACE          = 1 << 26,
+#define \
+	DT_TYPE_MAX                            27
 
 	DT_TYPE_VERT_ALL                = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT,
 	DT_TYPE_EDGE_ALL                = DT_TYPE_SHARP_EDGE | DT_TYPE_SEAM | DT_TYPE_CREASE | DT_TYPE_BWEIGHT_EDGE |
@@ -69,6 +71,7 @@ enum {
 	DT_TYPE_POLY_ALL                = DT_TYPE_UV | DT_TYPE_SHARP_FACE | DT_TYPE_FREESTYLE_FACE,
 };
 
+
 CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types);
 bool BKE_object_data_transfer_get_dttypes_capacity(
         const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold);
diff --git a/source/blender/blenkernel/intern/object_data_transfer.c b/source/blender/blenkernel/intern/object_data_transfer.c
index 217c036..8539784 100644
--- a/source/blender/blenkernel/intern/object_data_transfer.c
+++ b/source/blender/blenkernel/intern/object_data_transfer.c
@@ -61,7 +61,7 @@ CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types
 	CustomDataMask cddata_mask = 0;
 	int i;
 
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < DT_TYPE_MAX; i++) {
 		const int dtdata_type = 1 << i;
 		int cddata_type;
 
@@ -94,7 +94,7 @@ bool BKE_object_data_transfer_get_dttypes_capacity(
 	*r_advanced_mixing = false;
 	*r_threshold = false;
 
-	for (i = 0; (i < 32) && !(ret && *r_advanced_mixing && *r_threshold); i++) {
+	for (i = 0; (i < DT_TYPE_MAX) && !(ret && *r_advanced_mixing && *r_threshold); i++) {
 		const int dtdata_type = 1 << i;
 
 		if (!(dtdata_types & dtdata_type)) {
@@ -158,7 +158,7 @@ int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types)
 {
 	int i, ret = 0;
 
-	for (i = 0; (i < 32) && (ret ^ (ME_VERT | ME_EDGE | ME_LOOP | ME_POLY)); i++) {
+	for (i = 0; (i < DT_TYPE_MAX) && (ret ^ (ME_VERT | ME_EDGE | ME_LOOP | ME_POLY)); i++) {
 		const int dtdata_type = 1 << i;
 
 		if (!(dtdata_types & dtdata_type)) {
@@ -876,7 +876,7 @@ void BKE_object_data_transfer_layout(
 	}
 
 	/* Check all possible data types. */
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < DT_TYPE_MAX; i++) {
 		const int dtdata_type = 1 << i;
 		int cddata_type;
 		int fromlayers, tolayers, fromto_idx;
@@ -992,7 +992,7 @@ bool BKE_object_data_transfer_dm(
 
 	/* Check all possible data types.
 	 * Note item mappings and dest mix weights are cached. */
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < DT_TYPE_MAX; i++) {
 		const int dtdata_type = 1 << i;
 		int cddata_type;
 		int fromlayers, tolayers, fromto_idx;




More information about the Bf-blender-cvs mailing list