rlguy/Blender-FLIP-Fluids

Savestates are not listed in order on Linux systems

Closed this issue · 3 comments

System Information

Blender Version (including hash): 3.6.2
FLIP Fluids Version: 1.7.1
Operating System: Ubuntu 22.04
CPU: i7-3770k
GFX: Nvidia GTX 1070
RAM: 32GB

Describe the bug

savestates

Savestates on windows are listed in order, while on Linux they are arbitrarily ordered

_update_savestate_enums() in domain_bake_properties.py reads each savestate in the savestates directory and iterates through them in the order that os.listdir() returns them. This order is not guaranteed to be stable according to Python docs.

On Windows, they happen to be in the desired order (probably because of some property of NTFS) but on Linux it returns them in a seemingly random order.

I "fixed" this by sorting the directory list first:

        sorted_dirs = os.listdir(savestates_directory)
        sorted_dirs.sort()
        subdirs = [d for d in sorted_dirs if os.path.isdir(os.path.join(savestates_directory, d))]

...but my python is rusty and an actual fix probably needs to do natural sorting, which I think .sort() does not do natively.

Thanks for looking into this!

Thanks for the report and info! That's good info to know. We'll check it out and get this fixed for the next version.

Just had a chance to look into this and I think your solution should work fine. The filename numbers are all padded with zeroes to be 6 digits, so regular sort() should work.

This fix will be included in FLIP Fluids 1.7.2, release TBA, but likely will be released shortly before the release of Blender 4.0 on Nov 7, 2023.

Wow, thank you so much for the quick response!

looking forward to seeing it