Commit: a0fa831bfeba548261319fc671324917567c4c96 Author: Falk David Date: Tue Jul 7 10:52:57 2020 +0200 Branches: soc-2020-greasepencil-curve https://developer.blender.org/rBa0fa831bfeba548261319fc671324917567c4c96
GPencil: Remove error threshold as parameter Use the error threshold in gpd instead of the operator property. =================================================================== M source/blender/editors/gpencil/gpencil_select.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h =================================================================== diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 94017e64632..a5af22dc502 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -128,31 +128,6 @@ static bool gpencil_select_poll(bContext *C) return false; } -static bool error_threshold_display_poll(bContext *C) -{ - CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { - if (gps->editcurve == NULL) { - return true; - } - } - CTX_DATA_END; - return false; -} - -static void gpencil_select_ui(bContext *C, wmOperator *op) -{ - uiLayout *layout = op->layout; - PointerRNA ptr; - - Object *ob = CTX_data_active_object(C); - bGPdata *gpd = ob->data; - - if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) { // && error_threshold_display_poll(C)) { - RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); - uiItemR(layout, &ptr, "error_threshold", 0, "Error Threshold", ICON_NONE); - } -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -176,7 +151,6 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); int action = RNA_enum_get(op->ptr, "action"); - float error_threshold = RNA_float_get(op->ptr, "error_threshold"); if (gpd == NULL) { BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data"); @@ -197,7 +171,7 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op) } if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) { - ED_gpencil_select_curve_toggle_all(C, action, error_threshold); + ED_gpencil_select_curve_toggle_all(C, action); } else { ED_gpencil_select_toggle_all(C, action); @@ -214,19 +188,6 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void WM_operator_property_error_threshold(wmOperatorType *ot) -{ - PropertyRNA *prop = RNA_def_float(ot->srna, - "error_threshold", - 0.1f, - FLT_MIN, - 100.0f, - "Error Threshold", - "Threshold on the maximum deviation from the actual stroke", - FLT_MIN, - 10.f); - RNA_def_property_ui_range(prop, FLT_MIN, 10.0f, 0.1f, 5); -} void GPENCIL_OT_select_all(wmOperatorType *ot) { @@ -242,10 +203,7 @@ void GPENCIL_OT_select_all(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - ot->ui = gpencil_select_ui; - WM_operator_properties_select_all(ot); - WM_operator_property_error_threshold(ot); } /** \} */ @@ -1868,14 +1826,12 @@ void GPENCIL_OT_select(wmOperatorType *ot) ot->invoke = gpencil_select_invoke; ot->exec = gpencil_select_exec; ot->poll = gpencil_select_poll; - ot->ui = gpencil_select_ui; /* flag */ ot->flag = OPTYPE_UNDO; /* properties */ WM_operator_properties_mouse_select(ot); - WM_operator_property_error_threshold(ot); prop = RNA_def_boolean(ot->srna, "entire_strokes", diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 4b094cc3b23..82287b81171 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2247,11 +2247,11 @@ static void gpencil_copy_points( } static void gpencil_insert_point(bGPdata *gpd, - bGPDstroke *gps, - bGPDspoint *a_pt, - bGPDspoint *b_pt, - const float co_a[3], - float co_b[3]) + bGPDstroke *gps, + bGPDspoint *a_pt, + bGPDspoint *b_pt, + const float co_a[3], + float co_b[3]) { bGPDspoint *temp_points; int totnewpoints, oldtotpoints; @@ -2615,7 +2615,7 @@ void ED_gpencil_select_toggle_all(bContext *C, int action) } } -void ED_gpencil_select_curve_toggle_all(bContext *C, int action, float error_threshold) +void ED_gpencil_select_curve_toggle_all(bContext *C, int action) { /* if toggle, check if we need to select or deselect */ if (action == SEL_TOGGLE) { @@ -2650,7 +2650,7 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action, float error_thr /* Make sure stroke has an editcurve */ if (gps->editcurve == NULL) { - BKE_gpencil_stroke_editcurve_update(gps, error_threshold); + BKE_gpencil_stroke_editcurve_update(gps, gpd->curve_edit_threshold); gps->editcurve->resolution = gpd->editcurve_resolution; gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; BKE_gpencil_stroke_geometry_update(gpd, gps); diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 8748c491804..6fef0a511b4 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -320,7 +320,7 @@ int ED_gpencil_select_stroke_segment(struct bGPdata *gpd, float r_hitb[3]); void ED_gpencil_select_toggle_all(struct bContext *C, int action); -void ED_gpencil_select_curve_toggle_all(struct bContext *C, int action, float error_threshold); +void ED_gpencil_select_curve_toggle_all(struct bContext *C, int action); /* Ensure stroke sbuffer size is enough */ struct tGPspoint *ED_gpencil_sbuffer_ensure(struct tGPspoint *buffer_array, _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs