[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61045] trunk/blender/source/blender/ editors/mesh: Add 'cut-through' option for Knife Project operator.

Howard Trickey howard.trickey at gmail.com
Fri Nov 1 12:42:11 CET 2013


Revision: 61045
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61045
Author:   howardt
Date:     2013-11-01 11:42:11 +0000 (Fri, 01 Nov 2013)
Log Message:
-----------
Add 'cut-through' option for Knife Project operator.

If enabled, it makes knife project act as the
cut-through (Shift-K) version of knife.
This option will soon be more useful when a better
cut-though Knife change is submitted, allowing
this to work for cuts within faces in addition
to cuts across them.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c
    trunk/blender/source/blender/editors/mesh/editmesh_knife_project.c
    trunk/blender/source/blender/editors/mesh/mesh_intern.h

Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-11-01 09:37:42 UTC (rev 61044)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-11-01 11:42:11 UTC (rev 61045)
@@ -3539,7 +3539,7 @@
 /**
  * \param use_tag  When set, tag all faces inside the polylines.
  */
-void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag)
+void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_through)
 {
 	KnifeTool_OpData *kcd;
 
@@ -3548,7 +3548,6 @@
 	/* init */
 	{
 		const bool only_select = false;
-		const bool cut_through = false;
 		const bool is_interactive = false;  /* can enable for testing */
 
 		kcd = MEM_callocN(sizeof(KnifeTool_OpData), __func__);

Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife_project.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife_project.c	2013-11-01 09:37:42 UTC (rev 61044)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife_project.c	2013-11-01 11:42:11 UTC (rev 61045)
@@ -42,6 +42,9 @@
 #include "BKE_editmesh.h"
 #include "BKE_report.h"
 
+#include "RNA_define.h"
+#include "RNA_access.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "WM_types.h"
@@ -117,6 +120,7 @@
 	Scene *scene = CTX_data_scene(C);
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BKE_editmesh_from_object(obedit);
+	const bool cut_through = RNA_boolean_get(op->ptr, "cut_through");
 
 	LinkNode *polys = NULL;
 
@@ -129,7 +133,7 @@
 	CTX_DATA_END;
 
 	if (polys) {
-		EDBM_mesh_knife(C, polys, true);
+		EDBM_mesh_knife(C, polys, true, cut_through);
 
 		/* select only tagged faces */
 		BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
@@ -166,4 +170,7 @@
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+
+	/* parameters */
+	RNA_def_boolean(ot->srna, "cut_through", false, "Cut through", "Cut through all faces, not just visible ones");
 }

Modified: trunk/blender/source/blender/editors/mesh/mesh_intern.h
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_intern.h	2013-11-01 09:37:42 UTC (rev 61044)
+++ trunk/blender/source/blender/editors/mesh/mesh_intern.h	2013-11-01 11:42:11 UTC (rev 61045)
@@ -116,7 +116,8 @@
 /* *** editmesh_knife.c *** */
 void MESH_OT_knife_tool(struct wmOperatorType *ot);
 void MESH_OT_knife_project(struct wmOperatorType *ot);
-void EDBM_mesh_knife(struct bContext *C, struct LinkNode *polys, bool use_tag);
+void EDBM_mesh_knife(struct bContext *C, struct LinkNode *polys,
+                     bool use_tag, bool cut_through);
 
 struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf);
 




More information about the Bf-blender-cvs mailing list