[Bf-blender-cvs] [a1c11c5] mesh-transfer-data: cleanup: api & naming

Campbell Barton noreply at git.blender.org
Mon Nov 17 16:17:30 CET 2014


Commit: a1c11c50ee59115707da4da62d7925f12b892894
Author: Campbell Barton
Date:   Mon Nov 17 16:17:26 2014 +0100
Branches: mesh-transfer-data
https://developer.blender.org/rBa1c11c50ee59115707da4da62d7925f12b892894

cleanup: api & naming

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

M	source/blender/blenkernel/BKE_data_transfer.h
M	source/blender/blenkernel/intern/data_transfer.c
M	source/blender/blenkernel/intern/deform.c
M	source/blender/editors/object/object_data_transfer.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_datatransfer.c

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

diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h
index aa72b7d..a582ab3 100644
--- a/source/blender/blenkernel/BKE_data_transfer.h
+++ b/source/blender/blenkernel/BKE_data_transfer.h
@@ -45,93 +45,98 @@ struct ReportList;
 
 /* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */
 enum {
-	DT_DATA_MDEFORMVERT                 = 1 << 0,
-	DT_DATA_SHAPEKEY                    = 1 << 1,
-	DT_DATA_SKIN                        = 1 << 2,
-	DT_DATA_BWEIGHT_VERT                = 1 << 3,
-	DT_DATA_VERT_ALL                    = DT_DATA_MDEFORMVERT | DT_DATA_SHAPEKEY | DT_DATA_SKIN | DT_DATA_BWEIGHT_VERT,
-
-	DT_DATA_SHARP_EDGE                  = 1 << 8,
-	DT_DATA_SEAM                        = 1 << 9,
-	DT_DATA_CREASE                      = 1 << 10,
-	DT_DATA_BWEIGHT_EDGE                = 1 << 11,
-	DT_DATA_FREESTYLE_EDGE              = 1 << 12,
-	DT_DATA_EDGE_ALL                    = DT_DATA_SHARP_EDGE | DT_DATA_SEAM | DT_DATA_CREASE | DT_DATA_BWEIGHT_EDGE |
-	                                      DT_DATA_FREESTYLE_EDGE,
-
-	DT_DATA_VCOL                        = 1 << 16,
-	DT_DATA_LOOP_ALL                    = DT_DATA_VCOL,
-
-	DT_DATA_UV                          = 1 << 24,
-	DT_DATA_SHARP_FACE                  = 1 << 25,
-	DT_DATA_FREESTYLE_FACE              = 1 << 26,
-	DT_DATA_POLY_ALL                    = DT_DATA_UV | DT_DATA_SHARP_FACE | DT_DATA_FREESTYLE_FACE,
+	DT_TYPE_MDEFORMVERT             = 1 << 0,
+	DT_TYPE_SHAPEKEY                = 1 << 1,
+	DT_TYPE_SKIN                    = 1 << 2,
+	DT_TYPE_BWEIGHT_VERT            = 1 << 3,
+	DT_TYPE_VERT_ALL                = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT,
+
+	DT_TYPE_SHARP_EDGE              = 1 << 8,
+	DT_TYPE_SEAM                    = 1 << 9,
+	DT_TYPE_CREASE                  = 1 << 10,
+	DT_TYPE_BWEIGHT_EDGE            = 1 << 11,
+	DT_TYPE_FREESTYLE_EDGE          = 1 << 12,
+	DT_TYPE_EDGE_ALL                = DT_TYPE_SHARP_EDGE | DT_TYPE_SEAM | DT_TYPE_CREASE | DT_TYPE_BWEIGHT_EDGE |
+	                                  DT_TYPE_FREESTYLE_EDGE,
+
+	DT_TYPE_VCOL                    = 1 << 16,
+	DT_TYPE_LOOP_ALL                = DT_TYPE_VCOL,
+
+	DT_TYPE_UV                      = 1 << 24,
+	DT_TYPE_SHARP_FACE              = 1 << 25,
+	DT_TYPE_FREESTYLE_FACE          = 1 << 26,
+	DT_TYPE_POLY_ALL                = DT_TYPE_UV | DT_TYPE_SHARP_FACE | DT_TYPE_FREESTYLE_FACE,
 };
 
