Bug 375885 - Numerical sorting doesn't work when importing animation frames
Summary: Numerical sorting doesn't work when importing animation frames
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: 3.1.1
Platform: Appimage Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-02 08:52 UTC by Dmitry Kazakov
Modified: 2019-09-10 08:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of the problem (373.83 KB, image/png)
2017-02-02 08:52 UTC, Dmitry Kazakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Kazakov 2017-02-02 08:52:32 UTC
Created attachment 103767 [details]
Screenshot of the problem

Changing sorting type does nothing. Happens *only* in AppImage. Home-built, packaged and Windows versions work fine.
Comment 1 Halla Rempt 2017-02-27 13:59:47 UTC
Probably a matter of a different version of Qt. I'd suggest people use leading 0000's when numbering their frames.
Comment 2 Halla Rempt 2019-09-02 13:22:40 UTC
Yeah, I checked QCollator, and the behaviour of qcollator is very platform specific.
Comment 3 Halla Rempt 2019-09-02 13:39:02 UTC
Git commit 2568bb5825b748d569cbb75c228d6f68e690d0ba by Boudewijn Rempt.
Committed on 02/09/2019 at 13:38.
Pushed by rempt into branch 'master'.

Fix sort order of frames with simple naming scheme

QCollator::isNumerical works in platform-specific and Qt-version
specific ways, and cannot be guaranteed to sort mixed alphanumerical
strings in a numerical way. It just doesn't work that way.

This patch extracts all numbers for the comparant strings, and then
checks the last number in each string numerically. Now, if the user
would make frames like this:

scene1frame9
scene1frame10

Everything is fine.

frame9scene1
frame10scene1

will break; and unless we offer a kind of filename templating thing
where the user can specify which part of the filename provides the
frame number, there's nothing more we can do.

M  +15   -4    libs/ui/dialogs/kis_dlg_import_image_sequence.cpp
M  +5    -1    libs/ui/forms/wdgimportimagesequence.ui

https://invent.kde.org/kde/krita/commit/2568bb5825b748d569cbb75c228d6f68e690d0ba
Comment 4 Halla Rempt 2019-09-10 08:27:58 UTC
Git commit 0f00ae703c853bca2d699cd2ee95e50dc0ed8120 by Boudewijn Rempt.
Committed on 10/09/2019 at 08:25.
Pushed by rempt into branch 'krita/4.2'.

Fix sort order of frames with simple naming scheme

QCollator::isNumerical works in platform-specific and Qt-version
specific ways, and cannot be guaranteed to sort mixed alphanumerical
strings in a numerical way. It just doesn't work that way.

This patch extracts all numbers for the comparant strings, and then
checks the last number in each string numerically. Now, if the user
would make frames like this:

scene1frame9
scene1frame10

Everything is fine.

frame9scene1
frame10scene1

will break; and unless we offer a kind of filename templating thing
where the user can specify which part of the filename provides the
frame number, there's nothing more we can do.

M  +15   -4    libs/ui/dialogs/kis_dlg_import_image_sequence.cpp
M  +5    -1    libs/ui/forms/wdgimportimagesequence.ui

https://invent.kde.org/kde/krita/commit/0f00ae703c853bca2d699cd2ee95e50dc0ed8120