Refactor: Add generic poll ED_transverts_poll

This commit is contained in:
Campbell Barton 2014-03-31 08:23:40 +11:00
parent f5b79dff41
commit f1962f187f
3 changed files with 14 additions and 13 deletions

@ -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 {

@ -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;

@ -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;
}