-CustomDataMask BKE_data_transfer_dttypes_to_cdmask(const int dtdata_types);
-bool BKE_data_transfer_get_dttypes_capacity(
+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);
-int BKE_data_transfer_get_dttypes_item_types(const int dtdata_types);
+int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types);
 
-int BKE_data_transfer_dttype_to_cdtype(const int dtdata_type);
-int BKE_data_transfer_dttype_to_fromto_idx(const int dtdata_type);
+int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type);
+int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type);
 
-#define DT_DATATYPE_IS_VERT(_dt) ELEM(_dt, DT_DATA_MDEFORMVERT, DT_DATA_SHAPEKEY, DT_DATA_SKIN,  \
-                                           DT_DATA_BWEIGHT_VERT)
-#define DT_DATATYPE_IS_EDGE(_dt) ELEM(_dt, DT_DATA_CREASE, DT_DATA_SHARP_EDGE, DT_DATA_SEAM,  \
-                                           DT_DATA_BWEIGHT_EDGE, DT_DATA_FREESTYLE_EDGE)
-#define DT_DATATYPE_IS_LOOP(_dt) ELEM(_dt, DT_DATA_UV, DT_DATA_VCOL)
-#define DT_DATATYPE_IS_POLY(_dt) ELEM(_dt, DT_DATA_UV, DT_DATA_SHARP_FACE, DT_DATA_FREESTYLE_FACE)
+#define DT_DATATYPE_IS_VERT(_dt) \
+	ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT)
+#define DT_DATATYPE_IS_EDGE(_dt) \
+	ELEM(_dt, DT_TYPE_CREASE, DT_TYPE_SHARP_EDGE, DT_TYPE_SEAM, DT_TYPE_BWEIGHT_EDGE, DT_TYPE_FREESTYLE_EDGE)
+#define DT_DATATYPE_IS_LOOP(_dt) \
+	ELEM(_dt, DT_TYPE_UV, DT_TYPE_VCOL)
+#define DT_DATATYPE_IS_POLY(_dt) \
+	ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE)
 
-#define DT_DATATYPE_IS_MULTILAYERS(_dt) ELEM(_dt, DT_DATA_MDEFORMVERT, DT_DATA_SHAPEKEY, DT_DATA_VCOL, DT_DATA_UV)
+#define DT_DATATYPE_IS_MULTILAYERS(_dt) \
+	ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_VCOL, DT_TYPE_UV)
 
 
 enum {
-	DT_MULTILAYER_IDX_INVALID           = -1,
-	DT_MULTILAYER_IDX_MDEFORMVERT       = 0,
-	DT_MULTILAYER_IDX_SHAPEKEY          = 1,
-	DT_MULTILAYER_IDX_VCOL              = 2,
-	DT_MULTILAYER_IDX_UV                = 3,
-	DT_MULTILAYER_IDX_MAX               = 4,
+	DT_MULTILAYER_INDEX_INVALID         = -1,
+	DT_MULTILAYER_INDEX_MDEFORMVERT     = 0,
+	DT_MULTILAYER_INDEX_SHAPEKEY        = 1,
+	DT_MULTILAYER_INDEX_VCOL            = 2,
+	DT_MULTILAYER_INDEX_UV              = 3,
+	DT_MULTILAYER_INDEX_MAX             = 4,
 };
 
 /* Below we keep positive values for real layers idx (generated dynamically). */
 /* How to select data layers, for types supporting multi-layers.
  * Here too, some options are highly dependent on type of transferred data! */
 enum {
-	DT_FROMLAYERS_ACTIVE                 = -1,
-	DT_FROMLAYERS_ALL                    = -2,
+	DT_LAYERS_ACTIVE_SRC                 = -1,
+	DT_LAYERS_ALL_SRC                    = -2,
 	/* Datatype-specific. */
-	DT_FROMLAYERS_VGROUP                 = 1 << 8,
-	DT_FROMLAYERS_VGROUP_BONE_SELECTED   = -(DT_FROMLAYERS_VGROUP | 1),
-	DT_FROMLAYERS_VGROUP_BONE_DEFORM     = -(DT_FROMLAYERS_VGROUP | 2),
+	DT_LAYERS_VGROUP_SRC                 = 1 << 8,
+	DT_LAYERS_VGROUP_SRC_BONE_SELECT     = -(DT_LAYERS_VGROUP_SRC | 1),
+	DT_LAYERS_VGROUP_SRC_BONE_DEFORM     = -(DT_LAYERS_VGROUP_SRC | 2),
 	/* Other types-related modes... */
 };
 
 /* How to map a source layer to a destination layer, for types supporting multi-layers.
  * Note: if no matching layer can be found, it will be created. */
 enum {
-	DT_TOLAYERS_ACTIVE                   = -1,  /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
-	DT_TOLAYERS_NAME                     = -2,
-	DT_TOLAYERS_INDEX                    = -3,
+	DT_LAYERS_ACTIVE_DST                 = -1,  /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
+	DT_LAYERS_NAME_DST                   = -2,
+	DT_LAYERS_INDEX_DST                  = -3,
 #if 0  /* TODO */
-	DT_TOLAYERS_CREATE                   = -4,  /* Never replace existing data in dst, always create new layers. */
+	DT_LAYERS_CREATE_DST                 = -4,  /* Never replace existing data in dst, always create new layers. */
 #endif
 };
 
