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/blenkernel/intern/gpencil.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/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 1aec1ad296d..4167f60e880 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1134,7 +1134,7 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in
* Ensure selection status of stroke is in sync with its points.
* \param gps: Grease pencil stroke
*/
-void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps)
+void BKE_gpencil_stroke_sync_selection(bGPdata *gpd, bGPDstroke *gps)
{
bGPDspoint *pt;
int i;
@@ -1148,6 +1148,7 @@ void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps)
* so initially, we must deselect
*/
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
if (pt->flag & GP_SPOINT_SELECT) {
@@ -1155,9 +1156,13 @@ void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps)
break;
}
}
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
+ }
}
-void BKE_gpencil_curve_sync_selection(bGPDstroke *gps)
+void BKE_gpencil_curve_sync_selection(bGPdata *gpd, bGPDstroke *gps)
{
bGPDcurve *gpc = gps->editcurve;
if (gpc == NULL) {
@@ -1165,6 +1170,7 @@ void BKE_gpencil_curve_sync_selection(bGPDstroke *gps)
}
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
gpc->flag &= ~GP_CURVE_SELECT;
bool is_selected = false;
@@ -1187,6 +1193,19 @@ void BKE_gpencil_curve_sync_selection(bGPDstroke *gps)
if (is_selected) {
gpc->flag |= GP_CURVE_SELECT;
gps->flag |= GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
+ }
+}
+
+/* Assign unique stroke ID for selection. */
+void BKE_gpencil_stroke_select_index_set(bGPdata *gpd, bGPDstroke *gps, const bool reset)
+{
+ if (!reset) {
+ gpd->select_last_index++;
+ gps->select_index = gpd->select_last_index;
+ }
+ else {
+ gps->select_index = 0;
}
}
@@ -2512,6 +2531,11 @@ bool BKE_gpencil_from_image(
pt->flag |= GP_SPOINT_SELECT;
}
}
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
+ }
+
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
}