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:
authorAntonio Vazquez <blendergit@gmail.com>2021-02-19 19:18:12 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-02-19 19:41:28 +0300
commit6bba830589860c32a2543b14cd2c9bcd2b9e4948 (patch)
tree079027534dc4c6ea10d49816cde608c751602476 /source/blender/editors/gpencil/gpencil_utils.c
parent2441886c58e1258645195214e0aa1987c29f0c35 (diff)
GPencil: Interpolate Tools refactor
Following with the changes included to interpolate strokes of different number of points, a full review has been done in the interpolation tools. * Interpolate now is a tool and not an operator. It was not logic to have this tool as a button. * Interpolate tool parameters have been moved to topbar. * Interpolate popover has been removed from topbar and interpolate `Sequence` operator has been moved to grease pencil menu. * Interpolate Sequence now include a Redo panel. * Interpolate tool now allows to select the strokes by pairs. This allows to interpolate any stroke with any stroke and not as before that it was only possible by drawing order. If no stroke is selected, the interpolation is done as before. * Now is possible interpolate again if a previous keyframe exist. Before, it was impossible to interpolate two times in same frame and this made impossible to do the interpolation by groups of frames. * New automatic option to `Flip strokes` if the stroke and end are not in the right position. Also the flip can be set manually for corner cases. * Cleanup of menus related to interpolate. * Fixed some bugs and removed parameters from scene because now all are tool or operator contained. * Some code cleanup and function renames. This commit also includes the some codebase to future implementation of the concept `Vertex Active` that now does not exist in grease pencil.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_utils.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 9b12772bc9b..f9242c5a1a8 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1167,6 +1167,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
if (keep_original) {
gps_active = BKE_gpencil_stroke_duplicate(gps, true, true);
gps_active->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps_active, true);
for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) {
pt->flag &= ~GP_SPOINT_SELECT;
}
@@ -1689,6 +1690,10 @@ void ED_gpencil_vgroup_select(bContext *C, Object *ob)
gps->flag |= GP_STROKE_SELECT;
}
}
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
+ }
}
}
@@ -2564,6 +2569,9 @@ int ED_gpencil_select_stroke_segment(bGPdata *gpd,
void ED_gpencil_select_toggle_all(bContext *C, int action)
{
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = ob->data;
+
/* for "toggle", test for existing selected strokes */
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
@@ -2588,6 +2596,9 @@ void ED_gpencil_select_toggle_all(bContext *C, int action)
* NOTE: we limit ourselves to editable layers, since once a layer is "locked/hidden
* nothing should be able to touch it
*/
+ /* Set selection index to 0. */
+ gpd->select_last_index = 0;
+
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
/* deselect all strokes on all frames */
@@ -2605,6 +2616,7 @@ void ED_gpencil_select_toggle_all(bContext *C, int action)
}
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
}
}
}
@@ -2642,9 +2654,11 @@ void ED_gpencil_select_toggle_all(bContext *C, int action)
/* Change status of stroke */
if (selected) {
gps->flag |= GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
}
else {
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
}
}
CTX_DATA_END;
@@ -2666,6 +2680,11 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
}
if (action == SEL_DESELECT) {
+ /* Set selection index to 0. */
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = ob->data;
+ gpd->select_last_index = 0;
+
GP_EDITABLE_CURVES_BEGIN(gps_iter, C, gpl, gps, gpc)
{
for (int i = 0; i < gpc->tot_curve_points; i++) {
@@ -2676,6 +2695,7 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
}
gpc->flag &= ~GP_CURVE_SELECT;
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
}
GP_EDITABLE_CURVES_END(gps_iter);
}
@@ -2717,10 +2737,12 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
if (selected) {
gpc->flag |= GP_CURVE_SELECT;
gps->flag |= GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
}
else {
gpc->flag &= ~GP_CURVE_SELECT;
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
}
}
GP_EDITABLE_STROKES_END(gps_iter);