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:
authorSybren A. Stüvel <sybren@blender.org>2020-03-16 18:16:35 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-03-16 18:23:12 +0300
commitba26adee0c5caa6d4f3ffbda9c7038e807e3f9d2 (patch)
tree735f0f44a9ee5dfd4f213e436e3b014b2cf879e6 /source/blender/editors
parentf0856b1fdad2e4a65cfdcffd01ee581ed07c2d93 (diff)
Fix T61234 Mirroring Grease Pencil keyframes in the Dopesheet fails
`ANIM_animdata_update()` did not sort grease pencil frames. A pre-existing comment stated this wouldn't be necessary as `posttrans_gpd_clean()` already does this. However, this is only applicable when the change is performed via the transform system. The mirror operator doesn't call `posttrans_gpd_clean()`, invalidating the assumption in the comment. I moved the sorting code into `BKE_gpencil_layer_frames_sort()`, which is now called from both `ANIM_animdata_update()` and `posttrans_gpd_clean()`.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_deps.c4
-rw-r--r--source/blender/editors/transform/transform_convert.c21
2 files changed, 2 insertions, 23 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 98fcb9c5ce5..439b8071deb 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -368,9 +368,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
if (ale->update & ANIM_UPDATE_ORDER) {
ale->update &= ~ANIM_UPDATE_ORDER;
if (gpl) {
- /* While correct & we could enable it: 'posttrans_gpd_clean' currently
- * both sorts and removes doubles, so this is not necessary here. */
- // gpencil_sort_frames(gpl);
+ BKE_gpencil_layer_frames_sort(gpl, NULL);
}
}
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index f93a3ec260b..4ccb97b7a00 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -830,25 +830,6 @@ bool FrameOnMouseSide(char side, float frame, float cframe)
/* ********************* ACTION EDITOR ****************** */
-static int gpf_cmp_frame(void *thunk, const void *a, const void *b)
-{
- const bGPDframe *frame_a = a;
- const bGPDframe *frame_b = b;
-
- if (frame_a->framenum < frame_b->framenum) {
- return -1;
- }
- if (frame_a->framenum > frame_b->framenum) {
- return 1;
- }
- *((bool *)thunk) = true;
- /* selected last */
- if ((frame_a->flag & GP_FRAME_SELECT) && ((frame_b->flag & GP_FRAME_SELECT) == 0)) {
- return 1;
- }
- return 0;
-}
-
static int masklay_shape_cmp_frame(void *thunk, const void *a, const void *b)
{
const MaskLayerShape *frame_a = a;
@@ -881,7 +862,7 @@ static void posttrans_gpd_clean(bGPdata *gpd)
bGPDframe *gpf, *gpfn;
bool is_double = false;
- BLI_listbase_sort_r(&gpl->frames, gpf_cmp_frame, &is_double);
+ BKE_gpencil_layer_frames_sort(gpl, &is_double);
if (is_double) {
for (gpf = gpl->frames.first; gpf; gpf = gpfn) {