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/editarmature_sketch.c | |
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/editarmature_sketch.c')
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 40 |
1 files changed, 35 insertions, 5 deletions
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 */ |