Small tweaks to Knife Cut
authorJoshua Leung <aligorith@gmail.com>
Wed, 3 Feb 2010 21:33:15 +0000 (21:33 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 3 Feb 2010 21:33:15 +0000 (21:33 +0000)
- Number of multicuts can now be set (only usable for multicut mode)
- Midpoint cutting is now done using shift-k + drag hotkey mapping

These were just minor properties changes, which shouldn't be too much of a hassle for BMesh merging.

source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/mesh_ops.c

index 2cd5f221ebed004e1896761ec74a6fa5c727e434..0a3eed99d772c3cbdd50e97e5556e2b1ca1d91c0 100644 (file)
@@ -632,7 +632,8 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
        float isect=0.0;
        float  *scr, co[4];
        int len=0;
-       short numcuts=1, mode= RNA_int_get(op->ptr, "type");
+       short numcuts= RNA_int_get(op->ptr, "num_cuts"); 
+       short mode= RNA_int_get(op->ptr, "type");
        
        /* edit-object needed for matrix, and ar->regiondata for projections to work */
        if (ELEM3(NULL, obedit, ar, ar->regiondata))
@@ -732,6 +733,7 @@ void MESH_OT_knife_cut(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", "");
        prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+       RNA_def_int(ot->srna, "num_cuts", 1, 1, MAX_CUTS, "Number of Cuts", "Only for Multi-Cut", 1, MAX_CUTS);
        
        /* internal */
        RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
index 5dd940be7853ce591fd41c064d7664de9bd490f8..703333343b43a92adfe2947d27fac41b2ef98629 100644 (file)
@@ -299,6 +299,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
        
        WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
+       RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_SHIFT, KKEY)->ptr, "type", 2/*KNIFE_MIDPOINT*/);
        
        WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);