Revision: 57683
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57683
Author:   campbellbarton
Date:     2013-06-24 04:41:03 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
de-duplicate ED_mesh_active_dvert_* functions.

not to devs - please don't just copy static functions around, make them api 
calls and add to headers.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/mesh/meshtools.c
    trunk/blender/source/blender/editors/object/object_vgroup.c
    trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c

Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h      2013-06-24 
04:28:07 UTC (rev 57682)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h      2013-06-24 
04:41:03 UTC (rev 57683)
@@ -74,7 +74,6 @@
 struct rcti;
 struct MeshStatVis;
 
-
 /* editmesh_utils.c */
 void           EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const 
int axis,
                                                 const bool use_self, const 
bool use_select,
@@ -313,6 +312,11 @@
 bool ED_mesh_pick_face(struct bContext *C,      struct Object *ob, const int 
mval[2], unsigned int *index, int size);
 bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int 
mval[2], unsigned int *index, int size);
 
+
+struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct 
BMVert **r_eve);
+struct MDeformVert *ED_mesh_active_dvert_get_ob(struct Object *ob, int 
*r_index);
+struct MDeformVert *ED_mesh_active_dvert_get_only(struct Object *ob);
+
 #define ED_MESH_PICK_DEFAULT_VERT_SIZE 50
 #define ED_MESH_PICK_DEFAULT_FACE_SIZE 3
 

Modified: trunk/blender/source/blender/editors/mesh/meshtools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/meshtools.c       2013-06-24 
04:28:07 UTC (rev 57682)
+++ trunk/blender/source/blender/editors/mesh/meshtools.c       2013-06-24 
04:41:03 UTC (rev 57683)
@@ -1362,3 +1362,54 @@
 
        return true;
 }
+
+
+MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
+{
+       if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && 
ob->defbase.first) {
+               Mesh *me = ob->data;
+               BMEditMesh *em = me->edit_btmesh;
+               const int cd_dvert_offset = 
CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
+
+               if (cd_dvert_offset != -1) {
+                       BMEditSelection *ese = (BMEditSelection 
*)em->bm->selected.last;
+
+                       if (ese && ese->htype == BM_VERT) {
+                               BMVert *eve = (BMVert *)ese->ele;
+                               if (r_eve) *r_eve = eve;
+                               return BM_ELEM_CD_GET_VOID_P(eve, 
cd_dvert_offset);
+                       }
+               }
+       }
+
+       if (r_eve) *r_eve = NULL;
+       return NULL;
+}
+
+MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
+{
+       Mesh *me = ob->data;
+       int index = BKE_mesh_mselect_active_get(me, ME_VSEL);
+       if (r_index) *r_index = index;
+       if (index == -1 || me->dvert == NULL) {
+               return NULL;
+       }
+       else {
+               return me->dvert + index;
+       }
+}
+
+MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
+{
+       if (ob->type == OB_MESH) {
+               if (ob->mode & OB_MODE_EDIT) {
+                       return ED_mesh_active_dvert_get_em(ob, NULL);
+               }
+               else {
+                       return ED_mesh_active_dvert_get_ob(ob, NULL);
+               }
+       }
+       else {
+               return NULL;
+       }
+}

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c 2013-06-24 
04:28:07 UTC (rev 57682)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c 2013-06-24 
04:41:03 UTC (rev 57683)
@@ -411,28 +411,6 @@
        return true;
 }
 
-static MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
-{
-       if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && 
ob->defbase.first) {
-               Mesh *me = ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               const int cd_dvert_offset = 
CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
-
-               if (cd_dvert_offset != -1) {
-                       BMEditSelection *ese = (BMEditSelection 
*)em->bm->selected.last;
-
-                       if (ese && ese->htype == BM_VERT) {
-                               BMVert *eve = (BMVert *)ese->ele;
-                               if (r_eve) *r_eve = eve;
-                               return BM_ELEM_CD_GET_VOID_P(eve, 
cd_dvert_offset);
-                       }
-               }
-       }
-
-       if (r_eve) *r_eve = NULL;
-       return NULL;
-}
-
 /* TODO, cache flip data to speedup calls within a loop. */
 static void mesh_defvert_mirror_update_internal(Object *ob,
                                                 MDeformVert *dvert_dst, 
MDeformVert *dvert_src,
@@ -454,19 +432,6 @@
        }
 }
 
-static MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
-{
-       Mesh *me = ob->data;
-       int index = BKE_mesh_mselect_active_get(me, ME_VSEL);
-       if (r_index) *r_index = index;
-       if (index == -1 || me->dvert == NULL) {
-               return NULL;
-       }
-       else {
-               return me->dvert + index;
-       }
-}
-
 static void ED_mesh_defvert_mirror_update_em(Object *ob, BMVert *eve, int 
def_nr, int vidx,
                                              const int cd_dvert_offset)
 {
@@ -499,21 +464,6 @@
        }
 }
 
-static MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
-{
-       if (ob->type == OB_MESH) {
-               if (ob->mode & OB_MODE_EDIT) {
-                       return ED_mesh_active_dvert_get_em(ob, NULL);
-               }
-               else {
-                       return ED_mesh_active_dvert_get_ob(ob, NULL);
-               }
-       }
-       else {
-               return NULL;
-       }
-}
-
 /**
  * Use when adjusting the active vertex weight and apply to mirror vertices.
  */

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c  
2013-06-24 04:28:07 UTC (rev 57682)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c  
2013-06-24 04:41:03 UTC (rev 57683)
@@ -779,57 +779,6 @@
 #define B_VGRP_PNL_COPY_SINGLE    8192 /* or greater */
 #define B_VGRP_PNL_ACTIVE        16384 /* or greater */
 
-
-static MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
-{
-       Mesh *me = ob->data;
-       int index = BKE_mesh_mselect_active_get(me, ME_VSEL);
-       if (r_index) *r_index = index;
-       if (index == -1 || me->dvert == NULL) {
-               return NULL;
-       }
-       else {
-               return me->dvert + index;
-       }
-}
-
-static MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
-{
-       if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && 
ob->defbase.first) {
-               Mesh *me = ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               const int cd_dvert_offset = 
CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
-
-               if (cd_dvert_offset != -1) {
-                       BMEditSelection *ese = (BMEditSelection 
*)em->bm->selected.last;
-
-                       if (ese && ese->htype == BM_VERT) {
-                               BMVert *eve = (BMVert *)ese->ele;
-                               if (r_eve) *r_eve = eve;
-                               return BM_ELEM_CD_GET_VOID_P(eve, 
cd_dvert_offset);
-                       }
-               }
-       }
-
-       if (r_eve) *r_eve = NULL;
-       return NULL;
-}
-
-static MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
-{
-       if (ob->type == OB_MESH) {
-               if (ob->mode & OB_MODE_EDIT) {
-                       return ED_mesh_active_dvert_get_em(ob, NULL);
-               }
-               else {
-                       return ED_mesh_active_dvert_get_ob(ob, NULL);
-               }
-       }
-       else {
-               return NULL;
-       }
-}
-
 static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
 {
        if (event < B_VGRP_PNL_EDIT_SINGLE) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to