Commit: 5f6bc522b88e079ffbf7df5b40777933e9ab2c4c Author: Falk David Date: Mon Jun 1 17:55:20 2020 +0200 Branches: soc-2020-greasepencil-curve https://developer.blender.org/rB5f6bc522b88e079ffbf7df5b40777933e9ab2c4c
GPencil: Added a dummy operator to test curve data The main purpose for this operator is to test the curve data structure that was added to the stroke data structure. =================================================================== M source/blender/editors/gpencil/gpencil_edit.c M source/blender/editors/gpencil/gpencil_intern.h M source/blender/editors/gpencil/gpencil_ops.c =================================================================== diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 8771fcb0c8d..0b0c89ecbf6 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -5057,3 +5057,48 @@ void GPENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot) } /** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Test Operator for curve editing + * \{ */ + +static int gp_test_stroke_curve_data_exec(bContext *C, wmOperator *op) +{ + Object *ob = CTX_data_active_object(C); + bGPdata *gpd = (bGPdata *)ob->data; + + /* sanity checks */ + if (ELEM(NULL, gpd)) { + return OPERATOR_CANCELLED; + } + + /* TODO: create new gp object with curve data */ + + /* notifiers */ + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + + return OPERATOR_FINISHED; +} + +void GPENCIL_OT_test_stroke_curve_data(wmOperatorType *ot) +{ + PropertyRNA *prop; + + /* identifiers */ + ot->name = "Test stroke curve data"; + ot->idname = "GPENCIL_OT_test_stroke_curve_data"; + ot->description = "Test operator to test the curve data in a grease pencil stroke."; + + /* api callbacks */ + ot->exec = gp_test_stroke_curve_data_exec; + ot->poll = gp_active_layer_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + /* XXX: no props for now */ +} + +/** \} */ \ No newline at end of file diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 473913c5459..11b3b78928e 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -444,6 +444,8 @@ void GPENCIL_OT_snap_cursor_to_selected(struct wmOperatorType *ot); void GPENCIL_OT_reproject(struct wmOperatorType *ot); void GPENCIL_OT_recalc_geometry(struct wmOperatorType *ot); +void GPENCIL_OT_test_stroke_curve_data(struct wmOperatorType *ot); + /* stroke sculpting -- */ void GPENCIL_OT_sculpt_paint(struct wmOperatorType *ot); diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 94c86572fd3..d86ee47adad 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -569,6 +569,8 @@ void ED_operatortypes_gpencil(void) WM_operatortype_append(GPENCIL_OT_sculpt_paint); WM_operatortype_append(GPENCIL_OT_weight_paint); + WM_operatortype_append(GPENCIL_OT_test_stroke_curve_data); + /* Editing (Buttons) ------------ */ WM_operatortype_append(GPENCIL_OT_annotation_add); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs