diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-06-20 00:25:00 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-06-20 00:25:00 +0400 |
commit | 62ffe6304583af57e655bbda1b8a8cf074ee8172 (patch) | |
tree | 7fdd5e49d1701a950283a41f95bdc8e4f176c367 /source/blender/editors/armature | |
parent | 801beadc520d3deb6518f0a3ea7a1956615ebe67 (diff) |
etch-a-ton bugfix
Add Convert operator and button (missing in 2.5)
Fix stroke selection (uneeded separate operator and missing redraw)
Map sketch operators to LEFTMOUSE and RIGHTMOUSE instead of SELECTMOUSE AND ACTIONMOUSE (more in line with other sketching operators, might work better with swapped mouse buttons)
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_ops.c | 12 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 40 |
3 files changed, 43 insertions, 10 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 099cfeddad7..a4a2d020482 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -130,6 +130,7 @@ void SKETCH_OT_draw_stroke(struct wmOperatorType *ot); void SKETCH_OT_draw_preview(struct wmOperatorType *ot); void SKETCH_OT_finish_stroke(struct wmOperatorType *ot); void SKETCH_OT_cancel_stroke(struct wmOperatorType *ot); +void SKETCH_OT_convert(struct wmOperatorType *ot); void SKETCH_OT_select(struct wmOperatorType *ot); /* ******************************************************* */ diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index acf30b45357..672dd22b704 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -96,6 +96,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(SKETCH_OT_draw_preview); WM_operatortype_append(SKETCH_OT_finish_stroke); WM_operatortype_append(SKETCH_OT_cancel_stroke); + WM_operatortype_append(SKETCH_OT_convert); WM_operatortype_append(SKETCH_OT_select); /* POSE */ @@ -190,14 +191,15 @@ void ED_keymap_armature(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SKETCH_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", SELECTMOUSE, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", RIGHTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); + // Already part of view3d select + //WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); /* sketch poll checks mode */ - WM_keymap_add_item(keymap, "SKETCH_OT_gesture", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "snap", 1); WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0); kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 907fe50305a..fdc89936029 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2154,7 +2154,7 @@ void sk_applyGesture(bContext *C, SK_Sketch *sketch) /********************************************/ -void sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend) +int sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend) { ViewContext vc; rcti rect; @@ -2199,7 +2199,10 @@ void sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend) } + return 1; } + + return 0; } void sk_queueRedrawSketch(SK_Sketch *sketch) @@ -2301,7 +2304,7 @@ void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names) } } -#if 1 +#if 0 if (sketch->depth_peels.first != NULL) { float colors[8][3] = { @@ -2471,7 +2474,8 @@ void BIF_sk_selectStroke(bContext *C, short mval[2], short extend) if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING) { - sk_selectStroke(C, sketch, mval, extend); + if (sk_selectStroke(C, sketch, mval, extend)) + ED_area_tag_redraw(CTX_wm_area(C)); } } @@ -2558,6 +2562,17 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create) return sketch; } +static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) +{ + SK_Sketch *sketch = contextSketch(C, 0); + if (sketch != NULL) + { + sk_convert(C, sketch); + ED_area_tag_redraw(CTX_wm_area(C)); + } + return OPERATOR_FINISHED; +} + static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) { SK_Sketch *sketch = contextSketch(C, 0); @@ -2590,8 +2605,8 @@ static int sketch_select(bContext *C, wmOperator *op, wmEvent *event) if (sketch) { short extend = 0; - sk_selectStroke(C, sketch, event->mval, extend); - ED_area_tag_redraw(CTX_wm_area(C)); + if (sk_selectStroke(C, sketch, event->mval, extend)) + ED_area_tag_redraw(CTX_wm_area(C)); } return OPERATOR_FINISHED; @@ -2859,6 +2874,21 @@ void SKETCH_OT_cancel_stroke(wmOperatorType *ot) // ot->flag= OPTYPE_UNDO; } +void SKETCH_OT_convert(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "convert"; + ot->idname= "SKETCH_OT_convert"; + + /* api callbacks */ + ot->invoke= sketch_convert; + + ot->poll= ED_operator_sketch_full_mode; + + /* flags */ + ot->flag= OPTYPE_UNDO; +} + void SKETCH_OT_finish_stroke(wmOperatorType *ot) { /* identifiers */ |