diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-31 01:23:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-31 02:58:17 +0400 |
commit | f1962f187f432fadc03b92b64b0bd743a267bf95 (patch) | |
tree | 6bab6bdc7a698e85aa9315bec58175e0555bf41a | |
parent | f5b79dff412f61a2aa453a6ce50804e3425463a1 (diff) |
Refactor: Add generic poll ED_transverts_poll
-rw-r--r-- | source/blender/editors/include/ED_transverts.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_warp.c | 14 | ||||
-rw-r--r-- | source/blender/editors/util/ed_transverts.c | 12 |
3 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index 1df89b0a8f9..e7e30e6ca6f 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -49,6 +49,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit void ED_transverts_update_obedit(TransVertStore *tvs, struct Object *obedit); void ED_transverts_free(TransVertStore *tvs); bool ED_transverts_check_obedit(Object *obedit); +int ED_transverts_poll(struct bContext *C); /* currently only used for bmesh index values */ enum { diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c index 614939effcd..8016dabf3a3 100644 --- a/source/blender/editors/object/object_warp.c +++ b/source/blender/editors/object/object_warp.c @@ -276,18 +276,6 @@ static int object_warp_verts_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int object_warp_verts_poll(bContext *C) -{ - Object *obedit = CTX_data_edit_object(C); - if (obedit) { - if (ED_transverts_check_obedit(obedit)) { - return true; - } - } - return false; -} - - void OBJECT_OT_vertex_warp(struct wmOperatorType *ot) { PropertyRNA *prop; @@ -299,7 +287,7 @@ void OBJECT_OT_vertex_warp(struct wmOperatorType *ot) /* api callbacks */ ot->exec = object_warp_verts_exec; - ot->poll = object_warp_verts_poll; + ot->poll = ED_transverts_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index 4123132ad03..9f41642280b 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -43,6 +43,7 @@ #include "BKE_lattice.h" #include "BKE_editmesh.h" #include "BKE_DerivedMesh.h" +#include "BKE_context.h" #include "ED_armature.h" @@ -460,3 +461,14 @@ void ED_transverts_free(TransVertStore *tvs) MEM_SAFE_FREE(tvs->transverts); tvs->transverts_tot = 0; } + +int ED_transverts_poll(bContext *C) +{ + Object *obedit = CTX_data_edit_object(C); + if (obedit) { + if (ED_transverts_check_obedit(obedit)) { + return true; + } + } + return false; +} |