Merge branch 'master' into blender2.8
This commit is contained in:
@@ -86,12 +86,11 @@ void free_fcurve(FCurve *fcu)
|
||||
return;
|
||||
|
||||
/* free curve data */
|
||||
if (fcu->bezt) MEM_freeN(fcu->bezt);
|
||||
if (fcu->fpt) MEM_freeN(fcu->fpt);
|
||||
MEM_SAFE_FREE(fcu->bezt);
|
||||
MEM_SAFE_FREE(fcu->fpt);
|
||||
|
||||
/* free RNA-path, as this were allocated when getting the path string */
|
||||
if (fcu->rna_path)
|
||||
MEM_freeN(fcu->rna_path);
|
||||
MEM_SAFE_FREE(fcu->rna_path);
|
||||
|
||||
/* free extra data - i.e. modifiers, and driver */
|
||||
fcurve_free_driver(fcu);
|
||||
|
||||
@@ -274,6 +274,8 @@ static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f);
|
||||
|
||||
static void knifetool_free_bmbvh(KnifeTool_OpData *kcd);
|
||||
|
||||
static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event);
|
||||
|
||||
static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *kcd)
|
||||
{
|
||||
char header[UI_MAX_DRAW_STR];
|
||||
@@ -2679,6 +2681,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
const bool only_select = RNA_boolean_get(op->ptr, "only_selected");
|
||||
const bool cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry");
|
||||
const bool wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
||||
KnifeTool_OpData *kcd;
|
||||
|
||||
@@ -2706,6 +2709,18 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
knifetool_update_mval_i(kcd, event->mval);
|
||||
|
||||
if (wait_for_input == false) {
|
||||
/* Avoid copy-paste logic. */
|
||||
wmEvent event_modal = {
|
||||
.prevval = KM_NOTHING,
|
||||
.type = EVT_MODAL_MAP,
|
||||
.val = KNF_MODAL_ADD_CUT,
|
||||
};
|
||||
int ret = knifetool_modal(C, op, &event_modal);
|
||||
BLI_assert(ret == OPERATOR_RUNNING_MODAL);
|
||||
UNUSED_VARS_NDEBUG(ret);
|
||||
}
|
||||
|
||||
knife_update_header(C, op, kcd);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
@@ -2973,8 +2988,13 @@ void MESH_OT_knife_tool(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
/* properties */
|
||||
PropertyRNA *prop;
|
||||
RNA_def_boolean(ot->srna, "use_occlude_geometry", true, "Occlude Geometry", "Only cut the front most geometry");
|
||||
RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected", "Only cut selected geometry");
|
||||
|
||||
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2995,6 +2995,11 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
||||
|
||||
op->customdata = WM_gesture_new(C, event, WM_GESTURE_STRAIGHTLINE);
|
||||
|
||||
if (ISTWEAK(event->type)) {
|
||||
wmGesture *gesture = op->customdata;
|
||||
gesture->is_active = true;
|
||||
}
|
||||
|
||||
/* add modal handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
@@ -4488,7 +4493,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
|
||||
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_SELECT);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
|
||||
|
||||
/* assign map to operators */
|
||||
WM_modalkeymap_assign(keymap, "IMAGE_OT_sample_line");
|
||||
|
||||
Reference in New Issue
Block a user