-bool BKE_data_transfer_mesh(
-        struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create,
+bool BKE_object_data_transfer_mesh(
+        struct Scene *scene,
+        struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create,
         const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode,
         struct SpaceTransform *space_transform, const float max_distance, const float precision,
-        const int fromlayers_select[DT_MULTILAYER_IDX_MAX], const int tolayers_select[DT_MULTILAYER_IDX_MAX],
+        const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
         const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup,
         struct ReportList *reports);
-bool BKE_data_transfer_dm(
-        struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst,
+bool BKE_object_data_transfer_dm(
+        struct Scene *scene,
+        struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst,
         const int data_types, const bool use_create,
         const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode,
         struct SpaceTransform *space_transform, const float max_distance, const float ray_radius,
-        const int fromlayers_select[DT_MULTILAYER_IDX_MAX], const int tolayers_select[DT_MULTILAYER_IDX_MAX],
+        const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
         const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup,
         struct ReportList *reports);
 
@@ -140,4 +145,3 @@ bool BKE_data_transfer_dm(
 #endif
 
 #endif  /* __BKE_DATA_TRANSFER_H__ */
-
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index f2f35d1..86cfc3e 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -56,7 +56,7 @@
 #include "data_transfer_intern.h"
 
 
-CustomDataMask BKE_data_transfer_dttypes_to_cdmask(const int dtdata_types)
+CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types)
 {
 	CustomDataMask cddata_mask = 0;
 	int i;
@@ -69,7 +69,7 @@ CustomDataMask BKE_data_transfer_dttypes_to_cdmask(const int dtdata_types)
 			continue;
 		}
 
-		cddata_type = BKE_data_transfer_dttype_to_cdtype(dtdata_type);
+		cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);
 		if (!(cddata_type & CD_FAKE)) {
 			cddata_mask |= 1LL << cddata_type;
 		}
@@ -85,7 +85,7 @@ CustomDataMask BKE_data_transfer_dttypes_to_cdmask(const int dtdata_types)
 }
 
 /* Check what can do each layer type (if it is actually handled by transferdata, if it supports advanced mixing... */
-bool BKE_data_transfer_get_dttypes_capacity(
+bool BKE_object_data_transfer_get_dttypes_capacity(
         const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold)
 {
 	int i;
@@ -103,49 +103,49 @@ bool BKE_data_transfer_get_dttypes_capacity(
 
 		switch (dtdata_type) {
 		/* Vertex data */
-			case DT_DATA_MDEFORMVERT:
+			case DT_TYPE_MDEFORMVERT:
 				*r_advanced_mixing = true;
 				*r_threshold = true;
 				ret = true;
 				break;
-			case DT_DATA_SKIN:
+			case DT_TYPE_SKIN:
 				*r_threshold = true;
 				ret = true;
 				break;
-			case DT_DATA_BWEIGHT_VERT:
+			case DT_TYPE_BWEIGHT_VERT:
 		

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list