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:
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r--release/scripts/modules/bpy_types.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index faac3844c45..e90739debf8 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -921,10 +921,11 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
(filter_path(f)))
])
- # Python does not have a natural sort function
- natural_sort = lambda s: [int(t) if t.isdigit() else t.lower()
- for t in re.split('(\d+)', (str)(s))]
- files.sort(key=natural_sort)
+ # Perform a "natural sort", so 20 comes after 3 (for example).
+ files.sort(
+ key=lambda file_path:
+ tuple(int(t) if t.isdigit() else t for t in re.split("(\d+)", file_path[0].lower())),
+ )
col = layout.column(align=True)