Revision: 59537
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59537
Author:   walid
Date:     2013-08-26 21:34:32 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
code rewrite: edits in the CD_Shapekey CD_MDeformVert copy WIP

Modified Paths:
--------------
    
branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c

Modified: 
branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c
===================================================================
--- 
branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c
        2013-08-26 21:11:52 UTC (rev 59536)
+++ 
branches/soc-2013-meshdata_transfer/source/blender/bmesh/tools/bmesh_data_transfer.c
        2013-08-26 21:34:32 UTC (rev 59537)
@@ -96,9 +96,9 @@
        BMVert *v_dst;
 } BMVert_match;
 
-static void BM_mesh_cd_array_transfer(const CustomData *cd_src, BMElem 
**array_src, int array_src_count,
-                                      const CustomData *cd_dst, BMElem 
**array_dst, int array_dst_count,
-                                      const int layer_type, const struct 
ReplaceLayerInfo *replace_info);
+static void BM_mesh_cd_array_transfer(CustomData *cd_src, BMElem **array_src, 
int array_src_count,
+                                      CustomData *cd_dst, BMElem **array_dst, 
int array_dst_count,
+                                      const int layer_type, const struct 
ReplaceLayerInfo *UNUSED_replace_info);
 
 static void BM_mesh_aligned_transfer(BMesh *bm_src, BMesh *bm_dst, const char 
itype, const int layer_type,
                          const struct ReplaceLayerInfo *replace_info);
@@ -375,80 +375,46 @@
 }
 
 
-static void BM_mesh_cd_array_transfer(const CustomData *cd_src, BMElem 
**array_src, int array_src_count,
-                                      const CustomData *cd_dst, BMElem 
**array_dst, int array_dst_count,
-                                      const int layer_type, const struct 
ReplaceLayerInfo *replace_info)
+static void BM_mesh_cd_array_transfer(CustomData *cd_src, BMElem **array_src, 
int array_src_count,
+                                      CustomData *cd_dst, BMElem **array_dst, 
int array_dst_count,
+                                      const int layer_type, const struct 
ReplaceLayerInfo *UNUSED(replace_info))
 {
        //... copy between arrays aligned arrays ...
 
        if ((array_dst && array_src) && (array_src_count == array_dst_count)) {
-               int src_lay_iter, dst_lay_iter;
-               int src_lay_start = replace_info->src_lay_start;
-               int src_lay_end = replace_info->src_lay_end;
-               int dst_lay_start = replace_info->dst_lay_start;
-
                int i;
 
-               for (src_lay_iter = src_lay_start, dst_lay_iter = 
dst_lay_start; src_lay_iter <= src_lay_end;
-                       src_lay_iter++, dst_lay_iter++) {
+               void *ptr;
+
+               for (i = 0; i < array_dst_count; i++) {
+                       BMElem *ele_src = array_src[i];
+                       BMElem *ele_dst = array_dst[i];
+
                        switch (layer_type) {
                                case CD_SHAPEKEY:
                                {
-                                       //fix the layers
-                                       int CD_basis_src = 
CustomData_get_n_offset(cd_src, CD_SHAPEKEY, 0);
-                                       int CD_basis_dst = 
CustomData_get_n_offset(cd_dst, CD_SHAPEKEY, 0);
-                                       int CD_offset_src = 
CustomData_get_n_offset(cd_src, CD_SHAPEKEY, src_lay_iter);
-                                       int CD_offset_dst = 
CustomData_get_n_offset(cd_dst, CD_SHAPEKEY, dst_lay_iter);
+                                               ptr = 
CustomData_bmesh_get(cd_src, ele_src->head.data, CD_SHAPEKEY);
+                                               CustomData_bmesh_set(cd_src, 
ele_src->head.data, CD_SHAPEKEY, ptr);
 
-                                       for (i = 0; i < array_dst_count; i++) {
+                                               ptr = 
CustomData_bmesh_get(cd_dst, ele_dst->head.data, CD_SHAPEKEY);
+                                               CustomData_bmesh_set(cd_dst, 
ele_dst->head.data, CD_SHAPEKEY, ptr);
 
-                                               BMElem *ele_src = array_src[i];
-                                               BMElem *ele_dst = array_dst[i];
+                                               
CustomData_bmesh_copy_data(cd_src, cd_dst, ele_src->head.data, 
&ele_dst->head.data);
 
-                                               float *cos_src = 
BM_ELEM_CD_GET_VOID_P(ele_src, CD_offset_src);
-                                               float *cos_dst = 
BM_ELEM_CD_GET_VOID_P(ele_dst, CD_offset_dst);
-
-                                               float *cos_src_basis = 
BM_ELEM_CD_GET_VOID_P(ele_src, CD_basis_src);
-                                               float *cos_dst_basis = 
BM_ELEM_CD_GET_VOID_P(ele_dst, CD_basis_dst);
-
-                                               float offset[3];
-
-                                               sub_v3_v3v3(offset, cos_src, 
cos_src_basis);
-                                               add_v3_v3v3(cos_dst, offset, 
cos_dst_basis);
-                                               sub_v3_v3v3(offset, cos_src, 
cos_src_basis);
-                                       }
-
                                        break;
                                }
 
                                case CD_MDEFORMVERT:
                                {
-                                       const int cd_dvert_src_offset = 
CustomData_get_offset(cd_src, CD_MDEFORMVERT);
-                                       const int cd_dvert_dst_offset = 
CustomData_get_offset(cd_dst, CD_MDEFORMVERT);
 
-                                       const int src_grp_ind = src_lay_start + 
src_lay_iter;
-                                       const int dst_grp_ind = dst_lay_start + 
dst_lay_iter;
+                                               ptr = 
CustomData_bmesh_get(cd_src, ele_src->head.data, CD_MDEFORMVERT);
+                                               CustomData_bmesh_set(cd_src, 
ele_src->head.data, CD_MDEFORMVERT, ptr);
 
-                                       for (i = 0; i < array_dst_count; i++) {
-                                               MDeformVert *dv_src, *dv_dst;
-                                               MDeformWeight *dw_src, *dw_dst;
+                                               ptr = 
CustomData_bmesh_get(cd_dst, ele_dst->head.data, CD_MDEFORMVERT);
+                                               CustomData_bmesh_set(cd_dst, 
ele_dst->head.data, CD_MDEFORMVERT, ptr);
 
-                                               BMElem *ele_src = array_src[i];
-                                               BMElem *ele_dst = array_dst[i];
+                                               
CustomData_bmesh_copy_data(cd_src, cd_dst, ele_src->head.data, 
&ele_dst->head.data);
 
-                                               dv_src = 
BM_ELEM_CD_GET_VOID_P(ele_src, cd_dvert_src_offset);
-                                               dw_src = 
defvert_verify_index(dv_src, src_grp_ind);
-
-                                               dv_dst = 
BM_ELEM_CD_GET_VOID_P(ele_dst, cd_dvert_dst_offset);
-                                               dw_dst = 
defvert_verify_index(dv_dst, dst_grp_ind);
-
-                                               if (dw_src == NULL)
-                                                       dw_dst = NULL;
-
-                                               else
-                                                       dw_dst->weight = 
dw_src->weight;
-                                       }
-
                                        break;
                                }
                        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to