Sorting File Names In File Picker

The file picker has an automatic feature in its sort-by-name mode where, if it sees a sequence of decimal digits, it tries to sort based on their integer value, rather than as a string.

This is fine as far as it goes, but I have some filenames with hexadecimal digits in them. Because decimal digits may occur in some parts of these but not others, the name sorting ends up all over the place.

I don’t think it’s feasible to try to do automatic detection of this situation. Therefore, I think the only feasible alternative is to add a checkbox to allow the user to manually disable automatic digit recognition, and just sort all filenames as strings.

Sound reasonable?

Give some examples of names as you describe sorting incorrectly.

Small example (more available on request):

Arcade-Dual-017e4d93.blend
Arcade-Dual-1e098a2d.blend
Arcade-Dual-3b1c8647.blend

appear in that order in the ls command, but with the first one moved to the bottom in Blender’s increasing-name-order display.

As a longer example, consider this list of file names:

Building-Highrise-07d31f0f.blend
Building-Highrise-0a09620b.blend
Building-Highrise-2e72d5c3.blend
Building-Highrise-5092c86f.blend
Building-Highrise-577500d1.blend
Building-Highrise-66850d69.blend
Building-Highrise-684c31e5.blend
Building-Highrise-72f97de4.blend
Building-Highrise-7a3162a5.blend
Building-Highrise-7e40bd6a.blend
Building-Highrise-821f8e5a.blend
Building-Highrise-9a7df5f4.blend
Building-Highrise-a2d32285.blend
Building-Highrise-ab5d1b8c.blend
Building-Highrise-d9b3247c.blend
Building-Highrise-f86f7af0.blend
Building-Highrise-fbfbece3.blend

This is the order in which Blender shows them:

Building-Highrise-0a09620b.blend
Building-Highrise-2e72d5c3.blend
Building-Highrise-7a3162a5.blend
Building-Highrise-07d31f0f.blend
Building-Highrise-7e40bd6a.blend
Building-Highrise-9a7df5f4.blend
Building-Highrise-72f97de4.blend
Building-Highrise-684c31e5.blend
Building-Highrise-821f8e5a.blend
Building-Highrise-5092c86f.blend
Building-Highrise-66850d69.blend
Building-Highrise-577500d1.blend
Building-Highrise-a2d32285.blend
Building-Highrise-ab5d1b8c.blend
Building-Highrise-d9b3247c.blend
Building-Highrise-f86f7af0.blend
Building-Highrise-fbfbece3.blend

But how do you experience that list in that order? how is this list shown to you in your operating system? I thought all have been showing file system items in natural order for years now. In Blender we are just trying to match, as close as possible, how you see the same list of files outside of Blender.

The first order is what is shown by default in the ls(1) command, unless I specify the -v option to get natural order.

If you mean what does a GUI file manager show, I just tried KDE Dolphin, and while it defaults to “natural” order, at least it offers me the option to switch to “alphabetical”, with or without case sensitivity.

This is why we have a choice, because one setting will not suit all situations.

2 Likes