[Bf-blender-cvs] [f1962f1] master: Refactor: Add generic poll ED_transverts_poll

Campbell Barton noreply at git.blender.org
Mon Mar 31 00:58:35 CEST 2014


Commit: f1962f187f432fadc03b92b64b0bd743a267bf95
Author: Campbell Barton
Date:   Mon Mar 31 08:23:40 2014 +1100
https://developer.blender.org/rBf1962f187f432fadc03b92b64b0bd743a267bf95

Refactor: Add generic poll ED_transverts_poll

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

M	source/blender/editors/include/ED_transverts.h
M	source/blender/editors/object/object_warp.c
M	source/blender/editors/util/ed_transverts.c

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

diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h
index 1df89b0..e7e30e6 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 614939e..8016dab 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 4123132..9f41642 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;
+}




More information about the Bf-blender-cvs mailing list