etch-a-ton: fix crash selecting strokes

This commit is contained in:
Campbell Barton 2015-02-17 16:49:30 +11:00
parent a8487fc7fe
commit 28f31bdfd8
Notes: blender-bot 2023-02-14 06:33:35 +01:00
Referenced by issue #52809, Proposal: Remove Skeleton Sketching
3 changed files with 11 additions and 5 deletions

View File

@ -215,7 +215,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot);
*/
EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone);
void BIF_sk_selectStroke(struct bContext *C, const int mval[2], short extend);
bool BIF_sk_selectStroke(struct bContext *C, const int mval[2], const bool extend);
/* duplicate method */
void preEditBoneDuplicate(struct ListBase *editbones);

View File

@ -485,7 +485,9 @@ bool mouse_armature(bContext *C, const int mval[2], bool extend, bool deselect,
view3d_set_viewcontext(C, &vc);
BIF_sk_selectStroke(C, mval, extend);
if (BIF_sk_selectStroke(C, mval, extend)) {
return true;
}
nearBone = get_nearest_editbonepoint(&vc, mval, arm->edbo, 1, &selmask);
if (nearBone) {

View File

@ -1951,7 +1951,7 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
/********************************************/
static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], int extend)
static bool sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], const bool extend)
{
ViewContext vc;
rcti rect;
@ -2239,15 +2239,19 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNU
return OPERATOR_FINISHED;
}
void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
bool BIF_sk_selectStroke(bContext *C, const int mval[2], const bool extend)
{
ToolSettings *ts = CTX_data_tool_settings(C);
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING) {
if (sk_selectStroke(C, sketch, mval, extend))
if (sk_selectStroke(C, sketch, mval, extend)) {
ED_area_tag_redraw(CTX_wm_area(C));
return true;
}
}
return false;
}
void BIF_convertSketch(bContext *C)