From d30a1dcb62bcd3bb3bf0f54ee857578e6e8310c5 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Mon, 26 Jun 2023 19:33:07 +0000 Subject: [PATCH] Added Nice Sorting Functionality using RE Yeah --- UI/UI_math.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/UI/UI_math.py b/UI/UI_math.py index 9ed4cdb..3d4ab66 100644 --- a/UI/UI_math.py +++ b/UI/UI_math.py @@ -1,6 +1,7 @@ # THIS FILE IS A PART OF VCStudio # PYTHON 3 +import re # This is collection of simple geometric math operations that I gonna use trough # out the UI of the VCStudio. Stuff like collision detections, overlap detections @@ -161,3 +162,15 @@ def timestring(tleft): +def tryint(s): + try: + return int(s) + except: + return s + +def alphanum_key(s): + return [ tryint(c) for c in re.split('([0-9]+)', s) ] + +def sort_nicely(l): + l.sort(key=alphanum_key) +