Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c155
1 files changed, 0 insertions, 155 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 15162f491d5..a183c34fd9d 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -5206,158 +5206,3 @@ void GPENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Reset Stroke Vertex Color Operator
- * \{ */
-
-static void gpencil_reset_vertex(bGPDstroke *gps, eGp_Vertex_Mode mode)
-{
- if (mode != GPPAINT_MODE_STROKE) {
- zero_v4(gps->vert_color_fill);
- }
-
- if (mode != GPPAINT_MODE_FILL) {
- bGPDspoint *pt;
- for (int i = 0; i < gps->totpoints; i++) {
- pt = &gps->points[i];
- zero_v4(pt->vert_color);
- }
- }
-}
-
-static int gpencil_stroke_reset_vertex_color_exec(bContext *C, wmOperator *op)
-{
- Object *obact = CTX_data_active_object(C);
- bGPdata *gpd = (bGPdata *)obact->data;
- const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
- const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
- bGPDstroke *gps = NULL;
-
- if (gpd == NULL) {
- BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
- return OPERATOR_CANCELLED;
- }
- eGp_Vertex_Mode mode = RNA_enum_get(op->ptr, "mode");
-
- /* First need to check if there are something selected. If not, apply to all strokes. */
- bool all_strokes = true;
- CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
- bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
- for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
- if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
- if (gpf == NULL) {
- continue;
- }
- for (gps = gpf->strokes.first; gps; gps = gps->next) {
- /* skip strokes that are invalid for current view */
- if (ED_gpencil_stroke_can_use(C, gps) == false) {
- continue;
- }
-
- if (is_curve_edit) {
- if (gps->editcurve == NULL) {
- continue;
- }
- bGPDcurve *gpc = gps->editcurve;
- if (gpc->flag & GP_CURVE_SELECT) {
- all_strokes = false;
- break;
- }
- }
- else {
- if (gps->flag & GP_STROKE_SELECT) {
- all_strokes = false;
- break;
- }
- }
- }
- /* if not multiedit, exit loop*/
- if (!is_multiedit) {
- break;
- }
- }
- }
- }
- CTX_DATA_END;
-
- /* Reset Vertex colors. */
- bool changed = false;
- CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
- bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
-
- for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
- if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
- if (gpf == NULL) {
- continue;
- }
-
- for (gps = gpf->strokes.first; gps; gps = gps->next) {
- /* skip strokes that are invalid for current view */
- if (ED_gpencil_stroke_can_use(C, gps) == false) {
- continue;
- }
-
- if (is_curve_edit) {
- if (gps->editcurve == NULL) {
- continue;
- }
- bGPDcurve *gpc = gps->editcurve;
- if ((all_strokes) || (gpc->flag & GP_CURVE_SELECT)) {
- gpencil_reset_vertex(gps, mode);
- }
- }
- else {
- if ((all_strokes) || (gps->flag & GP_STROKE_SELECT)) {
- gpencil_reset_vertex(gps, mode);
- }
- }
-
- changed = true;
- }
- /* if not multiedit, exit loop*/
- if (!is_multiedit) {
- break;
- }
- }
- }
- }
- CTX_DATA_END;
-
- if (changed) {
- /* updates */
- DEG_id_tag_update(&gpd->id,
- ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
- DEG_id_tag_update(&obact->id, ID_RECALC_COPY_ON_WRITE);
- WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
- }
-
- return OPERATOR_FINISHED;
-}
-
-void GPENCIL_OT_stroke_reset_vertex_color(wmOperatorType *ot)
-{
- static EnumPropertyItem mode_types_items[] = {
- {GPPAINT_MODE_STROKE, "STROKE", 0, "Stroke", "Reset Vertex Color to Stroke only"},
- {GPPAINT_MODE_FILL, "FILL", 0, "Fill", "Reset Vertex Color to Fill only"},
- {GPPAINT_MODE_BOTH, "BOTH", 0, "Stroke and Fill", "Reset Vertex Color to Stroke and Fill"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* identifiers */
- ot->name = "Reset Vertex Color";
- ot->idname = "GPENCIL_OT_stroke_reset_vertex_color";
- ot->description = "Reset vertex color for all or selected strokes";
-
- /* callbacks */
- ot->exec = gpencil_stroke_reset_vertex_color_exec;
- ot->poll = gpencil_stroke_edit_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
- ot->prop = RNA_def_enum(ot->srna, "mode", mode_types_items, GPPAINT_MODE_BOTH, "Mode", "");
-}
-
-/** \} */