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:
-rw-r--r--release/scripts/modules/bpy_types.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 5d89763f34b..faac3844c45 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -900,6 +900,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
layout = self.layout
import os
+ import re
import bpy.utils
layout = self.layout
@@ -920,7 +921,10 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
(filter_path(f)))
])
- files.sort()
+ # 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)
col = layout.column(align=True)